Here is mine, which does not work:
<Context path="/Foo" docBase="Foo" debug="5" reloadable="true" crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_Foo_log." suffix=".txt" timestamp="true"/>
<Resource name="jdbc/MySQLDB" auth="container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/MySQLDB"> <parameter> <name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> </parameter> <parameter> <name>maxActive</name> <value>100</value> </parameter> <parameter> <name>maxIdle</name> <value>30</value> </parameter> <parameter> <name>maxWait</name> <value>10000</value> </parameter> <parameter> <name>username</name> <value>*****</value> </parameter> <parameter> <name>password</name> <value>*****</value> </parameter> <parameter> <name>driverClassName</name> <value>com.mysql.jdbc.Driver</value> </parameter> <parameter> <name>url</name> <value>jdbc:mysql://localhost:3306/FooDB</value> </parameter> </ResourceParams>
</Context>
This same file works when placed in conf/Catalina/localhost, although there I set the docBase to Foo.war, not Foo, but I tried to follow your example here.
Erik
Ivan Vasquez wrote:
Erik, here goes my context.xml, Tomcat renames it the same as the app's directory. I assume your Tomcat has autodeploy enabled.
<!--By Ivan: WAR-contained Application Context--> <!--Path defines the directory name created when war is deployed--> <Context path="/nahrgisdev" docBase="nahrgisdev" debug="5" reloadable="true" crossContext="true"> <!--Development--> <Resource name="jdbc/orcl" auth="Container" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/orcl"> <parameter> <name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> </parameter> <parameter> <name>driverClassName</name> <value>oracle.jdbc.driver.OracleDriver</value> </parameter> <!--By Ivan: Parameters for RAC connection load balancing--> <parameter> <name>url</name> <value>jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on)(ADDRESS=(PROTOCO L=TCP)(HOST=node1)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=node2)(PORT=1 521))(CONNECT_DATA=(SERVICE_NAME=orcl)))</value> </parameter> <parameter> <name>username</name> <value>*****</value> </parameter> <parameter> <name>password</name> <value>*****</value> </parameter> <parameter> <name>maxActive</name> <value>10</value> </parameter> <parameter> <name>maxIdle</name> <value>10</value> </parameter> <parameter> <name>maxWait</name> <value>-1</value> </parameter> <parameter> <name>removeAbandoned</name> <value>true</value> </parameter> <parameter> <name>removeAbandonedTimeout</name> <value>60</value> </parameter> <parameter> <name>logAbandoned</name> <value>true</value> </parameter> </ResourceParams> </Context>
-----Original Message-----
From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 31, 2004 4:30 PM
To: Struts Users Mailing List
Subject: Re: Classloading problem
I have tried this repeatedly. I am using the same Foo.xml file that does
work when placed in conf/Catalina/localhost/. I have tried with and without the path and docBase attributes to the Context element. I have renamed the file to context.xml and it is in META-INF in my war file. I have also tried putting Foo.xml or context.xml within a META-INF/context.xml/ *directory* as the documentation suggests.
DBCP throws an Exception on startup that it cannot create a JDBC driver of class '' for connect URL 'null'. I am supposing that the context file
is never loaded. Also Tomcat creates a Foo.xml directory inside of conf/Catalina/localhost with nothing in it. If I try restarting the server, I also get a FileNotFoundException on Foo.xml, saying it "is a directory" (good grief). I have tried hot deploy and deploying via the manager web app as well.
I basically observed the same behavior that Ivan described.
I would love to see that example if you can find it.
Erik
Kris Schneider wrote:
Hang on, my bad - it should be /META-INF/context.xml. So, renameFoo.xml to be
context.xml and place it in *META-INF*.
Quoting Erik Weber <[EMAIL PROTECTED]>:
Kris, this is from context.html in the Tomcat 5 docs:*
Please note that for tomcat 5.x, unlike tomcat 4.x, it is NOT recommended to place <Context> elements directly in the server.xml file.* Instead, put them in the META-INF/context.xml directory of your
inWAR file or the conf directory as described above.
So here I am, stupidly trying to put my Foo.xml file within /META-INF/context.xml/ (and various variations of that) of my web app.
So should I rename Foo.xml to context.xml (I ask because in the conf directory I have been naming it Foo.xml, not context.xml), and put it
just*WEB-INF*?
Could you show me where you found how to do this in the docs? Am I
withcompletely misreading the above sentence?
Thanks for your help, Erik
Kris Schneider wrote:
Can you provide some more detail on the problems you're running into
youusing
WEB-INF? I've got a simple one lying around here somewhere...
WEB-INF/context.xml: -------------------- <Context path="/init"> <Loader delegate="false"/> <Manager pathname=""/> </Context>
Seems to work fine with TC 5...
Quoting Erik Weber <[EMAIL PROTECTED]>:
Also, since you appear to be trying to follow the documenation, have
ofever gotten a Context XML file placed within the META-INF directory
toyour web app to work? I can't get this to work (I have gotten them
hardwork when placed in the conf directory -- though I had to learn the
appway to take write permissions away from Tomcat after it very rudely deleted one). The documentation is confusing, and the example web
thatmysteriously does not include a Context XML file at all, despite
declarepretty much any serious web app is going to need one (unless you
htmleverything in server.xml).
If you have an example of this working, please share it with me.
Erik
Ivan Vasquez wrote:
Sure, in common/lib it works well. But from Tomcat docs:
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/class-loader-howto.
applicationThe following rules cover about 95% of the decisions that
/WEB-INF/classesdevelopers and deployers must make about where to place class and resource files to make them available to web applications:
* For classes and resources specific to a particular web
application, place unpacked classes and resources under
thoseof your web application archive, or place JAR files containing
webclasses and resources under /WEB-INF/lib of your web application
archive.
* For classes and resources that must be shared across all
madeapplications, place unpacked classes and resources under $CATALINA_BASE/shared/classes, or place JAR files containing those classes and resources under $CATALINA_BASE/shared/lib.
--Then goes on...---
Common - This class loader contains additional classes that are
applications.visible to both Tomcat internal classes and to all web
unpackedNormally, application classes should NOT be placed here. All
resourcesclasses and resources in $CATALINA_HOME/common/classes, as well as classes and resources in JAR files under the $CATALINA_HOME/commons/endorsed and $CATALINA_HOME/common/lib directories, are made visible through this class loader.
Shared - This class loader is the place to put classes and
them inthat you wish to share across ALL web applications (unless Tomcat
internal classes also need access, in which case you should put
resources inthe Common class loader instead). All unpacked classes and
JAR$CATALINA_BASE/shared/classes, as well as classes and resources in
thisfiles under $CATALINA_BASE/shared/lib, are made visible through
noneclass loader.
----
In our case we want to share jars common to all applications, but
and myof them are required by Tomcat.
Ivan.
-----Original Message-----
From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 31, 2004 12:52 PM
To: Struts Users Mailing List
Subject: Re: Classloading problem
I have been using 5.0.27, putting my JDBC drivers in common/lib,
struts jars in WEB-INF/lib of each application, and haven't had any
(such asproblems. Why do you say "incorrectly"?
Erik
Ivan Vasquez wrote:
We have Tomcat 5.0.16 and were incorrectly placing common jars
doneJDBC drivers) in /common/lib.
Now we just moved them to /shared/lib (for truly common stuff) and
WEB-INF/lib, but now all applications complain giving a
java.lang.ClassNotFoundException, just like if things weren't in
Tomcat's classpath anymore. Apps and Tomcat restarts have been
set?several times.
Is there anything in web.xml, server.xml, etc that needs to be
about
What
are we possibly missing? Tomcat docs are pretty straightforward
it
and everything seems right.
Once again, thanks in advance.
Ivan.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]