tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phillip Morelock <>
Subject Re: Can't Find JavaBean
Date Fri, 24 May 2002 05:22:00 GMT
Hey there,

Don't worry about this at all -- have seen this question probably ten times
in the last month.  You seem to be doing everything "correctly."

I don't remember any of the solutions, but here's what **I** do and it never

ALWAYS always always (in my opinion) jar your classes, and put them in
WEB-INF/lib instead of WEB-INF/classes .  I have never had a single problem
finding classes once I started putting them in jars.

If you don't know how to do this, read on.

Go to the directory _above_ com/wrox/cars/CarBean.class .  So if you type
'ls' (dir on windows) you should see among the entries "com" and that
directory should contain the wrox/cars/CarBean.class hierarchy.

Then type:
jar cvf cars.jar com

(this is assuming you have the JDK/bin stuff in your path, like java, javac

Take this jar file (cars.jar) and put it in

Remove the entire "classes" directory.

Restart tomcat and you're good to go.

If you don't know what a jar is -- it's a zip-compressed file that contains
your class hierarchy -- so com/wrox/cars/ and com/mysite/foobar and etc.
should all be either jarred together as one directory structure, or you can
make several jars like this and put them in WEB-INF/lib .


On 5/23/02 4:36 PM, "Parra, Rod M" <> wrote:

> To All,
> I'm in the process of learning JSP (through a Wrox book), so pardon such an
> elementary problem.
> When I invoke my JSP page Tomcat can't find my JavaBean.
> This is how I call the JSP page:
> http://localhost:8080/begjsp-ch04/carPage2.jsp
> I get the following error: java.lang.NoClassDefFoundError:
> com/wrox/cars/CarBean
> The JSP page is located under:
> c:\jakarta-tomcat-4.0\webapps\begjsp-ch04\carPage2.jsp
> The JavaBean is located under
> c:\jakarta-tomcat-4.0\webapps\begjsp-ch04\WEB-iNF\classes\com\wrox\cars\CarB
> ean.class
> The class was compiled with no errors.
> This is the code that invokes the Bean in carPage2.jsp: <jsp:useBean
> id="myCar" class="" />
> This is the first line of package;
> To the best of my knowledge, all environment variables have been set
> properly.
> I'm using Windows NT, Tomcat 4.0, j2sdk 1.4.0.
> What could I be doing wrong?  I have gone through the archives and although
> other newbies have had the same problem, I haven't found an answer for mine.
> Thank you for your time,
> Rod Parra

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message