moving resources from server.xml into the webapp

R

reformy

hi
I have a web-app running under tomcat 5.0.28. In that application i m
using 2 resources - oracle jdbc connection pool and mail session. Both
are defined in the server's server.xml:

<Context path="/JCC" docBase="JCC">
<!-- Mail sender. -->
<Resource name="mail/Session" auth="Container"
type="javax.mail.Session"/>
....

<!-- DB connection. -->
<Resource name="jdbc/OracleDB" auth="Container"
type="javax.sql.DataSource"/>
....

Is there a way to define these two inside my application? What i want
is that the installation of my web-app will include only copying the
web-app into webapps directory, without changing anything in other
tomcat folders.

Thanks
 
B

Bryce

hi
I have a web-app running under tomcat 5.0.28. In that application i m
using 2 resources - oracle jdbc connection pool and mail session. Both
are defined in the server's server.xml:

<Context path="/JCC" docBase="JCC">
<!-- Mail sender. -->
<Resource name="mail/Session" auth="Container"
type="javax.mail.Session"/>
...

<!-- DB connection. -->
<Resource name="jdbc/OracleDB" auth="Container"
type="javax.sql.DataSource"/>
...

Is there a way to define these two inside my application? What i want
is that the installation of my web-app will include only copying the
web-app into webapps directory, without changing anything in other
tomcat folders.

As an alternate, you can put your context in its own file, say
"context.xml", and put that file in your webapp's META-INF folder.
 
R

reformy

thanks!

I have another problem:
These resources use jar files which i need to put in tomcat/common/lib.
Is there away i can put them under tomcat/webapps/myApp/WEB-INF/lib and
tell tomcat that they are there?

I need the whole application to be under one directory without changing
anything in other tomcat libraries.
 
S

steen

Hey,

I'd like to get one thing straight. Moving the datasource into the
web-app itself, wont that complicate matters if you have a staging
environment where the datasource points to a test database instead of
the live one ?

I'm having a major discussion with a co-worker about this, and would
like to hear other people's views to this.

/Steen
 
H

Henry Townsend

Bryce said:
As an alternate, you can put your context in its own file, say
"context.xml", and put that file in your webapp's META-INF folder.

But this is a Tomcat-specific solution, isn't it? The deployment
descriptor is covered by the API and thus should be completely
transportable between containers. I see no reference to your technique
in Servlet API 2.4.

H. Townsend
 
B

Bryce

But this is a Tomcat-specific solution, isn't it? The deployment
descriptor is covered by the API and thus should be completely
transportable between containers. I see no reference to your technique
in Servlet API 2.4.

Oh, its quite possible that its Tomcat specific. Not sure.
 
R

reformy

Why doe's it complicate matters? This web-app is the only one using
this datasource. There is no other web-app.

anyway, i still don't have an answer for moving the lib inside the
web-app, so it doesn't metter.
 
B

Bryce

But this is a Tomcat-specific solution, isn't it? The deployment
descriptor is covered by the API and thus should be completely
transportable between containers. I see no reference to your technique
in Servlet API 2.4.

But the way Tomcat defines datasources to begin with is Tomcat
specific... Only the web.xml is in the Servlet API...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top