You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Marco Tedone <mt...@jemos.org> on 2003/09/01 19:21:46 UTC

Problem switching to Struts 1.1

Hi, I posted this issue to the struts-user list 3 times, but noone replied
to me and frankly I'm beginning to be a little worried. In few words we have
an application which was running fine until struts rc1 but when we switched
to Struts 1.1 the following exceptions is thrown:

<!-- BEGIN OF EXCEPTION -->

javax.servlet.ServletException: Error instantiating servlet class
org.apache.struts.action.ActionServlet
 at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:91
2)
 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823)
 at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:
3421)
 at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3609)
 at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:8
21)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)
 at
org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.j
ava:307)
 at org.apache.catalina.core.StandardHost.install(StandardHost.java:772)
 at
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:559
)
 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:401)
 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:718)
 at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:358)
 at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
t.java:166)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
 at org.apache.catalina.core.StandardService.start(StandardService.java:497)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
 at
org.apache.catalina.startup.CatalinaService.start(CatalinaService.java:273)
 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.BootstrapService.start(BootstrapService.java:245
)
 at
org.apache.catalina.startup.BootstrapService.main(BootstrapService.java:307)
----- Root Cause -----
java.lang.ExceptionInInitializerError
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAcces
sorImpl.java:39)
 at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstruc
torAccessorImpl.java:27)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
 at java.lang.Class.newInstance0(Class.java:308)
 at java.lang.Class.newInstance(Class.java:261)
 at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:90
3)
 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823)
 at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:
3421)
 at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3609)
 at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:8
21)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)
 at
org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.j
ava:307)
 at org.apache.catalina.core.StandardHost.install(StandardHost.java:772)
 at
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:559
)
 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:401)
 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:718)
 at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:358)
 at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
t.java:166)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
 at org.apache.catalina.core.StandardService.start(StandardService.java:497)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
 at
org.apache.catalina.startup.CatalinaService.start(CatalinaService.java:273)
 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.BootstrapService.start(BootstrapService.java:245
)
 at
org.apache.catalina.startup.BootstrapService.main(BootstrapService.java:307)
Caused by: org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException:
java.lang.ClassNotFoundException:
org.apache.commons.logging.impl.Log4jCategoryLog
 at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.ja
va:532)
 at
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.ja
va:272)
 at
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.ja
va:246)
 at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:395)
 at org.apache.struts.action.ActionServlet.<clinit>(ActionServlet.java:375)
 ... 33 more
Caused by: org.apache.commons.logging.LogConfigurationException:
java.lang.ClassNotFoundException:
org.apache.commons.logging.impl.Log4jCategoryLog
 at
org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryI
mpl.java:416)
 at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.ja
va:525)
 ... 37 more
Caused by: java.lang.ClassNotFoundException:
org.apache.commons.logging.impl.Log4jCategoryLog
 at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a:1444)
 at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a:1289)
 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
 at java.lang.Class.forName0(Native Method)
 at java.lang.Class.forName(Class.java:141)
 at
org.apache.commons.logging.impl.LogFactoryImpl$1.run(LogFactoryImpl.java:466
)
 at java.security.AccessController.doPrivileged(Native Method)
 at
org.apache.commons.logging.impl.LogFactoryImpl.loadClass(LogFactoryImpl.java
:454)
 at
org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryI
mpl.java:406)
 ... 38 more

<!-- ENDOF EXCEPTION -->

The problem seems to be the org.apache.commons.logging.impl.Log4jCategoryLog
class which is not found in the classpath. Now, I had a look at the
commons-logging file and actually there is a similar class called
org.apache.commons.logging.impl.Log4JCategoryLog (please note the capital
'J'). What shall I do then?

Thank for any help,

Marco






Re: Problem switching to Struts 1.1

Posted by Remy Maucherat <re...@jboss.org>.
Marco Tedone wrote:

> Thank you for your support. I must say that the privileged attribute for my
> application was set to false, but the problem still persists.

Are you sure ? I did test it with TC 5 (maybe 5.0.5) / Struts 1.1 
examples webapp / log4j 1.2.8, and it did work fine (I simply dropped 
the log4j JAR in the /WEB-INF/lib - and then added the properties file 
in /WEB-INF/classes). I'll try to test it again. Most likely the bug is 
with commons-logging however (the case issue really looks fishy).

BTW, false is the default value. The context files for the admin and the 
manager are not very good examples, obviously, since they need the 
privileged flag to work.

-- 
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Rémy Maucherat
Senior Developer & Consultant
JBoss Group (Europe) SàRL
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxx


Re: Problem switching to Struts 1.1

Posted by Marco Tedone <mt...@jemos.org>.
Thank you for your support. I must say that the privileged attribute for my
application was set to false, but the problem still persists.

Marco
----- Original Message ----- 
From: "Remy Maucherat" <re...@jboss.org>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Monday, September 01, 2003 6:37 PM
Subject: Re: Problem switching to Struts 1.1


> Marco Tedone wrote:
> > Hi, I posted this issue to the struts-user list 3 times, but noone
replied
> > to me and frankly I'm beginning to be a little worried. In few words we
have
> > an application which was running fine until struts rc1 but when we
switched
> > to Struts 1.1 the following exceptions is thrown:
>
> > <!-- ENDOF EXCEPTION -->
> >
> > The problem seems to be the
org.apache.commons.logging.impl.Log4jCategoryLog
> > class which is not found in the classpath. Now, I had a look at the
> > commons-logging file and actually there is a similar class called
> > org.apache.commons.logging.impl.Log4JCategoryLog (please note the
capital
> > 'J'). What shall I do then?
>
> Yes, something looks very fishy regarding case sensitivity with the
> log4j support in commons-logging. You might want to file a bug against
> commons-logging and because class naming is inconsistent, and can cause
> user errors (for example, there's a o.a.c.l.impl.Log4jFactory class
> along with a o.a.c.l.impl.Log4JLogger class).
>
> That being said, I've only seen that error occur if the webapp is
> privileged (ie, there's a Context element with a privileged="true"
> attribute). If you don't know what privileged does, and put it there
> because it sounds better, I suggest you remove it (and read the docs) :)
>
> Remy
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>




Re: Problem switching to Struts 1.1

Posted by Remy Maucherat <re...@jboss.org>.
Marco Tedone wrote:
> Hi, I posted this issue to the struts-user list 3 times, but noone replied
> to me and frankly I'm beginning to be a little worried. In few words we have
> an application which was running fine until struts rc1 but when we switched
> to Struts 1.1 the following exceptions is thrown:

> <!-- ENDOF EXCEPTION -->
> 
> The problem seems to be the org.apache.commons.logging.impl.Log4jCategoryLog
> class which is not found in the classpath. Now, I had a look at the
> commons-logging file and actually there is a similar class called
> org.apache.commons.logging.impl.Log4JCategoryLog (please note the capital
> 'J'). What shall I do then?

Yes, something looks very fishy regarding case sensitivity with the 
log4j support in commons-logging. You might want to file a bug against 
commons-logging and because class naming is inconsistent, and can cause 
user errors (for example, there's a o.a.c.l.impl.Log4jFactory class 
along with a o.a.c.l.impl.Log4JLogger class).

That being said, I've only seen that error occur if the webapp is 
privileged (ie, there's a Context element with a privileged="true" 
attribute). If you don't know what privileged does, and put it there 
because it sounds better, I suggest you remove it (and read the docs) :)

Remy