The moose likes Servlets and the fly likes Tomcat and jar-files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Tomcat and jar-files" Watch "Tomcat and jar-files" New topic

Tomcat and jar-files

Mikael Rundqvist

Joined: Sep 18, 2001
Posts: 7
Can someone confirm or reject if I am right about the below:
"Tomcat requires that all classes which are placed in the default package are deployed in one and the same jar-file placed under <context-root>/WEB-INF/lib/ for the class to be found"
/best regards Mikael
Peter Guillebaud
Ranch Hand

Joined: Jul 11, 2001
Posts: 57
JAR files placed n here will be loaded automatically by the web container, if there are put somewhere else then you must set the CLASSPATH before starting the server.
Mikael Rundqvist

Joined: Sep 18, 2001
Posts: 7
I will try to clarify a bit what I meant:
I have created two java-beans which belong to the default package but I created to different JAR-files in <docBase>/WEB-INF/lib for them. Then when I wanted to access the beans through the <jsp:useBean id="test1" class="test1"> and <jsp:useBean id="test2" class="test2"> the bean identified by test2 generates an "cannot create bean" error when the page is auto-compiled.
I managed to locate and fix the problem when I put the two beans in the same jar-file and made a correct manifest-file stating that both classes where beans.
Hope that clarifies the pre-conditions for my question.
I agree. Here's the link:
subject: Tomcat and jar-files
It's not a secret anymore!