commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Howard M. Lewis Ship" <hls...@comcast.net>
Subject RE: [HiveMind] Having problem with tomcat.
Date Wed, 10 Sep 2003 15:01:12 GMT
I just checked in a tiny change to ClassFactoryImpl that may (but probably won't) fix your
problem.
Please give it a try.

--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry
http://jakarta.apache.org/commons/sandbox/hivemind/
http://javatapestry.blogspot.com

> -----Original Message-----
> From: Essl Christian [mailto:jucas@esslchristian.de] 
> Sent: Wednesday, September 10, 2003 9:13 AM
> To: commons-dev@jakarta.apache.org
> Subject: [HiveMind] Having problem with tomcat.
> 
> 
> Tomcat throws an Exception when I try to get during Servlet 
> init a simple 
> Service implemented in the web-app.
> 
> I have written a simple web-app, which consits of a 
> TestServlet that loads 
> in the init a simple TestService:
> 
> 	public void init(ServletConfig arg0) throws ServletException
> 	{
> 		super.init(arg0);
> 
> 		ClassResolver resolver = new DefaultClassResolver();
> 		//alternatively
> 		//ClassResolver resolver = new 
> DefaultClassResolver(this.getClass() 
> .getClassLoader());
> 		RegistryBuilder builder = new RegistryBuilder();
> 		builder.processModules(resolver);
> 		Registry registry = 
> builder.constructRegistry(Locale.getDefault());
> 		service = (TestService) 
> registry.getService("org.test.TestService", 
> TestService.class);
> 	}
> 
> The TestService has just one method public String 
> getTestString() and the 
> implementation just returns a static
> String. The Web-app is build with maven war.
> 
> The servlet, the ServiceInterface (TestService) and the 
> ServiceImplementation (TestServiceImpl) are are all in 
> /WEB-INF/classes. (Alternatively I have also jared them up 
> and put them in 
> the lib dir).
> 
> The hivemind.jar and all the runtime dependencies except of 
> ant, xerces 
> (which I see are only used for the ant tasks) and oro, saxon 
> and log4j 
> (which I read are only used for testing) are in the WEB-INF/lib dir.
> 
> Now when the servlet is initialized throgh Tomcat (both 4.0.2 
> and 4.1.27) 
> tomcat shows the following Exception:
> 
> javax.servlet.ServletException: Servlet.init() for servlet test threw 
> exception
> ..... (only catalina trace)
> 
> Root-Cause:
> java.lang.NoClassDefFoundError: org/test/TestService
> at java.lang.ClassLoader.defineClass0(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:431)
> at javassist.ClassPool$LocalClassLoader.loadClass(ClassPool.java:365)
> at javassist.ClassPool.writeAsClass(ClassPool.java:427)
> at 
> org.apache.commons.hivemind.service.impl.ClassFabImpl.createCl
> ass(ClassFabImpl.java:217)
> at 
> org.apache.commons.hivemind.impl.DeferredServiceExtensionPoint
> Impl.createDeferredProxyClass(DeferredServiceExtensionPointImp
> l.java:190)
> at 
> org.apache.commons.hivemind.impl.DeferredServiceExtensionPoint
> Impl.createServiceProxyClass(DeferredServiceExtensionPointImpl
> .java:146)
> at 
> org.apache.commons.hivemind.impl.DeferredServiceExtensionPoint
> Impl.getServiceProxy(DeferredServiceExtensionPointImpl.java:130)
> at 
> org.apache.commons.hivemind.impl.DeferredServiceExtensionPoint
> Impl.getService(DeferredServiceExtensionPointImpl.java:117)
> at 
> org.apache.commons.hivemind.impl.ServiceExtensionPointImpl.get
> Service(ServiceExtensionPointImpl.java:317)
> at 
> org.apache.commons.hivemind.impl.ModuleImpl.getService(ModuleI
> mpl.java:158)
> at 
> org.apache.commons.hivemind.impl.RegistryImpl.getService(Regis
> tryImpl.java:125)
> at org.test.TestServlet.init(TestServlet.java:59)
> (... only catalina trace)
> 
> To run the Servlet I've used the lates CVS build with maven.
> 
> Originally I encountered the same problem in my Web-App. However the 
> problem does not occur when I use jetty in my
> eclipse-project and run jetty (directly) within the same 
> project as the 
> web-app.
> 
> A similar problem also occured when maven did the unit-tests 
> on my project. 
> In the unit tests everything (ServletContext, ServletRequest 
> etc) where 
> Mocks. Again the problem did not occur when I did the unit 
> tests in Eclipse.
> 
> This is obviously a ClassLoader thing. However I don't know 
> do I have to 
> change something in the init code or is there a bug in HiveMind or 
> JavaAssist?
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 


Mime
View raw message