You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Eric Wu <ew...@globalmedic.com> on 2001/05/09 21:31:16 UTC

Class loader problems with Tomcat 3.2.1 and Struts web apps - Hel p!

I have two struts-based web apps installed under a single instance of Tomcat
(Struts Beta 1, Tomcat 3.2.1 connected to IIS).  They are defined within
server.xml as follows:
        <Context path="/cdl" 
                 docBase="d:/projects/cdl" 
                 crossContext="false"
                 debug="1" 
                 reloadable="true" 
                 trusted="false" > 
        </Context>

        <Context path="/enroll" 
                 docBase="d:/projects/benefits_enrollment" 
                 crossContext="false"
                 debug="1" 
                 reloadable="true" 
                 trusted="false" > 
        </Context>

Accessing the first web application is fine.  The problem that I am having
is that any attempt to access start.do on the second web application
(/enroll), the server log returns:

2001-05-08 10:51:10 - path="/enroll" :action: Error creating ActionForm
instance of class
'com.globalmedic.benefits.enrollment.forms.login.LoginForm' -
java.lang.ClassNotFoundException:
com.globalmedic.benefits.enrollment.forms.login.LoginForm
	at
org.apache.tomcat.loader.AdaptiveClassLoader.loadClass(AdaptiveClassLoader.j
ava:524)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:120)
	at
org.apache.struts.action.ActionServlet.processActionForm(ActionServlet.java:
1645)
	at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1520)
	at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:491)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
	at org.apache.tomcat.core.Handler.service(Handler.java:286)
	at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
	at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
	at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
	at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
	at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
	at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
	at java.lang.Thread.run(Thread.java:484)

It seems as if it is attempting to load classes within the context of the
first web application.  If I reverse the order of the context definitions in
server.xml, I will have a similar problem with the /cdl app.

I have verified the following:
- struts.jar exists only in the WEB-INF/lib directory of each web
application
- tomcat.log verifies that the web.xml of each application is being read

I have tried setting up different AJP12 workers to service each application
but that seems to have no effect.

I have also noticed that the jasper.log shows "Classpath according to the
servlet engine" referring only to one of the two web apps.

Is it possible to have two web apps running in a single instance of Tomcat?
Have I overlooked something?  I did not have any problems doing the same
thing with JRun...

Any insight is appreciated.

Eric Wu
Java Architect               
GlobalMedic Inc.
8200 Decarie Blvd., Suite 205
Montreal, Qc.
Canada, H4P 2P5
Tel: (514) 738-6770 Ext. 239
Fax: (514) 738-4827
Email: ewu@globalmedic.com 
Web: <http://www.globalmedic.com/> 
Gold Medal Winner at the 2000 WWW Health Awards