commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Yates <jwya...@pacbell.net>
Subject [daemon] classloader and jsvc
Date Mon, 15 Aug 2005 20:23:31 GMT
I recently tracked down a NullPointerException in my jsvc loaded java  
application to the fact that Thread.getContextClassLoader() returning  
null.  JAXBContext.newInstance(String contextPath) effectively is  
JAXBContext.newInstance(contextPath, Thread.getContextClassLoader())  
and dies if the class loader is null.  For my application, a fix was

   if (Thread.getContextClassLoader() == null) {
     Thread.setContextClassLoader(ClassLoader.getSystemClassLoader());
   }

My question:  is this is bug?  If so, where?  Should jsvc, since it  
loads the application, do this for me?  Should JAXB do this (it  
should perhaps provide more info when this happens - it took  
debugging to find it)? 
  

---------------------------------------------------------------------
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