Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
problem with servlet
Gibbon
Hi !
I have a problem with birt 2.3.2 and servlet.
I 'm developping with eclipe 3.4.2 and tomcat 6.0.18.
When I start my tomcat and run for the first time my servlet: no problem. All work good.
But when I submit an other order, I hae this error.
Can you help me ? thanks a lot.
10 avr. 2009 13:33:01 org.apache.catalina.core.StandardWrapperValve invoke
GRAVE: "Servlet.service()" pour la servlet ReportServlet a g?n?r? une exception
java.lang.IllegalStateException
at org.mozilla.javascript.ContextFactory.initGlobal(ContextFactory.java:207)
at org.eclipse.birt.report.engine.api.impl.ReportEngine.<clinit>(ReportEngine.java:221)
at org.eclipse.birt.report.engine.api.impl.ReportEngineFactory$1.run(ReportEngineFactory.java:18)
at org.eclipse.birt.report.engine.api.impl.ReportEngineFactory$1.run(ReportEngineFactory.java:1)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.birt.report.engine.api.impl.ReportEngineFactory.createReportEngine(ReportEngineFactory.java:14)
at com.components.stats.reporting.ReportGenerator.executeReport(ReportGenerator.java:30)
at com.components.stats.reporting.ReportServlet.doGet(ReportServlet.java:37)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Find more posts tagged with
Comments
cypherdj
Hi Gibbon,
it might help if you could attach the code for your servlet. From the problem description, it sounds like something to do with Platform.shutdown(), but without the code, it's just an educated guess ;-)
Regards,
Cedric
Gibbon
thanks for your response:
that is my class for pdf generation:
package com.components.stats.reporting;
import java.sql.Date;
import java.sql.Timestamp;
import java.util.Collection;
import java.util.Iterator;
import java.util.logging.Level;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.engine.api.*;
public class ReportGenerator {
public void executeReport(String chemin) {
try{
EngineConfig config = new EngineConfig( );
System.out.println(chemin);
config.setBIRTHome(chemin + "/platform");
config.setLogConfig("C:/Temp", Level.FINEST);
Platform.startup( config );
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
IReportEngine engine = factory.createReportEngine( config );
IReportRunnable design = null;
//Open the report design
design = engine.openReportDesign(chemin + "/rtpdesign/customers.rptdesign");
IRunAndRenderTask task = engine.createRunAndRenderTask(design);
//task.setParameterValue("Top Count", (new Integer(5)));
//task.validateParameters();
//HTMLRenderOption options = new HTMLRenderOption();
//options.setOutputFileName("output/resample/Parmdisp.html");
//options.setOutputFormat("html");
//options.setHtmlRtLFlag(false);
//options.setEmbeddable(false);
//options.setImageDirectory("C:testimages");
PDFRenderOption options = new PDFRenderOption();
options.setOutputFileName("C:/Temp/test.pdf");
options.setOutputFormat("pdf");
task.setRenderOption(options);
task.run();
task.close();
engine.destroy();
System.out.println("fin");
}catch( Exception ex){
ex.printStackTrace();
}
finally
{
Platform.shutdown( );
}
}
}
that is my servlet:
package com.components.stats.reporting;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.OutputStream;
import java.util.logging.Level;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.birt.core.exception.BirtException;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.engine.api.EngineConfig;
import org.eclipse.birt.report.engine.api.HTMLRenderOption;
public class ReportServlet extends HttpServlet {
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
ReportGenerator rapport = new ReportGenerator();
ServletContext sc = req.getSession().getServletContext();
rapport.executeReport(sc.getRealPath("/WEB-INF"));
String urlFormulaire = "/index.jsp";
getServletContext().getRequestDispatcher(urlFormulaire).forward(req,resp);
}
}
cypherdj
Ok, I'll give that a try when I get home this evening. In the meantime, would you try commenting out the Platform.shutdown() and let me know if you're still experiencing the same problem?
Gibbon
thanks a lot.
when I comment the Platform.shutdown( ); I have no problem but no pdf are generated.
Gibbon
cypherdj,
did you have the time to try ?
Thanks a lot
Gibbon
no anwser ? =(
cypherdj
Oops, completely forgot about it, I'll try to have a look this evening, sorry...
Gibbon
thanks a lot
cypherdj
Could you also tell me which jars you put in your java build path please?
Gibbon
In WEB-INF, I created and copied a repository "platform" with repositories "configuration" and "plugins" from the runtime.
I have this jars:
- chartengineapi.jar
- com.ibm.icu_3.8.1.v20080530.jar
- commons-cli-1.0.jar
- coreapi.jar
- crosstabcoreapi.jar
- dataadapterapi.jar
- dataaggregationapi.jar
- dataextraction.jar
- dteapi.jar
- engineapi.jar
- flute.jar
- js.jar
- modelapi.jar
- modelodaapi.jar
- mysql-connector-java-5.1.6.jar
- odadesignapi.jar
- org.apache.commons.codec_1.3.0.v20080530-1600.jar
- org.eclipse.emf.common_2.4.0.v200808251517.jar
- org.eclipse.emf.common_2.4.0.v200902171115.jar
- org.eclipse.emf.ecore.xmi_2.4.1.v200808251517.jar
- org.eclipse.emf.ecore.xmi_2.4.1.v200902171115.jar
- org.eclipse.emf.ecore_2.4.1.v200808251517.jar
- org.eclipse.emf.ecore_2.4.2.v200902171115.jar
- org.w3c.css.sac_1.3.0.v200805290154.jar
- scriptapi.jar
- servlet-api.jar
- viewservlets.jar
- iText-2.1.5.jar
thanks for your help
cypherdj
Hi Gibbon,
I'll have to install BIRT 2.3.2 as I cannot reproduce your problem with BIRT 2.2.2.
I've tested it with a simple report displaying just a text label.
I've also 2.3.1 installed locally, so I'll test it on that and get back to you.
Gibbon
thanks a lot