2001 JI Open Discussion Posted August 14, 2006 Share Posted August 14, 2006 By: eric zhang - topcheer webapp doesn't work 2002-05-12 18:16can anybody show me some working code that generates .jasper file in jsp file? i am using Win2000+OC4J+Oracle 817 and there is my code <%@ page errorPage="jasperError.jsp" %> <%@ page import="dori.jasper.engine.*" %> <%@ page import="java.util.*" %> <%@ page import="java.io.*" %> <%@ page import="java.sql.*" %> <%@ page import="java.awt.*" %> <% String driver = "oracle.jdbc.driver.OracleDriver"; String connectString = "jdbc:oracle:thin:@dbserver:1521:emis"; String user = "usremufnew"; String password = "oracle"; Class.forName(driver); Connection conn = DriverManager.getConnection(connectString, user, password); File xmlFile = new File(application.getRealPath("/pdfreport/FirstJasper.xml")); File reportFile = new File(application.getRealPath("/pdfreport/FirstJasper.jasper")); JasperManager.compileReportToFile(xmlFile.getPath(),reportFile.getPath()); Map parameters = new HashMap(); JasperManager.runReportToPdfFile( reportFile.getPath(), parameters, conn ); conn.close(); out.println("ok"); %> there was a compile error on OC4J console: java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(XMLReaderFactory.java:118) at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(XMLReaderFactory.java:96) at dori.jasper.xml.JRXmlLoader.loadXML(JRXmlLoader.java:176) at dori.jasper.xml.JRXmlLoader.load(JRXmlLoader.java:143) at dori.jasper.engine.JasperManager.compileReportToFile(JasperManager.java:843) at _pdfreport._letter._jspService(_letter.java:76) at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56) at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:496) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:254) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:383) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:327) at javax.servlet.http.HttpServlet.service(HttpServlet.java:336) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:66 7) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatche r.java:269) at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:728) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:243) at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62) NESTED BY : dori.jasper.engine.JRException: at dori.jasper.xml.JRXmlLoader.loadXML(JRXmlLoader.java:306) at dori.jasper.xml.JRXmlLoader.load(JRXmlLoader.java:143) at dori.jasper.engine.JasperManager.compileReportToFile(JasperManager.java:843) at _pdfreport._letter._jspService(_letter.java:76) at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56) at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:496) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:254) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:383) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:327) at javax.servlet.http.HttpServlet.service(HttpServlet.java:336) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:66 7) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatche r.java:269) at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:728) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:243) at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62) am i missing something? thanks. By: eric zhang - topcheer i can get jasper file if i use ant build tool 2002-05-12 18:52can anybody help me By: eric zhang - topcheer ok,it works now 2002-05-13 00:17i put everything in xerces.jar into oc4j.jar then restart oc4j,it works problem is when i install oc4j on another computer,i have to add these file to oc4j.jar is there any way to solve this problem more efficiently without change the oc4j.jar,i have put xerces.jar everywhere in my OC4J server's directory structure,it doesn't work unless i put the whole directory structure of xerces.jar into oc4j.jar. thanks. --------------------------- thanks to teodord,you have made a great tool. By: Teodor Danciu - teodord RE: webapp doesn't work 2002-05-14 00:56 Hi, You simply need to add the xerces.jar file to the classpath when launching the server. You don't have to put the xerces.jar content into another jar. If it works like this it is because your oc4j.jar is in the classpath and xerces.jar is not. Good luck! Teodor By: eric zhang - topcheer oc4j.jar is the server itself 2002-05-14 17:52the command i launch the server is: java -hotspot -Dejb.assert=false -jar oc4j.jar should i put -cp XXXX in the command line? By: Teodor Danciu - teodord RE: oc4j.jar is the server itself 2002-05-15 00:23 Hi, You could try that. If it still doesn't work, then put also the oc4j.jar in the classpath and launch its main class instead of using the –jar switch. You can see which is the main class by looking into its Manifest file. Thank you, Teodor By: eric zhang - topcheer thanks for your advice 2002-05-15 19:30i found a position in oc4j.jar's manifest.mf file to place my extra libs. this is my manifest.mf Manifest-Version: 1.0 Main-Class: com.evermind.server.OC4JServer Created-By: 1.2 (Sun Microsystems Inc.) Class-Path: xerces.jar ejb.jar ../../jdk/jre/lib/ext/jndi.jar jdbc.jar ../../opmn /lib/ons.jar ../../lib/dms.jar ../../dms/lib/dms.jar ../../jdk/jre/li b/ext/jta.jar connector.jar ../../jdk/lib/tools.jar ../../lib/jsse.ja r ../../oracle/lib/jsse.jar ../../jdk/jre/lib/ext/jnet.jar ../../jdk/ jre/lib/ext/jcert.jar ../../jdk/jre/lib/ext/activation.jar ../../jdk/ jre/lib/ext/mail.jar ../../lib/xmlparserv2.jar ../../oracle/lib/xmlpa rserv2.jar jaxp.jar jaas.jar jazn.jar ../../jdbc/lib/classes12dms.jar ../../oracle/jdbc/lib/classes12dms.jar ../../jdbc/lib/nls_charset12. jar ../../oracle/jdbc/lib/nls_charset12.jar jaxb-rt-1.0-ea.jar lib/ja sper.zip ../../soap/lib/soap.jar ../../soap/lib/wsdl.jar lib/aqapi.ja r lib/jem.jar ../../javacache/lib/cache.jar ../../javacache/admin lib /http_client.jar ../../jlib/jssl-1_1.jar ../../oracle/jlib/jssl-1_1.j ar ../../jlib/repository.jar ../../oracle/jlib/repository.jar Name: javax/servlet/ Specification-Version: 2.3 Implementation-Title: javax.servlet Name: "Oracle9iAS Containers for J2EE" Implementation-Vendor: "Evermind" Implementation-Title: "com.evermind.server" Implementation-Version: "2.0.0" Name: javax/servlet/jsp/ Specification-Version: 1.1 Implementation-Title: javax.servlet.jsp question is i have to add a line : System.setProperty("org.xml.sax.driver","org.apache.xerces.parsers.SAXParser"); to my jsp file to make it run properly.when i put everything in oc4j.jar,it didn't ask me to add this line of code and works fine. what's the difference? Thank you. Eric By: Teodor Danciu - teodord RE: thanks for your advice 2002-05-16 06:19 Hi, It means that the server already supplies a value for this system property and you don't have to do it yourself. If ain't break, don't fix it! :) Good luck! Teodor 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