wood burning stoves 2.0*
The moose likes Servlets and the fly likes Problem with jasper reports Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problem with jasper reports" Watch "Problem with jasper reports" New topic
Author

Problem with jasper reports

Varun Kumar
Greenhorn

Joined: Jan 02, 2007
Posts: 4
hi,
I m having problem using jasperreports with servlets and tomcat so i m giving my code and error generated.
Please also tell me where to put .jasper and .jrxml files in tomcat dir and whether their path in servlet shud be relative or absolute?
Please dont tell me that resultset can be directly passed to .jrxml coz i know it actually this is just sample code actually my resultset
will change according to values enterd by user input thats why i m executing it in servlet and then sending to .jasper file.

PROGRAM: MADE IN ECLIPSE WITH JASPER ASSISTANT:-


ERROR GENERATED:-

HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented
it from fulfilling this request.

exception

javax.servlet.ServletException: Error instantiating servlet class
JustTest

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)

org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)

org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)

org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)

org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)

org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)

org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
java.lang.Thread.run(Unknown Source)


root cause

java.lang.NoClassDefFoundError:
net/sf/jasperreports/engine/JRDataSource
java.lang.Class.getDeclaredConstructors0(Native Method)
java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
java.lang.Class.getConstructor0(Unknown Source)
java.lang.Class.newInstance0(Unknown Source)
java.lang.Class.newInstance(Unknown Source)

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)

org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)

org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)

org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)

org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)

org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)

org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
java.lang.Thread.run(Unknown Source)


note The full stack trace of the root cause is available in the Apache
Tomcat/5.5.17 logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.5.17
[ January 02, 2007: Message edited by: Varun Kumar ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

java.lang.NoClassDefFoundError:
net/sf/jasperreports/engine/JRDataSource



Looks like it can't find one of the classes in the JasperReports libraries.
Where did you put the jar files?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Varun Kumar
Greenhorn

Joined: Jan 02, 2007
Posts: 4
i have included every jar file from dist and lib directories of jasperreports in build path in eclipse as external jar files.
But dont know if other jar file should be present in tomcat dir and where?
[ January 03, 2007: Message edited by: Varun Kumar ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60045
    
  65

other jar file shud b present


"shud" and "b" are not real words. Please use only real words such as "should" and "be" when posting.

Thanks.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60045
    
  65

Genreally, jars that are used by a single application are placed within that application's WEB-INF/lib folder.

For jars to be shared across multiple applicartions, Tomcat provides common locations for those, but let's just concentrate on your one app for now.

Are you running the app from within eclipse, or in a standalone instance of Tomcat?
Varun Kumar
Greenhorn

Joined: Jan 02, 2007
Posts: 4
i m running application from within eclipse.
[ January 03, 2007: Message edited by: Varun Kumar ]
Varun Kumar
Greenhorn

Joined: Jan 02, 2007
Posts: 4
i have put all jars in the WEB-INF/LIB dir of the application and now i m getting this error:
java.lang.NullPointerException
at java.io.ObjectInputStream$PeekInputStream.read(Unknown Source)
at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source)
at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
at java.io.ObjectInputStream.<init>(Unknown Source)
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:191)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:580)
at net.sf.jasperreports.engine.JasperRunManager.runReportToPdfStream(JasperRunManager.java:368)
at JustTest.doPost(JustTest.java:43)
at JustTest.doGet(JustTest.java:25)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)
-------------------------------------------------------------------------------------------------------------------------------

Kindly tell me where to put .jrxml and .jasper file in tomcat directory.

[ January 03, 2007: Message edited by: Varun Kumar ]
[ January 03, 2007: Message edited by: Varun Kumar ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Bear Bibeault:
... jars that are used by a single application are placed within that application's WEB-INF/lib folder.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with jasper reports
 
Similar Threads
Error:getOutputStream() has already been called for this response
problem implementing iReports with servlets
.jasper report return null values
mysql connector Class NotFound error
Abstract servlet