• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JavaBeans in Tomcat

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ?
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:
 
vishwas madhuvarshi
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"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
 
You don't know me, but I've been looking all over the world for. Thanks to the help from this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic