Error when viewing crystal report


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


javax.servlet.ServletException: javax/servlet/ServletContext

root cause

java.lang.NoClassDefFoundError: javax/servlet/ServletContext Source)

FYI, I use tomcat 4.1.31
Please help me..
Thanks in advanced.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Make sure that you have a system variable called "CLASSPATH" as detailed here, You may also want to have a CATALINA_HOME variable also for Tomcat 4.1.x
pcapplicationAuthor 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.

>>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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.