You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Andrew Connick <an...@omwc.org.uk> on 2007/12/21 13:04:43 UTC
Using META-INF/context.xml
I'm having problems trying to set up a DataSource in META-INF/context.xml
If I specify the <Resource> within a <Context> in server.xml it works fine.
Similarly, if I put it into conf/Catalina/localhost/myapp.xml it's fine, but
putting it in myapp/META-INF/context.xml does not work.
I also found that if I put completely invalid xml in
myapp/META-INF/context.xml, then Tomcat doesn't report this.
I've googled this issue, there seem to be quite a few occurrences of this
problem, but no specific solutions or recommendations.
I'm using Tomcat 5.5.17 and Java 1.5.0 on Windows 2000
myapp/META-INF/context.xml is:
<Context>
<!-- Db connection -->
<Resource
name="jdbc/wdcc"
auth="Container"
factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/wdcc1"
username="jdbc"
password="andrew"
removeAbandoned="true" />
</Context>
Any help would be appreciated
Regards
Andrew Connick
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Using META-INF/context.xml
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Sebastian Gerdes
> [mailto:sebastian.gerdes@informatik.uni-oldenburg.de]
> Subject: Re: Using META-INF/context.xml
>
> your 'context' tag is missing the attributes 'docbase' and 'path'.
Thank you for posting completely incorrect information. Properly placed
<Context> elements should never have either the path or docBase
attributes. Only when the <Context> element is in server.xml (strongly
discouraged) can the path and docBase attributes be used. The only
other condition that requires a docBase attribute is if the webapp is
deployed somewhere other than the appBase directory.
Please do not propagage errors.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Using META-INF/context.xml
Posted by Sebastian Gerdes <se...@informatik.uni-oldenburg.de>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello Andrew,
your 'context' tag is missing the attributes 'docbase' and 'path'.
It should look like this:
<Context docbase="webapps/myapp.war" path="/myapp">
<!-- Db connection -->
<Resource
name="jdbc/wdcc"
auth="Container"
[...]
This should pointing it to the directory where your context.xml file
resides.
If this does not work either, you could try to set the fields 'WAR or
Directory URL' or 'XML configurations URL' when deploying your
application using the Tomcat Manager.
Kind regards
Sebastian Gerdes
> I'm having problems trying to set up a DataSource in META-INF/context.xml
>
> If I specify the <Resource> within a <Context> in server.xml it works fine.
> Similarly, if I put it into conf/Catalina/localhost/myapp.xml it's fine, but
> putting it in myapp/META-INF/context.xml does not work.
>
> I also found that if I put completely invalid xml in
> myapp/META-INF/context.xml, then Tomcat doesn't report this.
>
> I've googled this issue, there seem to be quite a few occurrences of this
> problem, but no specific solutions or recommendations.
>
> I'm using Tomcat 5.5.17 and Java 1.5.0 on Windows 2000
>
> myapp/META-INF/context.xml is:
> <Context>
> <!-- Db connection -->
> <Resource
> name="jdbc/wdcc"
> auth="Container"
> factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
> type="javax.sql.DataSource"
> driverClassName="com.mysql.jdbc.Driver"
> url="jdbc:mysql://localhost:3306/wdcc1"
> username="jdbc"
> password="andrew"
> removeAbandoned="true" />
> </Context>
>
> Any help would be appreciated
> Regards
> Andrew Connick
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
- --
***********************************
Sebastian Gerdes
Strackerjanstr. 51
26129 Oldenburg
Uni-Oldenburg
***********************************
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHa7iVDven//UCaP8RAvVmAJ9ScoeNFsrVMbOBGrqtMwpSxP1BTgCfVbSw
78JXSz5gscQTQVY/QKtdrXw=
=PJm/
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Using META-INF/context.xml
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Andrew Connick [mailto:andrew@omwc.org.uk]
> Subject: Using META-INF/context.xml
>
> Similarly, if I put it into conf/Catalina/localhost/myapp.xml
> it's fine, but putting it in myapp/META-INF/context.xml does
> not work.
>
> I also found that if I put completely invalid xml in
> myapp/META-INF/context.xml, then Tomcat doesn't report this.
Sounds like you still have a <Context> element in
conf/Catalina/localhost/myapp.xml; if so, the one in
myapp/META-INF/context.xml will be ignored.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org