2002 JI Open Discussion Posted August 18, 2006 Share Posted August 18, 2006 By: Richard J. Ciardo - rciardo Session Bean (Adapter) Help 2003-07-30 13:59 I am trying to front the JasperReports classes with a sesion bean and have run into a problem. My session bean is a bit crude but I am new to Java let alone J2EE and it is for testing right now anyway. Here is the function from my impl class: String createReportHTML( int aRptCode ) { String rptPath = "C:\Temp\reportstore\"; String rptFile = "none"; String rptName = "none"; String rptSourcePath = rptPath + "xml\"; String rptCompilePath = rptPath + "jasper\"; String rptHTMLPath = rptPath + "html\"; switch ( aRptCode ) { case 1: rptFile = "ts_140_us_01"; rptName = "User Software"; break; default: rptFile = "Error"; rptName = "Error"; } if ( rptFile != "Error" ) { System.out.println("BEFORE TRY"); try { System.out.println(" TRY(src): " + rptSourcePath + rptFile + ".xml"); System.out.println(" TRY(dst): " + rptCompilePath + rptFile + ".jasper"); JasperManager.compileReportToFile( rptSourcePath + rptFile + ".xml", rptCompilePath + rptFile + ".jasper" ); } catch (JRException e) { System.out.println("An exception has occurred!"); System.out.println(" Type : " + e.getClass().getName()); System.out.println(" Messagee: " + e.getMessage()); return "Exception"; } System.out.println("AFTER TRY"); } return rptName; } The problem I have having is that any time I call a method on the JasperManager, JasperCompileManager, JasperFillManager or JasperExportManager I get the following exception on my app server (EAServer 4.2) Jul 30 15:36:34 2003: java.lang.ExceptionInInitializerError: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException Jul 30 15:36:34 2003: at org.apache.commons.logging.LogFactory.newFactory(LogFactory.java:558) Jul 30 15:36:34 2003: at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:355) Jul 30 15:36:34 2003: at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:390) Jul 30 15:36:34 2003: at dori.jasper.engine.xml.JRXmlDigester.<clinit>(JRXmlDigester.java:100) Jul 30 15:36:34 2003: at dori.jasper.engine.xml.JRXmlLoader.prepareDigester(JRXmlLoader.java:428) Jul 30 15:36:34 2003: at dori.jasper.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:370) Jul 30 15:36:34 2003: at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:357) Jul 30 15:36:34 2003: at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:337) Jul 30 15:36:34 2003: at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:323) Jul 30 15:36:34 2003: at dori.jasper.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:121) Jul 30 15:36:34 2003: at dori.jasper.engine.JasperManager.compileReportToFile(JasperManager.java:907) Jul 30 15:36:34 2003: at com.americanappraisal.report.ReportSessionEJBImpl.createReportHTML(Unknown Source) Jul 30 15:36:34 2003: at com.americanappraisal.report._sk_report_ReportSessionEJB.invoke(_sk_report_ReportSessionEJB.java:159) Jul 30 15:36:34 2003: SystemException: UNKNOWN (report/ReportSessionEJB/createReportHTML - jagadmin@127.0.0.1) I am 99% this isn't a classpath issue. I am invoking my EJB with a JSP for what that is worth. The JSP is acting normally (for interacting with a broken EJB) and the Tomcat console is reporting a CORBA exception as exepected. Any help would be great. Also, any examples (or links to them) of using the API would be great too. It seem the documentation concentrates on the reports themselves mostly. Thanks, Rich By: David Hardwick - dhardwick RE: Session Bean (Adapter) Help 2003-07-30 14:09 I saw the same error when I ran that example. The BeanSh compiler example did work, however, so you may want to look at that example under *webapp* Do you really need a web-based interface for the report design compilation? Just Checking. By: Richard J. Ciardo - rciardo RE: Session Bean (Adapter) Help 2003-07-31 09:23 Thanks for pointing out the webapp example for me. I actually had overlooked it. It has code close to what I am looking to do. The only thing I don't get are the System.setProperty calls. I did not have them in my EJB. Do you know what they are for? To me it looks like they are just programaticly pointing at a library. You are right, a web-based interface for report design complilation alone does sound dumb. I'm just playing around with the api right now trying to figure out how to use it with variable success. What I am really looking to do is to write a session EJB so that all Jasper calls are centralized on our app server. I need to access the EJB with JSPs for web apps, PowerBuilder for fat apps, and by other service type EJBs (like a scheduler). The type of functionality we are looking to put in the EJB include report compilation, filling and exporting and sending them to a holding area for later retrival or send them back the the client for immediate viewing. Any comments or suggestions are more than welcome. Thanks, Rich By: Richard J. Ciardo - rciardo RE: Session Bean (Adapter) Help 2003-08-01 09:02 I have temporaily abondoned the EJB and started writing POJOs to invoke the JasperReports API which has gone extremely well (even for a developer new to Java world). I guess I would now like to know if anyone out there has written a session bean to front the Jasper API AND (I am stressing the "and") has successfully deployed the bean and jars to EAServer 4.2. I know it can be done. It just seems like there is conflict (see my first post) with the Jasper classes and my container. Any ideas? Thanks, Rich 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