Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
• Status: Solved
• Priority: Medium
• Security: Public
• Views: 407

# Error when viewing crystal report

Hi,

I have some problems. I try to call crystal report viewer 10 from JSP, but I some errors occured:

exception

javax.servlet.ServletException: javax/servlet/ServletContext
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.lang.NoClassDefFoundError: javax/servlet/ServletContext
com.crystaldecisions.report.web.viewer.CrystalImageCleaner.stop(Unknown Source)
org.apache.jsp.viewReport_jsp.jspDestroy(org.apache.jsp.viewReport_jsp:37)
org.apache.jasper.runtime.HttpJspBase.destroy(HttpJspBase.java:89)
org.apache.jasper.servlet.JspServletWrapper.destroy(JspServletWrapper.java:379)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:134)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

FYI, I use tomcat 4.1.31

pcapplication
0
pcapplication
• 3
1 Solution

Commented:
NoClassDefFoundError is commonly caused by not having a certain jar in the classpath. In this case it appears to be the parent jar of "javax/servlet/ServletContext" which is normally servlet.jar or j2ee.jar.
0

Commented:
Make sure that you have a system variable called "CLASSPATH" as detailed here, http://www.moreservlets.com/Using-Tomcat-4.html#Set-CLASSPATH. You may also want to have a CATALINA_HOME variable also for Tomcat 4.1.x
0

Author Commented:
Hi bloodredsun,

Thx for your answer, but still have a problem
I do have set a CATALINA_HOME variable to C:\Program Files\Apache Group\Tomcat 4.1 and i do have servlet.jar in C:\Program Files\Apache Group\Tomcat 4.1\common\lib folder
should i include the servlet.jar in the classpath???

Thx a lot.

0

Commented:
>>should i include the servlet.jar in the classpath???
Yes. I always do. Actually I normally have a J2EE_HOME system variable that I add to the classpath.

>> i do have servlet.jar in C:\Program Files\Apache Group\Tomcat 4.1\common\lib folder
That means that Tomcat can see it but the webapp cannot. If CR requires something from that jar, it will not be able to see it there. As above, I suggest adding it to the classpath.

What about the Crystal Report viewer jars. Make sure you've imported them all including the ones from "C:\Program Files\Common Files\Crystal Decisions\2.5\java\lib\external" and remember all the jars must be in the WEB-INF/lib not the WEB-INF/lib/ext.

NoClassDefFoundError is essentially the exception thrown when it can't find the jars (it would have been so much more informative if jakarta had wrapped that exception in a more informative one like RequiredJarNotFoundError!), so that is all it is.
0

## Featured Post

• 3
Tackle projects and never again get stuck behind a technical roadblock.