Square Posted November 17, 2006 Share Posted November 17, 2006 When I released my project in tomcat in the operation system of Windows, the jasperreport is totally correct. But after I released it to the Weblogic in the operation system of Unix, the problem happened. When the fillReport method of JasperFillManager is used, the error occured. The error information was:java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280) at com.linkage.struts.BaseAction.execute(BaseAction.java:92) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at org.extremecomponents.table.filter.AbstractExportFilter.doFilter(AbstractExportFilter.java:49) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at com.linkage.pub.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:99) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6724) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3764) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2644) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)Caused by: java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable. at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method) at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:139) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:62) at net.sf.jasperreports.engine.util.JRGraphEnvInitializer.initializeGraphEnv(JRGraphEnvInitializer.java:58) at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:311) at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:92) at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:74) at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:147) at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:83) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:601) at com.linkage.mobile.report.logic.JasperReportUtil.fillData(JasperReportUtil.java:78) at com.linkage.mobile.report.action.TradeReportAction.fillDate(TradeReportAction.java:119) at com.linkage.mobile.report.action.TradeReportAction.queryTradeReport(TradeReportAction.java:35)I searched this error on the internet. there were some people said, if I added "-Djava.awt.headless=true" command in the config file startWLS.sh, the problem can be solved. But the unix server didn't support the headless. How can I do for this problem? Is there any one can tell me? Thank you very much! Link to comment Share on other sites More sharing options...
Square Posted November 17, 2006 Author Share Posted November 17, 2006 I am waiting on line for your answer. Link to comment Share on other sites More sharing options...
Square Posted November 17, 2006 Author Share Posted November 17, 2006 OK, the problem is solved by myself. Link to comment Share on other sites More sharing options...
SteJ Posted November 27, 2006 Share Posted November 27, 2006 Hi,We are encountering the same problem, could you please tell us how you solved it ?Best regards,SteJ Link to comment Share on other sites More sharing options...
wegnerk Posted November 27, 2006 Share Posted November 27, 2006 I also had that problem with unix/linux and tomcat. the JR-libraries use some kind of awt-libraries and these need under unix an x11-server running. One solution is to change your tomcat or Weblogic configuration. For tomcat: open the catalina.sh properties file and insert the line:Code:CATALINA_OPTS="-Djava.awt.headless=true"with this line, the tomcat can use java and awt libraries without an existing x11 server. hope, this will help a bit Link to comment Share on other sites More sharing options...
SteJ Posted November 28, 2006 Share Posted November 28, 2006 Thank you for your answer, the problem is not solved but I seem to be a step further in its resolution.I positionned the headless environment variable.I put the PJA libs in the project, and now the X11 server error doens't display any more.But another problem appeared : java.lang.Error: Could not find class: com.eteks.java2d.PJAGraphicsEnvironment which are the classes I have configured to deal with. The libs are in the /WEB-INF/lib directory. What could I do to solve this ? Regards Link to comment Share on other sites More sharing options...
SteJ Posted November 30, 2006 Share Posted November 30, 2006 Problems solved There are the things to do : 1. Use PJA toolkit (pja.jar and pjatools.jar) Put the jars in the project2. Define environment variables : // Specify a default folder for storing compiled XML templates JRProperties.setProperty("jasper.reports.compile.class.path", context.getRealPath("/WEB-INF/lib/jasperreports-1.2.7.jar") + System.getProperty("path.separator") + context.getRealPath("/WEB-INF/classes/")); // Specify a default folder for storing compiled XML templates JRProperties.setProperty("jasper.reports.compile.temp",context.getRealPath("/reports/")); // Specify the system properties for the graphical libraries System.setProperty("java.awt.headless", "true"); System.setProperty("java.awt.graphicsenv", "com.eteks.java2d.PJAGraphicsEnvironment"); System.setProperty("java.awt.fonts", "/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType"); System.setProperty("awt.toolkit", "com.eteks.awt.PJAToolkit"); System.setProperty("user.home", context.getRealPath("/WEB-INF/lib/pja.jar")); System.setProperty("java2d.font.usePlatformFont", "false");Define boot classpath to the pja toolkit : For WebSphere 6, in the process definition section, point to the absolute path to the pja jars.e.g.: /od/ISG/installedapps/app.ear/app.war/web-inf/lib/pja.jar:/od/ISG/installedapps/app.ear/app.war/web-inf/lib/pjatools.jar Thank you very much to everyone that helped me (even in other forums), and especially to wegnerk Link to comment Share on other sites More sharing options...
wegnerk Posted November 30, 2006 Share Posted November 30, 2006 you're welcome ;-) nice to know that sometimes one can help ... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now