You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by Fergus Gallagher <Fe...@OrbisUK.com> on 2000/08/11 18:58:06 UTC

Classloader woes

I have found a difference between the way the tomcat classloader works and 
the standard Java one which is messing me up a bit :-(

 From a standalone Java (1.2.2) app:

     URL url = this.getClass().getResource("conf/");
     url = new URL(url, "abc.xml");

I get what I want "file:/apppath/packagepath/conf/abc.xml"

but with tomcat I get "file:/apppath/packagepath/abc.xml"

What seems to be happening is that the tomcat classloader is returning the 
first url without the trailing "/" and so the new URL() thinks it's a file.

The workaround is easy enough but not neat.....

Thoughts?

Fergus
--
Fergus Gallagher
Orbis
http://www.orbisuk.com/
+44-(0)20-8987 0717


Re: Classloader woes

Posted by Fergus Gallagher <Fe...@OrbisUK.com>.
Just got weird error message - went away when I restarted:

         Tomcat 3.2.2 (built-in webserver)
         JDK 1.3
         Solaris

Fergus

Error: 500
Location: /balls
Internal Servlet Error:
java.lang.IllegalStateException: Can't happen - classname is null, who 
added this ?
         at 
org.apache.tomcat.core.ServletWrapper.loadServlet(ServletWrapper.java:261)
         at org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:289)
         at org.apache.tomcat.core.Handler.service(Handler.java:254)
         at 
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
         at 
org.apache.tomcat.core.ContextManager.handleStatus(ContextManager.java:1049)
         at 
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:775)
         at 
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
         at 
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.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)



just


-- 
Fergus Gallagher
Orbis
http://www.orbisuk.com/
+44-(0)20-8987 0717