File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes JavaBeans in Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "JavaBeans in Tomcat" Watch "JavaBeans in Tomcat" New topic
Author

JavaBeans in Tomcat

vishwas madhuvarshi
Greenhorn

Joined: Jan 21, 2001
Posts: 16
I am facing a strange problem in tomcat web server. I am using custom beans for storing information obtained from users while registering with my site. When I save the bean class file in Web-inf\classes directory, the server cannot access the bean but when the same bean is saved in a JAR file in package hierarchy in Web-inf\lib, the same is easily accessed by server. Why does this happen ?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 11862
Your bean class file must be in a package and the directory under WEB-INF/classes
must have the package path.
WEB-INF/classes/my/org/utility/BeanClass.class
Bill

------------------
author of:


Java Resources at www.wbrogden.com
vishwas madhuvarshi
Greenhorn

Joined: Jan 21, 2001
Posts: 16
Thanks Bill. The bean is accessible now after putting it in a package hierarchy. But it is still not detected if I put it in classes directory without a package. Why does this happen.
Ramneek Handa
Ranch Hand

Joined: Nov 10, 2000
Posts: 44
Hi vishwas,
believe me it is happening because you must have complied the bean use that package.
Bobby ;-}
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 11862
"But it is still not detected if I put it in classes directory without a package. Why does this happen."
Thats just the way the class loader works, if it sees a plain Thingee.class reference it looks in the "current" directory, which for Tomcat is certainly not the WEB-INF/classes directory
Bill
 
 
subject: JavaBeans in Tomcat
 
Threads others viewed
InstantiationException using tomcat4.0 in jsp with beans
creating and writing to files on server
Problem with jsp finding my bean see code
How to Import a JAVA File in JSP
where do i put the bean?
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com