You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Chan, Kam Yuen" <KC...@rgare.com> on 2003/09/04 21:50:51 UTC

Using jdk1.4 logger problem

Hello, 

I am trying to load our App in Tomcat. 
One of the initialization is being done by a Servlet, which is set to autoload. During this initialization, we also initializes the logger, which are subclasses of the JDK1.4 logger classes. 

But, some how the logger manager can't find the handler classes. (Class loader problem?) 

Please see below the stack trace.  You will see that the resoft.framework.logging.DBHandler is the class that can't be found. But it is in the same package and jar as the resoft.framework.logging.ResoftLogger, which was invoked in the middle of the stack. 

The jar is placed in the WEB-INF/lib directory.

Thanks in advance for your Help.

Kam Chan

Can't load log handler "resoft.framework.logging.DBHandler"
java.lang.ClassNotFoundException: resoft.framework.logging.DBHandler
java.lang.ClassNotFoundException: resoft.framework.logging.DBHandler
 at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
 at java.util.logging.LogManager$3.run(LogManager.java:717)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.util.logging.LogManager.initializeGlobalHandlers(LogManager.java:710)
 at java.util.logging.LogManager.access$800(LogManager.java:114)
 at java.util.logging.LogManager$RootLogger.getHandlers(LogManager.java:817)
 at java.util.logging.Logger.log(Logger.java:420)
 at java.util.logging.Logger.doLog(Logger.java:446)
 at java.util.logging.Logger.logp(Logger.java:589)
 at resoft.framework.logging.ResoftLogger.log(ResoftLogger.java:780)
 at resoft.framework.logging.ResoftLogger.info(ResoftLogger.java:439)
 at resoft.framework.sessionmgmt.AppCtx.outputStartupInfo(AppCtx.java:456)
 at resoft.framework.appsvr.sessionmgmt.AppServerCtx.init(AppServerCtx.java:539)
 at resoft.framework.appsvr.initialization.AppServerStartUp.startup(AppServerStartUp.java:97)
 at resoft.webserver.servlets.WebServerStartup.init(WebServerStartup.java:156)
 at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:918)
 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:810)
 at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3279)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:3421)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:638)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:343)
 at org.apache.catalina.core.StandardService.start(StandardService.java:388)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:506)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:781)
 at org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
 at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:324)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)

Re: Using jdk1.4 logger problem

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
On 09/05/2003 05:16 AM Bill Barker wrote:
>>
>>But, some how the logger manager can't find the handler classes. (Class
>>loader problem?)
> 
> Yup, it's a CL problem.  Unfortunately, it looks like the problem is in
> Sun's implementation of 1.4 Logging.  Instead of using the
> ContextClassLoader, it's looking for your class in the AppClassLoader
> (which, of course, knows nothing about your class :).
> 
> At the moment, the only work-around I can see is to place your jar in
> $CATALINA_HOME/common/endorsed.  Of course, if it will make you feel better,
> you can also b*tch at Sun for not designing their Logging implementation in
> a way that is friendly to app-servers ;-).

Hi Bill,
have a similar problem. Bug 
http://issues.apache.org/bugzilla/show_bug.cgi?id=22852

My logging formatter class is not being found. It was found in 4.1.24 
but after upgrading to 4.1.27, the formatter class seemed to disappear 
off the radar for tomcat/java.

I have it in the common/lib directory.

I followed your advice to Kam Yuen and put my jar in the 
common/endorsed, and the class was found. I'd be happy to file this as a 
bug with Sun but I don't understand why you are sure it is Sun, and not 
Tomcat. After all, 4.1.24 worked.

regards
Adam


-- 
struts 1.1 + tomcat 4.1.27 + java 1.4.2
Linux 2.4.20 RH9


Re: Using jdk1.4 logger problem

Posted by Bill Barker <wb...@wilshire.com>.
"Chan, Kam Yuen" <KC...@rgare.com> wrote in message
news:EB1A6A7DCB06804195592EF1716F15B50405AADB@rgaexmail.rgare.com...
> Hello,
>
> I am trying to load our App in Tomcat.
> One of the initialization is being done by a Servlet, which is set to
autoload. During this initialization, we also initializes the logger, which
are subclasses of the JDK1.4 logger classes.
>
> But, some how the logger manager can't find the handler classes. (Class
loader problem?)

Yup, it's a CL problem.  Unfortunately, it looks like the problem is in
Sun's implementation of 1.4 Logging.  Instead of using the
ContextClassLoader, it's looking for your class in the AppClassLoader
(which, of course, knows nothing about your class :).

At the moment, the only work-around I can see is to place your jar in
$CATALINA_HOME/common/endorsed.  Of course, if it will make you feel better,
you can also b*tch at Sun for not designing their Logging implementation in
a way that is friendly to app-servers ;-).

>
> Please see below the stack trace.  You will see that the
resoft.framework.logging.DBHandler is the class that can't be found. But it
is in the same package and jar as the resoft.framework.logging.ResoftLogger,
which was invoked in the middle of the stack.
>
> The jar is placed in the WEB-INF/lib directory.
>
> Thanks in advance for your Help.
>
> Kam Chan
>
> Can't load log handler "resoft.framework.logging.DBHandler"
> java.lang.ClassNotFoundException: resoft.framework.logging.DBHandler
> java.lang.ClassNotFoundException: resoft.framework.logging.DBHandler
>  at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
>  at java.security.AccessController.doPrivileged(Native Method)
>  at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
>  at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
>  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
>  at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
>  at java.util.logging.LogManager$3.run(LogManager.java:717)
>  at java.security.AccessController.doPrivileged(Native Method)
>  at
java.util.logging.LogManager.initializeGlobalHandlers(LogManager.java:710)
>  at java.util.logging.LogManager.access$800(LogManager.java:114)
>  at
java.util.logging.LogManager$RootLogger.getHandlers(LogManager.java:817)
>  at java.util.logging.Logger.log(Logger.java:420)
>  at java.util.logging.Logger.doLog(Logger.java:446)
>  at java.util.logging.Logger.logp(Logger.java:589)
>  at resoft.framework.logging.ResoftLogger.log(ResoftLogger.java:780)
>  at resoft.framework.logging.ResoftLogger.info(ResoftLogger.java:439)
>  at resoft.framework.sessionmgmt.AppCtx.outputStartupInfo(AppCtx.java:456)
>  at
resoft.framework.appsvr.sessionmgmt.AppServerCtx.init(AppServerCtx.java:539)
>  at
resoft.framework.appsvr.initialization.AppServerStartUp.startup(AppServerSta
rtUp.java:97)
>  at
resoft.webserver.servlets.WebServerStartup.init(WebServerStartup.java:156)
>  at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:91
8)
>  at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:810)
>  at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:
3279)
>  at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3421)
>  at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
>  at org.apache.catalina.core.StandardHost.start(StandardHost.java:638)
>  at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
>  at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:343)
>  at
org.apache.catalina.core.StandardService.start(StandardService.java:388)
>  at org.apache.catalina.core.StandardServer.start(StandardServer.java:506)
>  at org.apache.catalina.startup.Catalina.start(Catalina.java:781)
>  at org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
>  at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
>  at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
>  at java.lang.reflect.Method.invoke(Method.java:324)
>  at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)