I've found some indications on the web. It's about the "struts.jar" file.
  In the article, below, the author deals with TOMCAT. It's also true with
  WEBSPHERE.
  I've found it on http://www.husted.com/about/struts/kickstart.html.



More about Classpaths

There has been some confusion around the issue of placing "struts.jar"
on your CLASSPATH at execution time, in a servlet container like Tomcat
that makes all such libraries visible to web applications. This message
is an attempt to clarify the issues, and document why this is
prohibited.

* The "struts.jar" must appear on your classpath at
compile time for your web application. The easiest
way to make this happen is to use an Ant "build.xml"
file (like Struts itself does) that sets the classpath
dynamically, or create a custom shell script that sets
the classpath temporarily for compiling Struts based
classes.

* The "servlet.jar" file (from your servlet container) must
be on your classpath at compile time as well, because
your application's Action classes will refer to interfaces
that are defined here.

* For reasons discussed further below, "struts.jar" MUST NOT
be on your system CLASSPATH when you start your servlet
container (in particular, this applies to Tomcat).

* Placing JAR files in $JAVA_HOME/jre/lib/ext (the system
extensions directory for Java2) is the same as placing them
on the classpath. In other words, you will NOT want to put
"struts.jar" or "servlet.jar" there.

* For Tomcat, placing JAR files in the "lib" directory (as opposed
to the WEB-INF/lib directory of your web app) causes them to
be added to the CLASSPATH automatically. Therefore, you should
not put struts.jar here either.

The reason that putting "struts.jar" on your classpath is a bad idea has
to do with the way classloaders work in most servlet containers. The
details differ between them -- but here is the scoop for Tomcat (3.x and
4.x):

* The library files that are placed on the CLASSPATH when
Tomcat starts up are made visible through the "system"
class loader.

* Each individual web application has a custom class loader
created for it, which makes the classes in WEB-INF/classes
and WEB-INF/lib visible. The "parent" class loader of this
custom class loader is set to the system class loader mentioned
above.

* When classes are loaded, the JVM starts at the bottom of the
hierarchy of class loaders, with the webapp class loader, and
works its way up the hierarchy until it finds that class. Thus, if
you have struts.jar in the system classpath, classes from struts.jar
will be loaded by the system class loader instead of the web app
class loader.

* When a loaded class references other classes, it looks in its own
class loader first, and then up the hierarchy. Under NO circumstances

will it go down the hierarchy.

* Therefore, if a Struts class is loaded from the system class path,
that class CANNOT see any of your application classes in
WEB-INF/classes
or WEB-INF/lib -- you will get ClassNotFoundException instead.

This is the reason that the Struts example application will not run when
you have "struts.jar" on your CLASSPATH. The digester module of Struts
is loaded from the system class path. Therefore, it cannot see the
"User" class of the example app, because that class is under
WEB-INF/classes.

If you find that you need to put "struts.jar" on your system classpath
to make Struts work in Tomcat, that means your Tomcat install has been
corrupted. If you find that your own app will not work UNLESS
struts.jar is in the system classpath, there is something about your
application organization that needs to be analyzed in detail.






[EMAIL PROTECTED]@marine.alstom.com le 25/06/2001 15:18:26

Veuillez répondre à [EMAIL PROTECTED]

Pour :    [EMAIL PROTECTED]
cc :

Objet :   Problem loading DATABASE: org.xml.sax.SAXException




Hello!

I am using STRUTS with WEBSPHERE 3.5.3.
I try to use the STRUTS EXAMPLE.

When I start the Default Server via the Admin Console, I have the following
exception:

22/06/01 14:19 : AUDIT [uc2902/Default Server]: SRVE0091I: [Servlet LOG]:
"database: Initializing database servlet"
22/06/01 14:19 : AUDIT [uc2902/Default Server]: SRVE0091I: [Servlet LOG]:
"database: Loading database from '/WEB-INF/database.xml'"
22/06/01 14:19 : AUDIT [uc2902/Default Server]: SRVE0092I: [Servlet LOG]:
"database: Database load exception": org.xml.sax.SAXException:
org.apache.struts.webapp.example.User
     at com.sun.xml.parser.Parser.parseInternal(Parser.java:461)
     at com.sun.xml.parser.Parser.parse(Parser.java:284)
     at javax.xml.parsers.SAXParser.parse(SAXParser.java:155)
     at javax.xml.parsers.SAXParser.parse(SAXParser.java:77)
     at org.apache.struts.digester.Digester.parse(Digester.java:755)
     at
org.apache.struts.webapp.example.DatabaseServlet.load(DatabaseServlet.java:251)
     at
org.apache.struts.webapp.example.DatabaseServlet.init(DatabaseServlet.java:175)
     at javax.servlet.GenericServlet.init(GenericServlet.java:258)
     at
com.ibm.servlet.engine.webapp.StrictServletInstance.doInit(ServletManager.java:604)

     at
com.ibm.servlet.engine.webapp.StrictLifecycleServlet._init(StrictLifecycleServlet.java:136)


     at
com.ibm.servlet.engine.webapp.PreInitializedServletState.init(StrictLifecycleServlet.java:244)


     at
com.ibm.servlet.engine.webapp.StrictLifecycleServlet.init(StrictLifecycleServlet.java:102)


     at
com.ibm.servlet.engine.webapp.ServletInstance.init(ServletManager.java:284)
     at javax.servlet.GenericServlet.init(GenericServlet.java:258)
     at
com.ibm.servlet.engine.webapp.ServletManager.addServlet(ServletManager.java:76)
     at
com.ibm.servlet.engine.webapp.WebAppServletManager.loadServlet(WebAppServletManager.java:91)


     at
com.ibm.servlet.engine.webapp.WebAppServletManager.loadAutoLoadServlets(WebAppServletManager.java:158)


     at com.ibm.servlet.engine.webapp.WebApp.loadServletManager(WebApp.java:806)
     at com.ibm.servlet.engine.webapp.WebApp.init(WebApp.java:93)
     at com.ibm.servlet.engine.srt.WebGroup.loadWebApp(WebGroup.java:121)
     at com.ibm.servlet.engine.srt.WebGroup.init(WebGroup.java:82)
     at com.ibm.servlet.engine.srt.WebGroup.restart(WebGroup.java:155)
     at com.ibm.servlet.engine.ServletHost.restartWebGroup(ServletHost.java:176)
     at
com.ibm.servlet.engine.ServletEngineDynamicUpdateSupport.restartWebGroup(ServletEngineDynamicUpdateSupport.java:106)


     at
com.ibm.ejs.sm.active.ActiveServletGroup.setRefreshConfigAction(ActiveServletGroup.java:193)


     at java.lang.reflect.Method.invoke(Native Method)
     at
com.ibm.ejs.sm.agent.AdminAgentImpl.activeObjectInvocation(AdminAgentImpl.java:93)


     at
com.ibm.ejs.sm.active.ActiveObject.invokeContainedObject(ActiveObject.java:487)
     at
com.ibm.ejs.sm.agent.AdminAgentImpl.activeObjectInvocation(AdminAgentImpl.java:110)


     at
com.ibm.ejs.sm.active.ActiveObject.invokeContainedObject(ActiveObject.java:487)
     at
com.ibm.ejs.sm.agent.AdminAgentImpl.activeObjectInvocation(AdminAgentImpl.java:110)


     at
com.ibm.ejs.sm.agent.AdminAgentImpl.invokeActiveObject(AdminAgentImpl.java:62)
     at
com.ibm.ejs.sm.agent._AdminAgentImpl_Tie._invoke(_AdminAgentImpl_Tie.java:80)
     at
com.ibm.CORBA.iiop.ExtendedServerDelegate.dispatch(ExtendedServerDelegate.java:506)

     at com.ibm.CORBA.iiop.ORB.process(ORB.java:2282)
     at com.ibm.CORBA.iiop.WorkerThread.run(WorkerThread.java:195)
     at com.ibm.ejs.oa.pool.ThreadPool$PooledThread.run(ThreadPool.java:535)

Could anyone help me?

Thanks.

     MIKAEL


Reply via email to