Yeah, the reason why we're all trying to do this is because sometimes
server.xml cannot be touched. In my case it's the installation default, but
I'd rather not touch it anyway.
Here's my context.xml, not much to it really. I think the key is in how you
deploy it.
--8<--------------------8<---------------------8<----------------
<?xml version="1.0" ?>
<!--
Tomcat-specific deployment descriptor for this Web application.
$Id: context.xml 679 2006-06-09 18:42:00Z waldura $
-->
<Context
path="@DEPLOY_APPLICATION_CONTEXT@"
docBase="@APPLICATION_DIR@"
debug="9"
reloadable="true">
<!-- check for new classes etc. every 3 seconds instead of default
15 -->
<Loader
checkInterval="3"
className="org.apache.catalina.loader.WebappLoader" />
<!--
Configure the database connection pool.
-->
<Resource name="jdbc/gf" auth="Container" type="javax.sql.DataSource"
description="The database" />
<ResourceParams name="jdbc/gf">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>org.postgresql.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:postgresql://ZZZ/gf</value>
</parameter>
<parameter>
<name>username</name>
<value>XXX</value>
</parameter>
<parameter>
<name>password</name>
<value>YYY</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>20</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>10</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>-1</value>
</parameter>
</ResourceParams>
</Context>
--8<--------------------8<---------------------8<----------------
----- Original Message -----
From: "Vijaya" <[EMAIL PROTECTED]>
To: "'Tomcat Users List'" <users@tomcat.apache.org>
Sent: Tuesday, June 13, 2006 10:43 PM
Subject: RE: Configure Resource in context.xml does not work as expected
Hello Renaud,
Can you post the context.xml? I have the same problem. For development
sake, I have added the resource in server.xml whereas in production
machine, I will not have the access to the server.xml.
Thanks,
Vijaya
-----Original Message-----
From: Renaud Waldura [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 13, 2006 10:21 PM
To: [EMAIL PROTECTED]
Cc: users@tomcat.apache.org
Subject: Re: Configure Resource in context.xml does not work as expected
Hello Timm:
I didn't get this to work, but found a workaround that's enough for my
needs. I honestly think it's a bug. I've searched the Tomcat bug
database,
and there seem to be lots of things broken with deployment.
I wanted to deploy my application using the Tomcat Manager, pointing it
to
the directory where the application resides -- using the field labeled
"WAR
or Directory URL", see attached screenshot. In that directory I have a
META-INF/context.xml with resource configuration.
As you did, I found out that doing this copies
myapp/META-INF/context.xml to
CATALINA_HOME/conf/Catalina/localhost/myapp.xml but erases its content.
The
application gets deployed right the first time; any subsequent time,
resource configuration is missing and the application will fail. It
deploys
OK, but e.g. won't talk to the database because the configuration
information is not there.
What I do now is use the second field "XML configuration file URL"
instead,
and enter the full path to my context.xml, eg.
file:/home/renaud/myapp/META-INF/context.xml. This context.xml must
contain
the proper path to the application in the docBase attribute, eg.
docBase="/home/renaud/myapp". Let me know if this works for you.
--Renaud
------------------------------------------------
I want to configure a JDBC-Resource within the Context of my web-app.
I placed a <Resource>-entry and a <ResourceParams>-entry as
child-elements of <Context> in the META-INF/contxt.xml-file. When I
deployed my app (via a file-URL) it gets configured accordingly at
first, but the resulting xml-file in conf\Catalina\localhost for the
web-app does not contain any child-elements within the <Context>-Tag
any more. So when I need to restart Tomcat my web-app is not
configured with the Resource anymore. I also tried to use the
override-Attribute, but this does not do any difference. I cannot
place the Resource in the server.xml since I have no access to it. So
my question is: How can I configure a Resource for a single web-app
only without using server.xml ? I'm using Tomcat 5.0.28.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]