0

guys, need help...

Im currently working on a project with jasper report. it seems that the pdf file (report) runs on a browser succesfully without a subreport in Glassfish server but when there is a subreport the error occurs. ive been working with this problem since last week and im already desperate. The project has no problem deploying through NetBeans but when I run the war file on our web server there is a "java.lang.IllegalArgumentException: name" error.

here's the root causes in glassfish log folder:

[#|2011-01-31T13:48:52.117-0800|WARNING|glassfishv3.0|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=24;_ThreadName=http-thread-pool-8080-(1);|StandardWrapperValve[guestFolio]: PWC1406: Servlet.service() for servlet guestFolio threw exception
java.lang.IllegalArgumentException: name
at sun.misc.URLClassPath$Loader.findResource(URLClassPath.java:460)
at sun.misc.URLClassPath.findResource(URLClassPath.java:146)
at java.net.URLClassLoader$2.run(URLClassLoader.java:385)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findResource(URLClassLoader.java:382)
at java.lang.ClassLoader.getResource(ClassLoader.java:1003)
at java.lang.ClassLoader.getResource(ClassLoader.java:998)
at com.sun.enterprise.v3.server.APIClassLoaderServiceImpl$APIClassLoader.getResource(APIClassLoaderServiceImpl.java:205)
at java.lang.ClassLoader.getResource(ClassLoader.java:998)
at java.lang.ClassLoader.getResource(ClassLoader.java:998)
at org.glassfish.web.loader.WebappClassLoader.getResource(WebappClassLoader.java:1143)
at net.sf.jasperreports.engine.util.JRResourcesUtil.findClassLoaderResource(JRResourcesUtil.java:476)
at net.sf.jasperreports.engine.util.JRLoader.loadObjectFromLocation(JRLoader.java:256)
at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateReport(JRFillSubreport.java:301)
at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateSubreport(JRFillSubreport.java:327)
at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluate(JRFillSubreport.java:263)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:258)
at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:499)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2026)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillGroupHeader(JRVerticalFiller.java:618)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillGroupHeaders(JRVerticalFiller.java:540)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:267)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:127)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:942)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:841)
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:58)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:247)
at net.sf.jasperreports.engine.JasperRunManager.runReportToPdf(JasperRunManager.java:203)
at MyReports.guestFolio.processRequest(guestFolio.java:96)
at MyReports.guestFolio.doGet(guestFolio.java:136)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:619)

4
Contributors
5
Replies
9
Views
6 Years
Discussion Span
Last Post by tamseo
0

I got the exact same problem last week, i have an application that use to run on Oracle Containers for Java (OC4J) but managment decided that we should use Glassfish, the application was running without problems, but i got this exception on one of the reports that contained a subreport, the reason is the subreport PATH, i was appending "/" to the end of the path, like this

parametrosReporte.put("SUBREPORT_DIR",this.getServletContext().getRealPath(this.getServletContext().getInitParameter("reportPath"))+"/");

this worked in OC4J, but not in glassfish, i had to change it to

parametrosReporte.put("SUBREPORT_DIR",this.getServletContext().getRealPath(this.getServletContext().getInitParameter("reportPath"))+System.getProperty("file.separator"));

I hope this works for you, if you havent found another solution

Best Regards

Edited by peter_budo: Keep It Clear - Do wrap your programming code blocks within [code] ... [/code] tags

0

I got the same problem but this workaround doesn't work for me
Here are my code and the exception

String reportResource = CrystalIntegrationReport.getDefDir()+ reportName +  REPORT_EXTENSION + System.getProperty("file.separator") ;
            log.debug("Got file for report " + reportResource);
            ReportClientDocument reportClientDoc = new ReportClientDocument();
            reportClientDoc.open(reportResource, 0);
[businessobjects.reports.sdk.JRCCommunicationAdapter] JRCAgent2 detected an exception: name
at sun.misc.URLClassPath$Loader.findResource(URLClassPath.java:460)
at sun.misc.URLClassPath.findResource(URLClassPath.java:146)
at java.net.URLClassLoader$2.run(URLClassLoader.java:385)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findResource(URLClassLoader.java:382)
at org.apache.catalina.loader.WebappClassLoader.findResource(WebappClassLoader.java:1251)
at org.apache.catalina.loader.WebappClassLoader.getResourceAsStream(WebappClassLoader.java:1475)
0

Hi tamseo,
I was facing exactly same problem from last few days. The issue was occurring when I was trying to load some files and ONLY in a specific server. Not in my local JBoss or Weblogic server.

So I tried to check the code of "at sun.misc.URLClassPath$Loader.findResource()"
It has implementation as below,

URL findResource(String paramString, boolean paramBoolean) {
      URL localURL;
      try {
        localURL = new URL(this.base, ParseUtil.encodePath(paramString, false));
      } catch (MalformedURLException localMalformedURLException) {
        throw new IllegalArgumentException("name");
      }
      ...

So it is actually throwing MalformedURLException which is converted to IllegalArgumentException.

The reason what I found for MalformedURLException is, encodePath() expects protocol with the file path. (Don't know how it was working with local JBoss & JDK)
When I modified the path like "file:/C:/KP/TestServer/server/default/conf/myfile.txt", it worked fine.

So the problem now is making the implementation server independent.. :(

Regards
KP

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

0

Thank you very much kpshastry,
I tried your workaround, it works fine. I think we only need to add the protocol prefix to the path for Windows environment, i didn't have this error with Tomcat on Linux.
You really saved my time. Thanks

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.