[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Running struts war files in tomcat5



Thanks for the reply, Adam: 

A "sealing violation" (which I hadn't heard of myself and had to
research) means that a class has been loaded from a "sealed" package
(org.apache.commons.collections in this case) and another class from the
same package (org.apache.commons.collections.FastHashMap in this case)
is being loaded _from a different jar file_.  I'll paste the stack trace
below.

As for version info in the war file:  There is none in the war file
itself, but the download zip contained a Versions.txt file that mentions
Struts 1.2.7.  I don't have Struts installed at all on my system since
that should be self-contained in the war files.  (I did try installing
it but it had no effect since it's only applied when building war
files.)

The war file contains its own copy of commons-beanutils.jar (which
contains the offending subset of the collections package).  But it seems
to be the case that all/many struts-based war file webapps contain this
-- at least the other webapps I tried have it.  (They were built by a
colleague and I have a message to him asking how he built them.)

The MANIFEST of the common-beanutils jar in the war file lists version
1.6 for the org.apache.commons.beanutils package.  But it doesn't even
mention the ....collections package that also (partially) appears in the
jar.  By the way, the beanutils installed with the tomcat5 package is
1.7.0-4.  1.6 seems to be available under "stable", but I have tried
installing stable to no avail.  Perhaps I didn't get all the right
packages, so I'll try that again.   (I've lost the log on that install.)

(I'd pursue this on the struts end of things, but the webapps work fine
in other installations of Tomcat so this seems to be something related
to the Debian installation's handling of class paths, security policy,
etc.)

I'm pasting the localhost log immediately below my signature.  It
includes the initial error message followed by the stack trace (note
that the sealing violation is reported in the "root cause", below). 
Following that is the catalina log of the entire initialization.

Thanks again,

Colin Brown

Localhost log starts here:

2006-05-17 08:57:07 StandardContext[/jpetstore]Marking servlet action as
unavail
able
2006-05-17 08:57:07 StandardContext[/jpetstore]Servlet /jpetstore threw
load() e
xception
javax.servlet.ServletException: Error instantiating servlet class
org.apache.str
uts.action.ActionServlet
   at org.apache.catalina.core.StandardWrapper.loadServlet
(StandardWrapper.java
:1010)
   at org.apache.catalina.core.StandardWrapper.load
(StandardWrapper.java:876)
   at org.apache.catalina.core.StandardContext.loadOnStartup
(StandardContext.ja
va:4017)
   at org.apache.catalina.core.StandardContext.start
(StandardContext.java:4337)
   at org.apache.catalina.core.ContainerBase.addChildInternal
(ContainerBase.jav
a:823)
   at org.apache.catalina.core.ContainerBase.access$0
(ContainerBase.java:811)
   at org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run
(ContainerBa
se.java:143)
   at java.security.AccessController.doPrivileged
(AccessController.java:96)
   at org.apache.catalina.core.ContainerBase.addChild
(ContainerBase.java:805)
   at org.apache.catalina.core.StandardHost.addChild
(StandardHost.java:595)
   at org.apache.catalina.core.StandardHostDeployer.install
(StandardHostDeploye
r.java:277)
   at org.apache.catalina.core.StandardHost.install
(StandardHost.java:832)
   at org.apache.catalina.startup.HostConfig.deployWARs
(HostConfig.java:625)
   at org.apache.catalina.startup.HostConfig.deployApps
(HostConfig.java:431)
   at org.apache.catalina.startup.HostConfig.start (HostConfig.java:983)
   at org.apache.catalina.startup.HostConfig.lifecycleEvent
(HostConfig.java:349
)
   at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent
(LifecycleSup
port.java:119)
   at org.apache.catalina.core.ContainerBase.start
(ContainerBase.java:1091)
   at org.apache.catalina.core.StandardHost.start
(StandardHost.java:789)
   at org.apache.catalina.core.ContainerBase.start
(ContainerBase.java:1083)
   at org.apache.catalina.core.StandardEngine.start
(StandardEngine.java:478)
   at org.apache.catalina.core.StandardService.start
(StandardService.java:480)
   at org.apache.catalina.core.StandardServer.start
(StandardServer.java:2313)
   at org.apache.catalina.startup.Catalina.start (Catalina.java:556)
   at java.lang.reflect.Method.invoke0 (Method.java)
   at java.lang.reflect.Method.invoke (Method.java:255)
   at org.apache.catalina.startup.Bootstrap.start (Bootstrap.java:287)
   at org.apache.catalina.startup.Bootstrap.main (Bootstrap.java:425)
----- Root Cause -----
java.lang.SecurityException: Sealing violation loading
org.apache.commons.collec
tions.FastHashMap : Package org.apache.commons.collections is sealed.
   at java.lang.reflect.Method.invoke0 (Method.java)
   at java.lang.reflect.Method.invoke (Method.java:255)
   at java.lang.reflect.Constructor.newInstance (Constructor.java:90)
   at java.lang.Class.newInstance (Class.java:1143)
   at org.apache.catalina.core.StandardWrapper.loadServlet
(StandardWrapper.java
:1001)
   at org.apache.catalina.core.StandardWrapper.load
(StandardWrapper.java:876)
   at org.apache.catalina.core.StandardContext.loadOnStartup
(StandardContext.ja
va:4017)
   at org.apache.catalina.core.StandardContext.start
(StandardContext.java:4337)
   at org.apache.catalina.core.ContainerBase.addChildInternal
(ContainerBase.jav
a:823)
   at org.apache.catalina.core.ContainerBase.access$0
(ContainerBase.java:811)
   at org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run
(ContainerBa
se.java:143)
   at java.security.AccessController.doPrivileged
(AccessController.java:96)
   at org.apache.catalina.core.ContainerBase.addChild
(ContainerBase.java:805)
   at org.apache.catalina.core.StandardHost.addChild
(StandardHost.java:595)
   at org.apache.catalina.core.StandardHostDeployer.install
(StandardHostDeploye
r.java:277)
   at org.apache.catalina.core.StandardHost.install
(StandardHost.java:832)
   at org.apache.catalina.startup.HostConfig.deployWARs
(HostConfig.java:625)
   at org.apache.catalina.startup.HostConfig.deployApps
(HostConfig.java:431)
   at org.apache.catalina.startup.HostConfig.start (HostConfig.java:983)
   at org.apache.catalina.startup.HostConfig.lifecycleEvent
(HostConfig.java:349
   at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent
(LifecycleSup
port.java:119)
   at org.apache.catalina.core.ContainerBase.start
(ContainerBase.java:1091)
   at org.apache.catalina.core.StandardHost.start
(StandardHost.java:789)
   at org.apache.catalina.core.ContainerBase.start
(ContainerBase.java:1083)
   at org.apache.catalina.core.StandardEngine.start
(StandardEngine.java:478)
   at org.apache.catalina.core.StandardService.start
(StandardService.java:480)
   at org.apache.catalina.core.StandardServer.start
(StandardServer.java:2313)
   at org.apache.catalina.startup.Catalina.start (Catalina.java:556)
   at java.lang.reflect.Method.invoke0 (Method.java)
   at java.lang.reflect.Method.invoke (Method.java:255)
   at org.apache.catalina.startup.Bootstrap.start (Bootstrap.java:287)
   at org.apache.catalina.startup.Bootstrap.main (Bootstrap.java:425)


The catalina log starts here:
Using CATALINA_BASE:   /var/lib/tomcat5
Using CATALINA_HOME:   /usr/share/tomcat5
Using CATALINA_TMPDIR: /var/lib/tomcat5/temp
Using JAVA_HOME:       /usr/lib/kaffe
Using Security Manager
Created MBeanServer with ID: [UID:
142119620,1147870574688,-32768]:localhost:1
May 17, 2006 8:56:32 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8180
May 17, 2006 8:56:34 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 12154 ms
May 17, 2006 8:56:43 AM org.apache.catalina.core.StandardService start
INFO: Starting service Tomcat-Standalone
May 17, 2006 8:56:43 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.0
May 17, 2006 8:56:45 AM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
May 17, 2006 8:56:47 AM org.apache.catalina.core.StandardHost
getDeployer
INFO: Create Host deployer for direct deployment ( non-jmx ) 
May 17, 2006 8:56:47 AM org.apache.catalina.core.StandardHostDeployer
install
INFO: Installing web application at context path /jpetstore from URL
file:/var/l
ib/tomcat5/webapps/jpetstore
May 17, 2006 8:57:19 AM org.apache.catalina.core.StandardHostDeployer
install
INFO: Installing web application at context path  from URL
file:/var/lib/tomcat5
May 17, 2006 8:57:32 AM org.apache.catalina.core.StandardHostDeployer
install
INFO: Installing web application at context path /abc from URL
file:/var/lib/tom
cat5/webapps/abc
May 17, 2006 8:57:55 AM org.apache.tomcat.util.threads.ThreadPool
adjustLimits
WARNING: maxThreads setting (2) too low, set to 10
May 17, 2006 8:57:55 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8180
May 17, 2006 8:58:11 AM org.apache.jk.common.ChannelSocket init
INFO: JK2: ajp13 listening on /0.0.0.0:8009
May 17, 2006 8:58:12 AM org.apache.tomcat.util.threads.ThreadPool
adjustLimits
WARNING: maxThreads setting (2) too low, set to 10
May 17, 2006 8:58:12 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=6/5874 
config=/var/lib/tomcat5/conf/jk2.properties
May 17, 2006 8:58:13 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 99129 ms


>>> Adam Hardy <adam.ant@cyberspaceroad.com> 05/18/06 7:06 PM >>>
Colin Brown on 18/05/06 22:00, wrote:
> Hi,
> 
> I've installed (only) kaffe and tomcat5 (tried testing, stable, and
> unstable) onto a debbootstrap.  It works OK for static content, but
> fails when I install a WAR file containing a struts-based app. (I've
> tried the Ibatis jpetstore app as well as other local struts apps that
> were lying around.)  The error is a sealing violation for
> org.apache.commons.collections.FastHashMap
> (org.apache.commons.collections is sealed).
> 
> I traced the interfering package to a jar file in the war file:
> commons-beanutils.jar, which has a few of the collections package
> classes in it (including FastHashMap) in addition to the bean utils
> stuff, and thus causes the sealing violation against the
> commons-collections3.jar file in /usr/share/tomcat5/common/lib.
> 
> I tried building a new jar file for the webapp with the
> org.apache.commons.collections package removed: but the servlet won't
> load.  Unfortunately, all I see is a mesage reporting an exception
while
> creating bean com.ibatis.jpetstore.presentation.CatalogBean -- no
> details as to why either in the message or preceding it in the log.
> 
> The war file works fine (with its original jar file that contains the
> puzzling partial duplicate of the collections package) in other Tomcat
5
> installations, on both Windows and Linux systems.  It seems to be
> something about the Debian tomcat5 package that introduces the sealing
> violation. 
> 
> I've tried mucking with the libs in /usr/share/tomcat5/common/lib
(under
> the belief that these are shared among all web apps) without any luck
--
> anything I remove seems to break something new.  I've also
investigated
> the classpath in the startup script but don't see much to play with
> there (I'm not sure if this affects the set of packages that the
webapps
> see or not.)
> 
> My questions:
>  - Is there something well known about using struts webapps with the
> Debian tomcat5 package? (Special config needed, don't try it, etc.)
>  - Is there another way to control the common packages seen by webapps
> other than /usr/share/tomcat5/common/lib?
>  - Should I perhaps give up on the Debian package and install Tomcat
> directly from the Apache downloads?
>  - Did Apace perhaps leave the packages unsealed and Debian added
> sealing for added security? 
> 
> Sorry, if this query doesn't belong in this list, but since the war
> files work elsewhere, it seems like there's something Debian-specific
> going on here and I don't see any more-specific list among the lists
> Debian.

What is a 'sealing violation'? Did you see a stack trace in the tomcat
console / logging? Paste it in an email.

Does the application with struts in it have any notes specifying which
versions you should be using, esp. commons-beanutils? 



Reply to: