You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Jeffrey C. Baldwin" <Je...@ncmail.net> on 2007/06/14 16:46:06 UTC

Data Sources Overwritten

(Tomcat 5.0.28 running on CentOS 4.4 using Java 1.4.2_14-b05)

Hello All,

I have a problem with my understanding of data sources within Tomcat.

I have an application (MRS).  I deploy MRS using the Tomcat Manager.  I
then open up Tomcat Administration and I see MRS under:

Tomcat Server - Service (Catalina) - Host (localhost) - Context (mrs)

I then open up Resources -> Data Sources, and I 2 data source entries
have been crated (mssql & db2), however their configuration information
(url, driver class, etc..) is complete empty.  And, of course, the
application doesn't work because the JDBC calls are broken.

I go in, using the Administration tool again, configure the data
sources, providing URL, driver class, etc.. commit the changes and
everything works great.

THIS IS WHERE THE PROBLEM comes in, it all works great until we deploy
the application again.  Then the application, when deployed, just
overwrites all the data source information and I'm forced to enter it
all again for the app to work.

I,  using the Administration tool, tried putting the data source entries
in for the entire Tomcat Server (Tomcat Server - Resources - Data
Sources) versus putting them in for the specific application.  However,
the app. still dosen't work.

My question is, how do I make these data source entires 'stay put', so
that when the app is redeployed it can still make the JDBC calls?
Obviously I don't want to have to keep putting these in every time the
app is deployed.

All help is appreciated.

-jeff


---------------------------------------------------------------------
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: Data Sources Overwritten

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
Ha, this is kinda cool.....
When you use the admin manager it makes the file for you....
OK, so now either go into netbeans and paste that file....  mrs.xml  under 
META-INF
That will give you a pool for JUST YOUR WEB app.

OR

copy the contents and stick it in server.xml

That will give you a POOL for ALL web apps...

Magic... nice way to make them... see, getting stuck can help ;)


----- Original Message ----- 
From: "Jeffrey C. Baldwin" <Je...@ncmail.net>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Thursday, June 14, 2007 6:19 PM
Subject: Re: Data Sources Overwritten


> David,
>
> Where do I put this context.xml file?
>
> I noticed that when I deploy the app using manager, then configure the
> data sources using the admin tool... that a file names mrs.xml (mrs is
> the name of the application I am deploying) is created
> (/usr/local/tomcat/conf/Catalina/localhost), it contains all of the data
> source information and app works fine, long as it is there.  However,
> this file gets removed when I deploy via the webapp again, and then...
> the application is broken again.
>
> So, obviously the contents of mrs.xml are right, because the app works
> while it's there... so you're saying I need to put this information into
> context.xml, where should I put this context.xml file in the filesystem?
> Is it odd that this mrs.xml gets deleted when I deploy the app via the
> manager?
>
> I'm pasting the contents of the mrs.xml file below, again.. as long as
> this mrs2.xml is in the directory noted above, the app works... but as
> soon as I re-deploy the app through the web interface, this file gets
> deleted and the app no longer works...
>
> Thanks for your assistance.
> jeff
>
> <?xml version='1.0' encoding='utf-8'?>
> <Context docBase="/usr/local/tomcat/webapps/mrs2" path="/mrs2"
> workDir="work/Catalina/localhost/mrs2">
>  <Resource auth="Container" description="zos DB2 Connection"
> name="jdbc/ZosDataSource" type="javax.sql.DataSource"/>
>  <Resource auth="Container" description="local DB2 Connection"
> name="jdbc/db2ds" type="javax.sql.DataSource"/>
>  <Resource auth="Container" description="msql DB Connection"
> name="jdbc/mssql2000ds" type="javax.sql.DataSource"/>
>  <ResourceParams name="jdbc/ZosDataSource">
>    <parameter>
>      <name>maxWait</name>
>      <value>10000</value>
>    </parameter>
>    <parameter>
>      <name>maxActive</name>
>      <value>2</value>
>    </parameter>
>    <parameter>
>      <name>password</name>
>      <value>AN12RAMA</value>
>    </parameter>
>    <parameter>
>      <name>url</name>
>      <value>jdbc:db2://123.456.789.120:5019/NETSNDB01</value>
>    </parameter>
>    <parameter>
>      <name>driverClassName</name>
>      <value>com.ibm.db2.jcc.DB2Driver</value>
>    </parameter>
>    <parameter>
>      <name>maxIdle</name>
>      <value>1</value>
>    </parameter>
>    <parameter>
>      <name>username</name>
>      <value>name</value>
>    </parameter>
>  </ResourceParams>
>  <ResourceParams name="jdbc/db2ds">
>    <parameter>
>      <name>driverClassName</name>
>      <value></value>
>    </parameter>
>  </ResourceParams>
>  <ResourceParams name="jdbc/mssql2000ds">
>    <parameter>
>      <name>maxWait</name>
>      <value>10000</value>
>    </parameter>
>    <parameter>
>      <name>maxActive</name>
>      <value>2</value>
>    </parameter>
>    <parameter>
>      <name>password</name>
>      <value>pv345ankita</value>
>    </parameter>
>    <parameter>
>      <name>url</name>
>
> <value>jdbc:jtds:sqlserver://123.456.789.96/mrsuat;user=name;password=pv123ankita</value>
>    </parameter>
>    <parameter>
>
>
> David Smith wrote:
>> Best bet is to configure it manually in the context.xml for the webapp.
>> I've never had good luck with the administration webapp in the very few
>> times I've tried to use it.
>> You describe tomcat as over-writing the config submitted via the admin
>> webapp.  It's more likely the admin webapp is changing the running state
>> of tomcat but not persisting those changes to disk.  When you restart,
>> it's as if you never made any changes at all.
>>
>> --David
>>
>> Jeffrey C. Baldwin wrote:
>>
>>> (Tomcat 5.0.28 running on CentOS 4.4 using Java 1.4.2_14-b05)
>>>
>>> Hello All,
>>>
>>> I have a problem with my understanding of data sources within Tomcat.
>>>
>>> I have an application (MRS).  I deploy MRS using the Tomcat Manager.  I
>>> then open up Tomcat Administration and I see MRS under:
>>>
>>> Tomcat Server - Service (Catalina) - Host (localhost) - Context (mrs)
>>>
>>> I then open up Resources -> Data Sources, and I 2 data source entries
>>> have been crated (mssql & db2), however their configuration information
>>> (url, driver class, etc..) is complete empty.  And, of course, the
>>> application doesn't work because the JDBC calls are broken.
>>>
>>> I go in, using the Administration tool again, configure the data
>>> sources, providing URL, driver class, etc.. commit the changes and
>>> everything works great.
>>>
>>> THIS IS WHERE THE PROBLEM comes in, it all works great until we deploy
>>> the application again.  Then the application, when deployed, just
>>> overwrites all the data source information and I'm forced to enter it
>>> all again for the app to work.
>>>
>>> I,  using the Administration tool, tried putting the data source entries
>>> in for the entire Tomcat Server (Tomcat Server - Resources - Data
>>> Sources) versus putting them in for the specific application.  However,
>>> the app. still dosen't work.
>>>
>>> My question is, how do I make these data source entires 'stay put', so
>>> that when the app is redeployed it can still make the JDBC calls?
>>> Obviously I don't want to have to keep putting these in every time the
>>> app is deployed.
>>>
>>> All help is appreciated.
>>>
>>> -jeff
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>>
>
> ---------------------------------------------------------------------
> 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
>
> 


---------------------------------------------------------------------
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: Data Sources Overwritten

Posted by "Jeffrey C. Baldwin" <Je...@ncmail.net>.
David,

Where do I put this context.xml file?

I noticed that when I deploy the app using manager, then configure the
data sources using the admin tool... that a file names mrs.xml (mrs is
the name of the application I am deploying) is created
(/usr/local/tomcat/conf/Catalina/localhost), it contains all of the data
source information and app works fine, long as it is there.  However,
this file gets removed when I deploy via the webapp again, and then...
the application is broken again.

So, obviously the contents of mrs.xml are right, because the app works
while it's there... so you're saying I need to put this information into
context.xml, where should I put this context.xml file in the filesystem?
 Is it odd that this mrs.xml gets deleted when I deploy the app via the
manager?

I'm pasting the contents of the mrs.xml file below, again.. as long as
this mrs2.xml is in the directory noted above, the app works... but as
soon as I re-deploy the app through the web interface, this file gets
deleted and the app no longer works...

Thanks for your assistance.
jeff

<?xml version='1.0' encoding='utf-8'?>
<Context docBase="/usr/local/tomcat/webapps/mrs2" path="/mrs2"
workDir="work/Catalina/localhost/mrs2">
  <Resource auth="Container" description="zos DB2 Connection"
name="jdbc/ZosDataSource" type="javax.sql.DataSource"/>
  <Resource auth="Container" description="local DB2 Connection"
name="jdbc/db2ds" type="javax.sql.DataSource"/>
  <Resource auth="Container" description="msql DB Connection"
name="jdbc/mssql2000ds" type="javax.sql.DataSource"/>
  <ResourceParams name="jdbc/ZosDataSource">
    <parameter>
      <name>maxWait</name>
      <value>10000</value>
    </parameter>
    <parameter>
      <name>maxActive</name>
      <value>2</value>
    </parameter>
    <parameter>
      <name>password</name>
      <value>AN12RAMA</value>
    </parameter>
    <parameter>
      <name>url</name>
      <value>jdbc:db2://123.456.789.120:5019/NETSNDB01</value>
    </parameter>
    <parameter>
      <name>driverClassName</name>
      <value>com.ibm.db2.jcc.DB2Driver</value>
    </parameter>
    <parameter>
      <name>maxIdle</name>
      <value>1</value>
    </parameter>
    <parameter>
      <name>username</name>
      <value>name</value>
    </parameter>
  </ResourceParams>
  <ResourceParams name="jdbc/db2ds">
    <parameter>
      <name>driverClassName</name>
      <value></value>
    </parameter>
  </ResourceParams>
  <ResourceParams name="jdbc/mssql2000ds">
    <parameter>
      <name>maxWait</name>
      <value>10000</value>
    </parameter>
    <parameter>
      <name>maxActive</name>
      <value>2</value>
    </parameter>
    <parameter>
      <name>password</name>
      <value>pv345ankita</value>
    </parameter>
    <parameter>
      <name>url</name>

<value>jdbc:jtds:sqlserver://123.456.789.96/mrsuat;user=name;password=pv123ankita</value>
    </parameter>
    <parameter>


David Smith wrote:
> Best bet is to configure it manually in the context.xml for the webapp. 
> I've never had good luck with the administration webapp in the very few
> times I've tried to use it.
> You describe tomcat as over-writing the config submitted via the admin
> webapp.  It's more likely the admin webapp is changing the running state
> of tomcat but not persisting those changes to disk.  When you restart,
> it's as if you never made any changes at all.
> 
> --David
> 
> Jeffrey C. Baldwin wrote:
> 
>> (Tomcat 5.0.28 running on CentOS 4.4 using Java 1.4.2_14-b05)
>>
>> Hello All,
>>
>> I have a problem with my understanding of data sources within Tomcat.
>>
>> I have an application (MRS).  I deploy MRS using the Tomcat Manager.  I
>> then open up Tomcat Administration and I see MRS under:
>>
>> Tomcat Server - Service (Catalina) - Host (localhost) - Context (mrs)
>>
>> I then open up Resources -> Data Sources, and I 2 data source entries
>> have been crated (mssql & db2), however their configuration information
>> (url, driver class, etc..) is complete empty.  And, of course, the
>> application doesn't work because the JDBC calls are broken.
>>
>> I go in, using the Administration tool again, configure the data
>> sources, providing URL, driver class, etc.. commit the changes and
>> everything works great.
>>
>> THIS IS WHERE THE PROBLEM comes in, it all works great until we deploy
>> the application again.  Then the application, when deployed, just
>> overwrites all the data source information and I'm forced to enter it
>> all again for the app to work.
>>
>> I,  using the Administration tool, tried putting the data source entries
>> in for the entire Tomcat Server (Tomcat Server - Resources - Data
>> Sources) versus putting them in for the specific application.  However,
>> the app. still dosen't work.
>>
>> My question is, how do I make these data source entires 'stay put', so
>> that when the app is redeployed it can still make the JDBC calls?
>> Obviously I don't want to have to keep putting these in every time the
>> app is deployed.
>>
>> All help is appreciated.
>>
>> -jeff
>>
>>
>> ---------------------------------------------------------------------
>> 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
>>
>>  
>>
> 
> 
> ---------------------------------------------------------------------
> 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
> 

---------------------------------------------------------------------
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: Data Sources Overwritten

Posted by David Smith <dn...@cornell.edu>.
Best bet is to configure it manually in the context.xml for the webapp.  
I've never had good luck with the administration webapp in the very few 
times I've tried to use it. 

You describe tomcat as over-writing the config submitted via the admin 
webapp.  It's more likely the admin webapp is changing the running state 
of tomcat but not persisting those changes to disk.  When you restart, 
it's as if you never made any changes at all.

--David

Jeffrey C. Baldwin wrote:

>(Tomcat 5.0.28 running on CentOS 4.4 using Java 1.4.2_14-b05)
>
>Hello All,
>
>I have a problem with my understanding of data sources within Tomcat.
>
>I have an application (MRS).  I deploy MRS using the Tomcat Manager.  I
>then open up Tomcat Administration and I see MRS under:
>
>Tomcat Server - Service (Catalina) - Host (localhost) - Context (mrs)
>
>I then open up Resources -> Data Sources, and I 2 data source entries
>have been crated (mssql & db2), however their configuration information
>(url, driver class, etc..) is complete empty.  And, of course, the
>application doesn't work because the JDBC calls are broken.
>
>I go in, using the Administration tool again, configure the data
>sources, providing URL, driver class, etc.. commit the changes and
>everything works great.
>
>THIS IS WHERE THE PROBLEM comes in, it all works great until we deploy
>the application again.  Then the application, when deployed, just
>overwrites all the data source information and I'm forced to enter it
>all again for the app to work.
>
>I,  using the Administration tool, tried putting the data source entries
>in for the entire Tomcat Server (Tomcat Server - Resources - Data
>Sources) versus putting them in for the specific application.  However,
>the app. still dosen't work.
>
>My question is, how do I make these data source entires 'stay put', so
>that when the app is redeployed it can still make the JDBC calls?
>Obviously I don't want to have to keep putting these in every time the
>app is deployed.
>
>All help is appreciated.
>
>-jeff
>
>
>---------------------------------------------------------------------
>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
>
>  
>


---------------------------------------------------------------------
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: Data Sources Overwritten

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
Jeff, look I'm not sure, but it shouldnt do that.
Just make absolutely sure that the app is closing those connections, ie 
giving them back to the pool.... only reason I can think you get this 
behaviour.

If you dont close them properly... eventually Tomcat will break... it wont 
have another connection to hand out.

If you look at the documentation there is an eg at the bottom that shows u 
how to make sure you do it right.

----- Original Message ----- 
From: "Jeffrey C. Baldwin" <Je...@ncmail.net>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Thursday, June 14, 2007 6:53 PM
Subject: Re: Data Sources Overwritten


>I appreciate all the input guys.  I put everything into server.xml and
> the application is working great.
>
> One small problem though... if I undeploy the app, then deploy it
> again... I get the same database problem, UNTIL I restart the TomCat
> service itself.  Once I restart Tomcat, all is well..
>
> So, my question is, I was trying to set it up so that my developers
> could just deploy/undeploy/stop/start their apps all through the web,
> w/out needing shell access to the server.  Is there a way for them to
> restart the Tomcat service through a web interface?
>
> Is it normal that they should have to restart the entire Tomcat service
> for their app to be able to talk to the configured database connections
> in server.xml?
>
> Thanks!
>
> Johnny Kewl wrote:
>> Jeff, I dont use JNDI for dbs, got my own, but its sounds like you just
>> not configuring some xml somewhere...
>> On your system have a look at this link...
>> http://localhost:8080/tomcat-docs/jndi-datasource-examples-howto.html
>>
>> As I said, no expert, but you can see that in the server.xml, thats
>> where the pool is actually
>> setup. So those setting will say create 20 dB connections. This is done
>> so that your app reacts quickly.
>>
>> Then in Web.xml, just looks like a mapping of the pool objects to a
>> database object...
>>
>> and then finally your application will get the context, which really
>> just grabs a connection from the pool, and returns it as a
>> javax.sql.DataSource to your application.
>>
>> Anyway have a look at that and if you think you have it all, post the
>> equiv snippets of your config, and I'm sure the guru's will spot the
>> problem.
>> If I had to guess, I think your problem is in server.xml, because when
>> you do it yourself, thats where it should have happened.
>> ie when the server starts up, it will make the pool.... and thats
>> probably why it kills the pool every time its started.
>>
>> good luck...
>>
>>
>>
>> ----- Original Message ----- From: "Jeffrey C. Baldwin"
>> <Je...@ncmail.net>
>> To: <us...@tomcat.apache.org>
>> Sent: Thursday, June 14, 2007 4:46 PM
>> Subject: Data Sources Overwritten
>>
>>
>>> (Tomcat 5.0.28 running on CentOS 4.4 using Java 1.4.2_14-b05)
>>>
>>> Hello All,
>>>
>>> I have a problem with my understanding of data sources within Tomcat.
>>>
>>> I have an application (MRS).  I deploy MRS using the Tomcat Manager.  I
>>> then open up Tomcat Administration and I see MRS under:
>>>
>>> Tomcat Server - Service (Catalina) - Host (localhost) - Context (mrs)
>>>
>>> I then open up Resources -> Data Sources, and I 2 data source entries
>>> have been crated (mssql & db2), however their configuration information
>>> (url, driver class, etc..) is complete empty.  And, of course, the
>>> application doesn't work because the JDBC calls are broken.
>>>
>>> I go in, using the Administration tool again, configure the data
>>> sources, providing URL, driver class, etc.. commit the changes and
>>> everything works great.
>>>
>>> THIS IS WHERE THE PROBLEM comes in, it all works great until we deploy
>>> the application again.  Then the application, when deployed, just
>>> overwrites all the data source information and I'm forced to enter it
>>> all again for the app to work.
>>>
>>> I,  using the Administration tool, tried putting the data source entries
>>> in for the entire Tomcat Server (Tomcat Server - Resources - Data
>>> Sources) versus putting them in for the specific application.  However,
>>> the app. still dosen't work.
>>>
>>> My question is, how do I make these data source entires 'stay put', so
>>> that when the app is redeployed it can still make the JDBC calls?
>>> Obviously I don't want to have to keep putting these in every time the
>>> app is deployed.
>>>
>>> All help is appreciated.
>>>
>>> -jeff
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>>
>
> ---------------------------------------------------------------------
> 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
>
> 


---------------------------------------------------------------------
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: Data Sources Overwritten

Posted by "Jeffrey C. Baldwin" <Je...@ncmail.net>.

Pid wrote:

> Chris was indicating that you put a 'META-INF/context.xml' in your war
> or webapp directory - which Tomcat will then deploy to the named file
> above.

AHH... I did misunderstand.  I will try creating the WAR with the
context file in place.

Thanks!


> 
> 
> 
>> ----- Original Message ----- From: "Christopher Schultz"
>> <ch...@christopherschultz.net>
>> To: "Tomcat Users List" <us...@tomcat.apache.org>
>> Sent: Thursday, June 14, 2007 7:06 PM
>> Subject: Re: Data Sources Overwritten
>>
>>
> Jeffrey,
> 
> Jeffrey C. Baldwin wrote:
>>>>> I appreciate all the input guys.  I put everything into server.xml and
>>>>> the application is working great.
> 
> You should put that setup into META-INF/context.xml in your webapp
> directory (or your WAR file) instead of into server.xml. This is likely
> to fix your problem.
> 
>>>>> So, my question is, I was trying to set it up so that my developers
>>>>> could just deploy/undeploy/stop/start their apps all through the web,
>>>>> w/out needing shell access to the server.  Is there a way for them to
>>>>> restart the Tomcat service through a web interface?
> 
> Restart the entire Tomcat service? I don't think Tomcat includes this
> capability. You'd have to write your own, separate utility app that can
> take down and restart Tomcat.
> 
>>>>> Is it normal that they should have to restart the entire Tomcat service
>>>>> for their app to be able to talk to the configured database connections
>>>>> in server.xml?
> 
> No, it's not. Configuring those connections in context.xml will
> certainly alleviate this problem.
> 
> -chris
> 
>>>
---------------------------------------------------------------------
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
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>>
>>


---------------------------------------------------------------------
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: Data Sources Overwritten

Posted by "Jeffrey C. Baldwin" <Je...@ncmail.net>.
A big "THANK YOU" to everyone...

I had the developer put the context.xml file into the META-INF
directory... I then uploaded the WAR file and the application ran
immediately!

Thank you again!  I don't know if this is something the developer should
have known or been doing or something I should have known... but either
way, I am excited!

-jeff

Pid wrote:
> Johnny Kewl wrote:
>> Chris, the documentation
>> http://localhost:8080/tomcat-docs/jndi-datasource-examples-howto.html
>> explicitly says... have a look at postgres example, that file should
>> have same name as
>> the war, or the app.... maybe it can be put into context.xml, but are
>> you sure?
> 
> The /deployed/ XML file can be placed in
> 
>  tomcat/<service>/<host>/<appname>.xml
> 
> or
> 
>  tomcat/Catalina/localhost/mrs.xml
> 
> 
> Chris was indicating that you put a 'META-INF/context.xml' in your war
> or webapp directory - which Tomcat will then deploy to the named file
> above.
> 
> The deployed file may be removed or replaced during restarts, and
> overwritten by the one in your webapp.
> 
> p
> 
> 
> 
>> ----- Original Message ----- From: "Christopher Schultz"
>> <ch...@christopherschultz.net>
>> To: "Tomcat Users List" <us...@tomcat.apache.org>
>> Sent: Thursday, June 14, 2007 7:06 PM
>> Subject: Re: Data Sources Overwritten
>>
>>
> Jeffrey,
> 
> Jeffrey C. Baldwin wrote:
>>>>> I appreciate all the input guys.  I put everything into server.xml and
>>>>> the application is working great.
> 
> You should put that setup into META-INF/context.xml in your webapp
> directory (or your WAR file) instead of into server.xml. This is likely
> to fix your problem.
> 
>>>>> So, my question is, I was trying to set it up so that my developers
>>>>> could just deploy/undeploy/stop/start their apps all through the web,
>>>>> w/out needing shell access to the server.  Is there a way for them to
>>>>> restart the Tomcat service through a web interface?
> 
> Restart the entire Tomcat service? I don't think Tomcat includes this
> capability. You'd have to write your own, separate utility app that can
> take down and restart Tomcat.
> 
>>>>> Is it normal that they should have to restart the entire Tomcat service
>>>>> for their app to be able to talk to the configured database connections
>>>>> in server.xml?
> 
> No, it's not. Configuring those connections in context.xml will
> certainly alleviate this problem.
> 
> -chris
> 
>>>
---------------------------------------------------------------------
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
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>>
>>


---------------------------------------------------------------------
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: Data Sources Overwritten

Posted by Pid <p...@pidster.com>.
Johnny Kewl wrote:
> Chris, the documentation
> http://localhost:8080/tomcat-docs/jndi-datasource-examples-howto.html
> explicitly says... have a look at postgres example, that file should 
> have same name as
> the war, or the app.... maybe it can be put into context.xml, but are 
> you sure?

The /deployed/ XML file can be placed in

  tomcat/<service>/<host>/<appname>.xml

or

  tomcat/Catalina/localhost/mrs.xml


Chris was indicating that you put a 'META-INF/context.xml' in your war 
or webapp directory - which Tomcat will then deploy to the named file above.

The deployed file may be removed or replaced during restarts, and 
overwritten by the one in your webapp.

p



> ----- Original Message ----- From: "Christopher Schultz" 
> <ch...@christopherschultz.net>
> To: "Tomcat Users List" <us...@tomcat.apache.org>
> Sent: Thursday, June 14, 2007 7:06 PM
> Subject: Re: Data Sources Overwritten
> 
> 
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Jeffrey,
>>
>> Jeffrey C. Baldwin wrote:
>>> I appreciate all the input guys.  I put everything into server.xml and
>>> the application is working great.
>>
>> You should put that setup into META-INF/context.xml in your webapp
>> directory (or your WAR file) instead of into server.xml. This is likely
>> to fix your problem.
>>
>>> So, my question is, I was trying to set it up so that my developers
>>> could just deploy/undeploy/stop/start their apps all through the web,
>>> w/out needing shell access to the server.  Is there a way for them to
>>> restart the Tomcat service through a web interface?
>>
>> Restart the entire Tomcat service? I don't think Tomcat includes this
>> capability. You'd have to write your own, separate utility app that can
>> take down and restart Tomcat.
>>
>>> Is it normal that they should have to restart the entire Tomcat service
>>> for their app to be able to talk to the configured database connections
>>> in server.xml?
>>
>> No, it's not. Configuring those connections in context.xml will
>> certainly alleviate this problem.
>>
>> - -chris
>>
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.7 (MingW32)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>>
>> iD8DBQFGcXWJ9CaO5/Lv0PARAmhvAJ0aJATm+wlRQ5vjomN7DrDqXR3GxACeJ07h
>> NiTcmPBAk0XsmYRUySzWPl4=
>> =Ek8Y
>> -----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
>>
>>
> 
> 
> ---------------------------------------------------------------------
> 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: Data Sources Overwritten

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
Chris, the documentation
http://localhost:8080/tomcat-docs/jndi-datasource-examples-howto.html
explicitly says... have a look at postgres example, that file should have 
same name as
the war, or the app.... maybe it can be put into context.xml, but are you 
sure?



----- Original Message ----- 
From: "Christopher Schultz" <ch...@christopherschultz.net>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Thursday, June 14, 2007 7:06 PM
Subject: Re: Data Sources Overwritten


> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Jeffrey,
>
> Jeffrey C. Baldwin wrote:
>> I appreciate all the input guys.  I put everything into server.xml and
>> the application is working great.
>
> You should put that setup into META-INF/context.xml in your webapp
> directory (or your WAR file) instead of into server.xml. This is likely
> to fix your problem.
>
>> So, my question is, I was trying to set it up so that my developers
>> could just deploy/undeploy/stop/start their apps all through the web,
>> w/out needing shell access to the server.  Is there a way for them to
>> restart the Tomcat service through a web interface?
>
> Restart the entire Tomcat service? I don't think Tomcat includes this
> capability. You'd have to write your own, separate utility app that can
> take down and restart Tomcat.
>
>> Is it normal that they should have to restart the entire Tomcat service
>> for their app to be able to talk to the configured database connections
>> in server.xml?
>
> No, it's not. Configuring those connections in context.xml will
> certainly alleviate this problem.
>
> - -chris
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFGcXWJ9CaO5/Lv0PARAmhvAJ0aJATm+wlRQ5vjomN7DrDqXR3GxACeJ07h
> NiTcmPBAk0XsmYRUySzWPl4=
> =Ek8Y
> -----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
>
> 


---------------------------------------------------------------------
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: Data Sources Overwritten

Posted by Pid <p...@pidster.com>.
Jeffrey C. Baldwin wrote:
> P,

(our messages crossed, I think)

Looks like you've got the context setup in the server.xml AND the 
external file.  You only need one location, comment out the Context 
definition in server.xml and we'll work on getting the auto-deploy to 
work from the WAR/webapp.


p




> This is everything from server.xml
> 
> <?xml version='1.0' encoding='utf-8'?>
> <Server>
>   <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
>   <Listener
> className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
>   <GlobalNamingResources>
>     <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
>     <Resource auth="Container" description="User database that can be
> updated and saved" name="UserDatabase"
> type="org.apache.catalina.UserDatabase"/>
>     <ResourceParams name="UserDatabase">
>       <parameter>
>         <name>factory</name>
>         <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
>       </parameter>
>       <parameter>
>         <name>pathname</name>
>         <value>conf/tomcat-users.xml</value>
>       </parameter>
>     </ResourceParams>
>   </GlobalNamingResources>
>   <Service name="Catalina">
>     <Connector acceptCount="100" connectionTimeout="20000"
> disableUploadTimeout="true" port="8080" redirectPort="8443"
> maxSpareThreads="75" maxThreads="150"
> minSpareThreads="25">
>     </Connector>
>     <Connector port="8009" protocol="AJP/1.3"
> protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"
> redirectPort="8443">
>     </Connector>
>     <Engine defaultHost="localhost" name="Catalina">
> <Host name="localhost" debug="0" appBase="webapps" unpackWARs="true"
> autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
> <Valve className="org.apache.catalina.valves.AccessLogValve"
> directory="logs" prefix="localhost_access_log." suffix=".txt"
> pattern="common" resolveHosts="fal
> se" />
> <Logger className="org.apache.catalina.logger.FileLogger"
> directory="logs" prefix="localhost_log." suffix=".txt" timestamp="true" />
> <Context debug="0" docBase="mrs2" path="/mrs2" reloadable="true">
> <Logger className="org.apache.catalina.logger.FileLogger"
> prefix="localhost_mrs2_log." suffix=".txt" timestamp="true"/>
>                    <Resource name="jdbc/ZosDataSource" auth="Container"
> type="javax.sql.DataSource"></Resource>
>                    <ResourceParams name="jdbc/ZosDataSource">
>                        <parameter>
>                            <name>factory</name>
> 
> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>                        </parameter>
>                        <parameter>
>                            <name>maxActive</name>
>                            <value>5</value>
>                        </parameter>
>                        <parameter>
>                            <name>maxIdle</name>
>                            <value>1</value>
>                        </parameter>
>                        <parameter>
>                            <name>maxWait</name>
>                            <value>10000</value>
>                        </parameter>
>                        <parameter>
>                            <name>username</name>
>                            <value>TS59MRS</value>
>                        </parameter>
>                        <parameter>
>                            <name>password</name>
>                            <value>password</value>
>                        </parameter>
>                        <parameter>
>                            <name>driverClassName</name>
>                            <value>com.ibm.db2.jcc.DB2Driver</value>
>                        </parameter>
>                        <parameter>
>                            <name>url</name>
> 
> <value>jdbc:db2://123.456.789.120:5019/NETSNDB01</value>  <!--
> production 123.456.789.120:5019/NETSNDB01 -->
>                        </parameter>
>                    </ResourceParams>
>                    <Resource name="jdbc/mssql2000ds" auth="Container"
> type="javax.sql.DataSource"></Resource>
>                    <ResourceParams name="jdbc/mssql2000ds">
>                        <parameter>
>                            <name>factory</name>
> 
> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>                        </parameter>
>                        <parameter>
>                            <name>maxActive</name>
>                            <value>10</value>
>                        </parameter>
>                        <parameter>
>                            <name>maxIdle</name>
>                            <value>1</value>
>                        </parameter>
>                        <parameter>
>                            <name>maxWait</name>
>                            <value>10000</value>
>                        </parameter>
>                        <parameter>
>                            <name>username</name>
>                            <value>rreddy</value>
>                        </parameter>
>                        <parameter>
>                            <name>password</name>
>                            <value>password</value>
>                        </parameter>
>                        <parameter>
>                            <name>driverClassName</name>
>                            <value>net.sourceforge.jtds.jdbc.Driver</value>
>                        </parameter>
>                        <parameter>
>                            <name>url</name>
> 
> <value>jdbc:jtds:sqlserver://123.456.789.96/mrs;user=rreddy;password=pv123ankita</value>
>                         </parameter>
>                    </ResourceParams>
>                         </Context>
>                         </Host>
> <Logger className="org.apache.catalina.logger.FileLogger"
> prefix="catalina_log." suffix=".txt" timestamp="true"/>
>       <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
>     </Engine>
>   </Service>
> </Server>
> 
> 
> 
> Pid wrote:
>> Jeffrey C. Baldwin wrote:
>>> Chris,
>>>
>>> Thank you for the time. However, I'm still not having any luck...
>> What's in your Host definition in server.xml, can you post that too?
>>
>> p
>>
>>
>>> Again, I have the entries in server.xml, so if I restart the Tomcat
>>> service AFTER deploying the app, all is well.  However, I want the
>>> application developers to be able to deploy their app and not have to,
>>> or need to contact me to, restart the Tomcat service.
>>>
>>> Thanks again!
>>>
>>> In:
>>> /usr/local/tomcat/webapps/mrs2/META-INF
>>>
>>> I have:
>>>
>>> <?xml version='1.0' encoding='utf-8'?>
>>> <Context docBase="/usr/local/tomcat/webapps/mrs2" path="/mrs2"
>>> workDir="work/Catalina/localhost/mrs2">
>>>   <Resource auth="Container" description="zos DB2 Connection"
>>> name="jdbc/ZosDataSource" type="javax.sql.DataSource"/>
>>>   <Resource auth="Container" description="local DB2 Connection"
>>> name="jdbc/db2ds" type="javax.sql.DataSource"/>
>>>   <Resource auth="Container" description="msql DB Connection"
>>> name="jdbc/mssql2000ds" type="javax.sql.DataSource"/>
>>>   <ResourceParams name="jdbc/ZosDataSource">
>>>     <parameter>
>>>       <name>maxWait</name>
>>>       <value>10000</value>
>>>     </parameter>
>>>     <parameter>
>>>       <name>maxActive</name>
>>>       <value>2</value>
>>>     </parameter>
>>>     <parameter>
>>>       <name>password</name>
>>>       <value>test</value>
>>>     </parameter>
>>>     <parameter>
>>>       <name>url</name>
>>>       <value>jdbc:db2://123.456.789.120:5019/NETSNDB01</value>
>>>     </parameter>
>>>     <parameter>
>>>       <name>driverClassName</name>
>>>       <value>com.ibm.db2.jcc.DB2Driver</value>
>>>     </parameter>
>>>     <parameter>
>>>       <name>maxIdle</name>
>>>       <value>1</value>
>>>     </parameter>
>>>     <parameter>
>>>       <name>username</name>
>>>       <value>TS59MRS</value>
>>>     </parameter>
>>>   </ResourceParams>
>>>   <ResourceParams name="jdbc/db2ds">
>>>     <parameter>
>>>       <name>driverClassName</name>
>>>       <value></value>
>>>     </parameter>
>>>   </ResourceParams>
>>>   <ResourceParams name="jdbc/mssql2000ds">
>>>     <parameter>
>>>       <name>maxWait</name>
>>>       <value>10000</value>
>>>     </parameter>
>>>     <parameter>
>>>       <name>maxActive</name>
>>>       <value>2</value>
>>>     </parameter>
>>>     <parameter>
>>>       <name>password</name>
>>>       <value>password</value>
>>>     </parameter>
>>>     <parameter>
>>>       <name>url</name>
>>> <value>jdbc:jtds:sqlserver://123.456.789.96/mrsuat;user=rreddy;password=password</value>
>>>
>>>     </parameter>
>>>     <parameter>
>>>       <name>driverClassName</name>
>>>       <value>net.sourceforge.jtds.jdbc.Driver</value>
>>>     </parameter>
>>>     <parameter>
>>>       <name>maxIdle</name>
>>>       <value>1</value>
>>>     </parameter>
>>>     <parameter>
>>>       <name>username</name>
>>>       <value>rreddy</value>
>>>     </parameter>
>>>   </ResourceParams>
>>> </Context>
>>>
>>>
>>> Christopher Schultz wrote:
>>>> Jeffrey,
>>>>
>>>> Jeffrey C. Baldwin wrote:
>>>>> I appreciate all the input guys.  I put everything into server.xml and
>>>>> the application is working great.
>>>> You should put that setup into META-INF/context.xml in your webapp
>>>> directory (or your WAR file) instead of into server.xml. This is likely
>>>> to fix your problem.
>>>>
>>>>> So, my question is, I was trying to set it up so that my developers
>>>>> could just deploy/undeploy/stop/start their apps all through the web,
>>>>> w/out needing shell access to the server.  Is there a way for them to
>>>>> restart the Tomcat service through a web interface?
>>>> Restart the entire Tomcat service? I don't think Tomcat includes this
>>>> capability. You'd have to write your own, separate utility app that can
>>>> take down and restart Tomcat.
>>>>
>>>>> Is it normal that they should have to restart the entire Tomcat service
>>>>> for their app to be able to talk to the configured database connections
>>>>> in server.xml?
>>>> No, it's not. Configuring those connections in context.xml will
>>>> certainly alleviate this problem.
>>>>
>>>> -chris
>>>>
>>> ---------------------------------------------------------------------
>>> 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
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>>
>>>
> 
> ---------------------------------------------------------------------
> 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: Data Sources Overwritten

Posted by "Jeffrey C. Baldwin" <Je...@ncmail.net>.
P,

This is everything from server.xml

<?xml version='1.0' encoding='utf-8'?>
<Server>
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
  <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
  <GlobalNamingResources>
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
    <Resource auth="Container" description="User database that can be
updated and saved" name="UserDatabase"
type="org.apache.catalina.UserDatabase"/>
    <ResourceParams name="UserDatabase">
      <parameter>
        <name>factory</name>
        <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
      </parameter>
      <parameter>
        <name>pathname</name>
        <value>conf/tomcat-users.xml</value>
      </parameter>
    </ResourceParams>
  </GlobalNamingResources>
  <Service name="Catalina">
    <Connector acceptCount="100" connectionTimeout="20000"
disableUploadTimeout="true" port="8080" redirectPort="8443"
maxSpareThreads="75" maxThreads="150"
minSpareThreads="25">
    </Connector>
    <Connector port="8009" protocol="AJP/1.3"
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"
redirectPort="8443">
    </Connector>
    <Engine defaultHost="localhost" name="Catalina">
<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true"
autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common" resolveHosts="fal
se" />
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="localhost_log." suffix=".txt" timestamp="true" />
<Context debug="0" docBase="mrs2" path="/mrs2" reloadable="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_mrs2_log." suffix=".txt" timestamp="true"/>
                   <Resource name="jdbc/ZosDataSource" auth="Container"
type="javax.sql.DataSource"></Resource>
                   <ResourceParams name="jdbc/ZosDataSource">
                       <parameter>
                           <name>factory</name>

<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
                       </parameter>
                       <parameter>
                           <name>maxActive</name>
                           <value>5</value>
                       </parameter>
                       <parameter>
                           <name>maxIdle</name>
                           <value>1</value>
                       </parameter>
                       <parameter>
                           <name>maxWait</name>
                           <value>10000</value>
                       </parameter>
                       <parameter>
                           <name>username</name>
                           <value>TS59MRS</value>
                       </parameter>
                       <parameter>
                           <name>password</name>
                           <value>password</value>
                       </parameter>
                       <parameter>
                           <name>driverClassName</name>
                           <value>com.ibm.db2.jcc.DB2Driver</value>
                       </parameter>
                       <parameter>
                           <name>url</name>

<value>jdbc:db2://123.456.789.120:5019/NETSNDB01</value>  <!--
production 123.456.789.120:5019/NETSNDB01 -->
                       </parameter>
                   </ResourceParams>
                   <Resource name="jdbc/mssql2000ds" auth="Container"
type="javax.sql.DataSource"></Resource>
                   <ResourceParams name="jdbc/mssql2000ds">
                       <parameter>
                           <name>factory</name>

<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
                       </parameter>
                       <parameter>
                           <name>maxActive</name>
                           <value>10</value>
                       </parameter>
                       <parameter>
                           <name>maxIdle</name>
                           <value>1</value>
                       </parameter>
                       <parameter>
                           <name>maxWait</name>
                           <value>10000</value>
                       </parameter>
                       <parameter>
                           <name>username</name>
                           <value>rreddy</value>
                       </parameter>
                       <parameter>
                           <name>password</name>
                           <value>password</value>
                       </parameter>
                       <parameter>
                           <name>driverClassName</name>
                           <value>net.sourceforge.jtds.jdbc.Driver</value>
                       </parameter>
                       <parameter>
                           <name>url</name>

<value>jdbc:jtds:sqlserver://123.456.789.96/mrs;user=rreddy;password=pv123ankita</value>
                        </parameter>
                   </ResourceParams>
                        </Context>
                        </Host>
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="catalina_log." suffix=".txt" timestamp="true"/>
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
    </Engine>
  </Service>
</Server>



Pid wrote:
> Jeffrey C. Baldwin wrote:
>> Chris,
>>
>> Thank you for the time. However, I'm still not having any luck...
> 
> What's in your Host definition in server.xml, can you post that too?
> 
> p
> 
> 
>> Again, I have the entries in server.xml, so if I restart the Tomcat
>> service AFTER deploying the app, all is well.  However, I want the
>> application developers to be able to deploy their app and not have to,
>> or need to contact me to, restart the Tomcat service.
>>
>> Thanks again!
>>
>> In:
>> /usr/local/tomcat/webapps/mrs2/META-INF
>>
>> I have:
>>
>> <?xml version='1.0' encoding='utf-8'?>
>> <Context docBase="/usr/local/tomcat/webapps/mrs2" path="/mrs2"
>> workDir="work/Catalina/localhost/mrs2">
>>   <Resource auth="Container" description="zos DB2 Connection"
>> name="jdbc/ZosDataSource" type="javax.sql.DataSource"/>
>>   <Resource auth="Container" description="local DB2 Connection"
>> name="jdbc/db2ds" type="javax.sql.DataSource"/>
>>   <Resource auth="Container" description="msql DB Connection"
>> name="jdbc/mssql2000ds" type="javax.sql.DataSource"/>
>>   <ResourceParams name="jdbc/ZosDataSource">
>>     <parameter>
>>       <name>maxWait</name>
>>       <value>10000</value>
>>     </parameter>
>>     <parameter>
>>       <name>maxActive</name>
>>       <value>2</value>
>>     </parameter>
>>     <parameter>
>>       <name>password</name>
>>       <value>test</value>
>>     </parameter>
>>     <parameter>
>>       <name>url</name>
>>       <value>jdbc:db2://123.456.789.120:5019/NETSNDB01</value>
>>     </parameter>
>>     <parameter>
>>       <name>driverClassName</name>
>>       <value>com.ibm.db2.jcc.DB2Driver</value>
>>     </parameter>
>>     <parameter>
>>       <name>maxIdle</name>
>>       <value>1</value>
>>     </parameter>
>>     <parameter>
>>       <name>username</name>
>>       <value>TS59MRS</value>
>>     </parameter>
>>   </ResourceParams>
>>   <ResourceParams name="jdbc/db2ds">
>>     <parameter>
>>       <name>driverClassName</name>
>>       <value></value>
>>     </parameter>
>>   </ResourceParams>
>>   <ResourceParams name="jdbc/mssql2000ds">
>>     <parameter>
>>       <name>maxWait</name>
>>       <value>10000</value>
>>     </parameter>
>>     <parameter>
>>       <name>maxActive</name>
>>       <value>2</value>
>>     </parameter>
>>     <parameter>
>>       <name>password</name>
>>       <value>password</value>
>>     </parameter>
>>     <parameter>
>>       <name>url</name>
>> <value>jdbc:jtds:sqlserver://123.456.789.96/mrsuat;user=rreddy;password=password</value>
>>
>>     </parameter>
>>     <parameter>
>>       <name>driverClassName</name>
>>       <value>net.sourceforge.jtds.jdbc.Driver</value>
>>     </parameter>
>>     <parameter>
>>       <name>maxIdle</name>
>>       <value>1</value>
>>     </parameter>
>>     <parameter>
>>       <name>username</name>
>>       <value>rreddy</value>
>>     </parameter>
>>   </ResourceParams>
>> </Context>
>>
>>
>> Christopher Schultz wrote:
>>> Jeffrey,
>>>
>>> Jeffrey C. Baldwin wrote:
>>>> I appreciate all the input guys.  I put everything into server.xml and
>>>> the application is working great.
>>> You should put that setup into META-INF/context.xml in your webapp
>>> directory (or your WAR file) instead of into server.xml. This is likely
>>> to fix your problem.
>>>
>>>> So, my question is, I was trying to set it up so that my developers
>>>> could just deploy/undeploy/stop/start their apps all through the web,
>>>> w/out needing shell access to the server.  Is there a way for them to
>>>> restart the Tomcat service through a web interface?
>>> Restart the entire Tomcat service? I don't think Tomcat includes this
>>> capability. You'd have to write your own, separate utility app that can
>>> take down and restart Tomcat.
>>>
>>>> Is it normal that they should have to restart the entire Tomcat service
>>>> for their app to be able to talk to the configured database connections
>>>> in server.xml?
>>> No, it's not. Configuring those connections in context.xml will
>>> certainly alleviate this problem.
>>>
>>> -chris
>>>
>>
>> ---------------------------------------------------------------------
>> 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
>>
>>
>> ---------------------------------------------------------------------
>> 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
>>
>>
> 

---------------------------------------------------------------------
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: Data Sources Overwritten

Posted by Pid <p...@pidster.com>.
Jeffrey C. Baldwin wrote:
> Chris,
> 
> Thank you for the time. However, I'm still not having any luck...

What's in your Host definition in server.xml, can you post that too?

p


> Again, I have the entries in server.xml, so if I restart the Tomcat
> service AFTER deploying the app, all is well.  However, I want the
> application developers to be able to deploy their app and not have to,
> or need to contact me to, restart the Tomcat service.
> 
> Thanks again!
> 
> In:
> /usr/local/tomcat/webapps/mrs2/META-INF
> 
> I have:
> 
> <?xml version='1.0' encoding='utf-8'?>
> <Context docBase="/usr/local/tomcat/webapps/mrs2" path="/mrs2"
> workDir="work/Catalina/localhost/mrs2">
>   <Resource auth="Container" description="zos DB2 Connection"
> name="jdbc/ZosDataSource" type="javax.sql.DataSource"/>
>   <Resource auth="Container" description="local DB2 Connection"
> name="jdbc/db2ds" type="javax.sql.DataSource"/>
>   <Resource auth="Container" description="msql DB Connection"
> name="jdbc/mssql2000ds" type="javax.sql.DataSource"/>
>   <ResourceParams name="jdbc/ZosDataSource">
>     <parameter>
>       <name>maxWait</name>
>       <value>10000</value>
>     </parameter>
>     <parameter>
>       <name>maxActive</name>
>       <value>2</value>
>     </parameter>
>     <parameter>
>       <name>password</name>
>       <value>test</value>
>     </parameter>
>     <parameter>
>       <name>url</name>
>       <value>jdbc:db2://123.456.789.120:5019/NETSNDB01</value>
>     </parameter>
>     <parameter>
>       <name>driverClassName</name>
>       <value>com.ibm.db2.jcc.DB2Driver</value>
>     </parameter>
>     <parameter>
>       <name>maxIdle</name>
>       <value>1</value>
>     </parameter>
>     <parameter>
>       <name>username</name>
>       <value>TS59MRS</value>
>     </parameter>
>   </ResourceParams>
>   <ResourceParams name="jdbc/db2ds">
>     <parameter>
>       <name>driverClassName</name>
>       <value></value>
>     </parameter>
>   </ResourceParams>
>   <ResourceParams name="jdbc/mssql2000ds">
>     <parameter>
>       <name>maxWait</name>
>       <value>10000</value>
>     </parameter>
>     <parameter>
>       <name>maxActive</name>
>       <value>2</value>
>     </parameter>
>     <parameter>
>       <name>password</name>
>       <value>password</value>
>     </parameter>
>     <parameter>
>       <name>url</name>
> <value>jdbc:jtds:sqlserver://123.456.789.96/mrsuat;user=rreddy;password=password</value>
>     </parameter>
>     <parameter>
>       <name>driverClassName</name>
>       <value>net.sourceforge.jtds.jdbc.Driver</value>
>     </parameter>
>     <parameter>
>       <name>maxIdle</name>
>       <value>1</value>
>     </parameter>
>     <parameter>
>       <name>username</name>
>       <value>rreddy</value>
>     </parameter>
>   </ResourceParams>
> </Context>
> 
> 
> Christopher Schultz wrote:
>> Jeffrey,
>>
>> Jeffrey C. Baldwin wrote:
>>> I appreciate all the input guys.  I put everything into server.xml and
>>> the application is working great.
>> You should put that setup into META-INF/context.xml in your webapp
>> directory (or your WAR file) instead of into server.xml. This is likely
>> to fix your problem.
>>
>>> So, my question is, I was trying to set it up so that my developers
>>> could just deploy/undeploy/stop/start their apps all through the web,
>>> w/out needing shell access to the server.  Is there a way for them to
>>> restart the Tomcat service through a web interface?
>> Restart the entire Tomcat service? I don't think Tomcat includes this
>> capability. You'd have to write your own, separate utility app that can
>> take down and restart Tomcat.
>>
>>> Is it normal that they should have to restart the entire Tomcat service
>>> for their app to be able to talk to the configured database connections
>>> in server.xml?
>> No, it's not. Configuring those connections in context.xml will
>> certainly alleviate this problem.
>>
>> -chris
>>
> 
> ---------------------------------------------------------------------
> 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
> 
> 
> ---------------------------------------------------------------------
> 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: Data Sources Overwritten

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Scott,

ScottAnders@BC.com wrote:
> Using your method of including the context within the application how do
> you adjust for different environments (dev vs production)?  Different
> WARs?

We use ant for deployment, and we have a "release type". The release
type dictates the directory whence config files come, so our WARs are
built to contain the context.xml file (as well as other files)
appropriate for the target environment.

> How we do it now is have a context.xml.default included in the
> conf/Catalina/NameOfYourHostInServer.xml/ directory where the JNDI
> datasource is defined.  That way we can take the exact same WAR that was
> deployed on dev and deploy it to production (since they point to
> different DBs and thus have different datasources).  

My preference is to avoid making any changes at all to a stock Tomcat
installation. Once installed (as root), the only change we make to the
Tomcat installation directory is to make some files (web.xml, for
instance) to be world-readable.

Everything else is done as a non-privileged user with a separate
CATALINA_HOME, config files, and deployment directory. We never mess
with conf/Catalina or its contents. All applications are completely
self-contained within their WAR files. This gives us the least
resistance when it comes to deployment in any environment.

Hope that helps,
- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGeA9Z9CaO5/Lv0PARAgz2AKCVYFX95xYNAj015BsCHJXE9gaY3ACeK5om
Sqz5uM8YzHYOAorkUFmQCRM=
=z40z
-----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: Data Sources Overwritten

Posted by Sc...@BC.com.
Chris,

Using your method of including the context within the application how do
you adjust for different environments (dev vs production)?  Different
WARs?  

How we do it now is have a context.xml.default included in the
conf/Catalina/NameOfYourHostInServer.xml/ directory where the JNDI
datasource is defined.  That way we can take the exact same WAR that was
deployed on dev and deploy it to production (since they point to
different DBs and thus have different datasources).  

Scott

-----Original Message-----
From: Christopher Schultz [mailto:chris@christopherschultz.net] 
Sent: Tuesday, June 19, 2007 10:35 AM
To: Tomcat Users List
Subject: Re: Data Sources Overwritten

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jeff,
You have not followed my suggestions:

1. Remove all JNDI datasource information from server.xml and never put
it back in.

2. Use a META-INF/context.xml file and bundle it into your WAR file for
deployment. context.xml should include 100% of the JNDI data source
configuration that you need for your app. Consider using <Resource> and
specifying everything instead of trying to use <Resource> /and/
<ResourceParams>.

3. Stop using the Manager to do anything at all.

This will allow your application to setup its own data source instead of
relying on the server to have it ready to go before deployment.
Re-deployments will re-setup the connection, just as it was intended.

This is all documented (poorly, I might add), on this page:
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.h
tml

Under "MySQL DBCP Example / 2. server.xml configuration", replace the
direction to put the configuration "into server.xml inside your
<Context> element" with "into context.xml inside your <Context>
element".

- -chris

Jeffrey C. Baldwin wrote:
> Also, here is a copy of my server.xml.
> 
> <?xml version='1.0' encoding='utf-8'?>
> <Server>
>   <Listener
className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
>   <Listener
>
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/
>
>   <GlobalNamingResources>
>     <Environment name="simpleValue" type="java.lang.Integer"
value="30"/>
>     <Resource auth="Container" description="User database that can be
> updated and saved" name="UserDatabase"
> type="org.apache.catalina.UserDatabase"/>
>     <ResourceParams name="UserDatabase">
>       <parameter>
>         <name>factory</name>
>
<value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
>       </parameter>
>       <parameter>
>         <name>pathname</name>
>         <value>conf/tomcat-users.xml</value>
>       </parameter>
>     </ResourceParams>
>   </GlobalNamingResources>
>   <Service name="Catalina">
>     <Connector acceptCount="100" connectionTimeout="20000"
> disableUploadTimeout="true" port="8080" redirectPort="8443"
> maxSpareThreads="75" maxThreads="150"
> minSpareThreads="25">
>     </Connector>
>     <Connector port="8009" protocol="AJP/1.3"
> protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"
> redirectPort="8443">
>     </Connector>
>     <Engine defaultHost="localhost" name="Catalina">
> <Host name="localhost" debug="0" appBase="webapps" unpackWARs="true"
> autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
> <Valve className="org.apache.catalina.valves.AccessLogValve"
> directory="logs" prefix="localhost_access_log." suffix=".txt"
> pattern="common" resolveHosts="fal
> se" />
> <Logger className="org.apache.catalina.logger.FileLogger"
> directory="logs" prefix="localhost_log." suffix=".txt"
timestamp="true" />
> <Context debug="0" docBase="mrs2" path="/mrs2" reloadable="true">
> <Logger className="org.apache.catalina.logger.FileLogger"
> prefix="localhost_mrs2_log." suffix=".txt" timestamp="true"/>
>                    <Resource name="jdbc/ZosDataSource"
auth="Container"
> type="javax.sql.DataSource"></Resource>
>                    <ResourceParams name="jdbc/ZosDataSource">
>                        <parameter>
>                            <name>factory</name>
> 
> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>                        </parameter>
>                        <parameter>
>                            <name>maxActive</name>
>                            <value>5</value>
>                        </parameter>
>                        <parameter>
>                            <name>maxIdle</name>
>                            <value>1</value>
>                        </parameter>
>                        <parameter>
>                            <name>maxWait</name>
>                            <value>10000</value>
>                        </parameter>
>                        <parameter>
>                            <name>username</name>
>                            <value>TS59MRS</value>
>                        </parameter>
>                        <parameter>
>                            <name>password</name>
>                            <value>password</value>
>                        </parameter>
>                        <parameter>
>                            <name>driverClassName</name>
>                            <value>com.ibm.db2.jcc.DB2Driver</value>
>                        </parameter>
>                        <parameter>
>                            <name>url</name>
> 
> <value>jdbc:db2://123.456.789.120:5019/NETSNDB01</value>  <!--
> production 123.456.789.120:5019/NETSNDB01 -->
>                        </parameter>
>                    </ResourceParams>
>                    <Resource name="jdbc/mssql2000ds" auth="Container"
> type="javax.sql.DataSource"></Resource>
>                    <ResourceParams name="jdbc/mssql2000ds">
>                        <parameter>
>                            <name>factory</name>
> 
> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>                        </parameter>
>                        <parameter>
>                            <name>maxActive</name>
>                            <value>10</value>
>                        </parameter>
>                        <parameter>
>                            <name>maxIdle</name>
>                            <value>1</value>
>                        </parameter>
>                        <parameter>
>                            <name>maxWait</name>
>                            <value>10000</value>
>                        </parameter>
>                        <parameter>
>                            <name>username</name>
>                            <value>rreddy</value>
>                        </parameter>
>                        <parameter>
>                            <name>password</name>
>                            <value>password</value>
>                        </parameter>
>                        <parameter>
>                            <name>driverClassName</name>
>
<value>net.sourceforge.jtds.jdbc.Driver</value>
>                        </parameter>
>                        <parameter>
>                            <name>url</name>
> 
>
<value>jdbc:jtds:sqlserver://123.456.789.96/mrs;user=rreddy;password=pv1
23ankita</value>
>                         </parameter>
>                    </ResourceParams>
>                         </Context>
>                         </Host>
> <Logger className="org.apache.catalina.logger.FileLogger"
> prefix="catalina_log." suffix=".txt" timestamp="true"/>
>       <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
>     </Engine>
>   </Service>
> </Server>
> 
> 
> 
> Jeffrey C. Baldwin wrote:
>> Chris,
>>
>> Thank you for the time. However, I'm still not having any luck...
>>
>> Again, I have the entries in server.xml, so if I restart the Tomcat
>> service AFTER deploying the app, all is well.  However, I want the
>> application developers to be able to deploy their app and not have
to,
>> or need to contact me to, restart the Tomcat service.
>>
>> Thanks again!
>>
>> In:
>> /usr/local/tomcat/webapps/mrs2/META-INF
>>
>> I have:
>>
>> <?xml version='1.0' encoding='utf-8'?>
>> <Context docBase="/usr/local/tomcat/webapps/mrs2" path="/mrs2"
>> workDir="work/Catalina/localhost/mrs2">
>>   <Resource auth="Container" description="zos DB2 Connection"
>> name="jdbc/ZosDataSource" type="javax.sql.DataSource"/>
>>   <Resource auth="Container" description="local DB2 Connection"
>> name="jdbc/db2ds" type="javax.sql.DataSource"/>
>>   <Resource auth="Container" description="msql DB Connection"
>> name="jdbc/mssql2000ds" type="javax.sql.DataSource"/>
>>   <ResourceParams name="jdbc/ZosDataSource">
>>     <parameter>
>>       <name>maxWait</name>
>>       <value>10000</value>
>>     </parameter>
>>     <parameter>
>>       <name>maxActive</name>
>>       <value>2</value>
>>     </parameter>
>>     <parameter>
>>       <name>password</name>
>>       <value>test</value>
>>     </parameter>
>>     <parameter>
>>       <name>url</name>
>>       <value>jdbc:db2://123.456.789.120:5019/NETSNDB01</value>
>>     </parameter>
>>     <parameter>
>>       <name>driverClassName</name>
>>       <value>com.ibm.db2.jcc.DB2Driver</value>
>>     </parameter>
>>     <parameter>
>>       <name>maxIdle</name>
>>       <value>1</value>
>>     </parameter>
>>     <parameter>
>>       <name>username</name>
>>       <value>TS59MRS</value>
>>     </parameter>
>>   </ResourceParams>
>>   <ResourceParams name="jdbc/db2ds">
>>     <parameter>
>>       <name>driverClassName</name>
>>       <value></value>
>>     </parameter>
>>   </ResourceParams>
>>   <ResourceParams name="jdbc/mssql2000ds">
>>     <parameter>
>>       <name>maxWait</name>
>>       <value>10000</value>
>>     </parameter>
>>     <parameter>
>>       <name>maxActive</name>
>>       <value>2</value>
>>     </parameter>
>>     <parameter>
>>       <name>password</name>
>>       <value>password</value>
>>     </parameter>
>>     <parameter>
>>       <name>url</name>
>>
<value>jdbc:jtds:sqlserver://123.456.789.96/mrsuat;user=rreddy;password=
password</value>
>>     </parameter>
>>     <parameter>
>>       <name>driverClassName</name>
>>       <value>net.sourceforge.jtds.jdbc.Driver</value>
>>     </parameter>
>>     <parameter>
>>       <name>maxIdle</name>
>>       <value>1</value>
>>     </parameter>
>>     <parameter>
>>       <name>username</name>
>>       <value>rreddy</value>
>>     </parameter>
>>   </ResourceParams>
>> </Context>
>>
>>
>> Christopher Schultz wrote:
>>> Jeffrey,
>>>
>>> Jeffrey C. Baldwin wrote:
>>>> I appreciate all the input guys.  I put everything into server.xml
and
>>>> the application is working great.
>>> You should put that setup into META-INF/context.xml in your webapp
>>> directory (or your WAR file) instead of into server.xml. This is
likely
>>> to fix your problem.
>>>
>>>> So, my question is, I was trying to set it up so that my developers
>>>> could just deploy/undeploy/stop/start their apps all through the
web,
>>>> w/out needing shell access to the server.  Is there a way for them
to
>>>> restart the Tomcat service through a web interface?
>>> Restart the entire Tomcat service? I don't think Tomcat includes
this
>>> capability. You'd have to write your own, separate utility app that
can
>>> take down and restart Tomcat.
>>>
>>>> Is it normal that they should have to restart the entire Tomcat
service
>>>> for their app to be able to talk to the configured database
connections
>>>> in server.xml?
>>> No, it's not. Configuring those connections in context.xml will
>>> certainly alleviate this problem.
>>>
>>> -chris
>>>
>> ---------------------------------------------------------------------
>> 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
>>
>>
>> ---------------------------------------------------------------------
>> 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
>>
> 
> ---------------------------------------------------------------------
> 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
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGeAW+9CaO5/Lv0PARAuPsAJ0YG9txmGYz3GnCLSpdECzWoZNE9wCdGBf8
mISkIX/kQ+mRGOgeYJ1D6Ps=
=BdTV
-----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


---------------------------------------------------------------------
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: Data Sources Overwritten

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jeff,
You have not followed my suggestions:

1. Remove all JNDI datasource information from server.xml and never put
it back in.

2. Use a META-INF/context.xml file and bundle it into your WAR file for
deployment. context.xml should include 100% of the JNDI data source
configuration that you need for your app. Consider using <Resource> and
specifying everything instead of trying to use <Resource> /and/
<ResourceParams>.

3. Stop using the Manager to do anything at all.

This will allow your application to setup its own data source instead of
relying on the server to have it ready to go before deployment.
Re-deployments will re-setup the connection, just as it was intended.

This is all documented (poorly, I might add), on this page:
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html

Under "MySQL DBCP Example / 2. server.xml configuration", replace the
direction to put the configuration "into server.xml inside your
<Context> element" with "into context.xml inside your <Context> element".

- -chris

Jeffrey C. Baldwin wrote:
> Also, here is a copy of my server.xml.
> 
> <?xml version='1.0' encoding='utf-8'?>
> <Server>
>   <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
>   <Listener
> className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
>   <GlobalNamingResources>
>     <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
>     <Resource auth="Container" description="User database that can be
> updated and saved" name="UserDatabase"
> type="org.apache.catalina.UserDatabase"/>
>     <ResourceParams name="UserDatabase">
>       <parameter>
>         <name>factory</name>
>         <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
>       </parameter>
>       <parameter>
>         <name>pathname</name>
>         <value>conf/tomcat-users.xml</value>
>       </parameter>
>     </ResourceParams>
>   </GlobalNamingResources>
>   <Service name="Catalina">
>     <Connector acceptCount="100" connectionTimeout="20000"
> disableUploadTimeout="true" port="8080" redirectPort="8443"
> maxSpareThreads="75" maxThreads="150"
> minSpareThreads="25">
>     </Connector>
>     <Connector port="8009" protocol="AJP/1.3"
> protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"
> redirectPort="8443">
>     </Connector>
>     <Engine defaultHost="localhost" name="Catalina">
> <Host name="localhost" debug="0" appBase="webapps" unpackWARs="true"
> autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
> <Valve className="org.apache.catalina.valves.AccessLogValve"
> directory="logs" prefix="localhost_access_log." suffix=".txt"
> pattern="common" resolveHosts="fal
> se" />
> <Logger className="org.apache.catalina.logger.FileLogger"
> directory="logs" prefix="localhost_log." suffix=".txt" timestamp="true" />
> <Context debug="0" docBase="mrs2" path="/mrs2" reloadable="true">
> <Logger className="org.apache.catalina.logger.FileLogger"
> prefix="localhost_mrs2_log." suffix=".txt" timestamp="true"/>
>                    <Resource name="jdbc/ZosDataSource" auth="Container"
> type="javax.sql.DataSource"></Resource>
>                    <ResourceParams name="jdbc/ZosDataSource">
>                        <parameter>
>                            <name>factory</name>
> 
> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>                        </parameter>
>                        <parameter>
>                            <name>maxActive</name>
>                            <value>5</value>
>                        </parameter>
>                        <parameter>
>                            <name>maxIdle</name>
>                            <value>1</value>
>                        </parameter>
>                        <parameter>
>                            <name>maxWait</name>
>                            <value>10000</value>
>                        </parameter>
>                        <parameter>
>                            <name>username</name>
>                            <value>TS59MRS</value>
>                        </parameter>
>                        <parameter>
>                            <name>password</name>
>                            <value>password</value>
>                        </parameter>
>                        <parameter>
>                            <name>driverClassName</name>
>                            <value>com.ibm.db2.jcc.DB2Driver</value>
>                        </parameter>
>                        <parameter>
>                            <name>url</name>
> 
> <value>jdbc:db2://123.456.789.120:5019/NETSNDB01</value>  <!--
> production 123.456.789.120:5019/NETSNDB01 -->
>                        </parameter>
>                    </ResourceParams>
>                    <Resource name="jdbc/mssql2000ds" auth="Container"
> type="javax.sql.DataSource"></Resource>
>                    <ResourceParams name="jdbc/mssql2000ds">
>                        <parameter>
>                            <name>factory</name>
> 
> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>                        </parameter>
>                        <parameter>
>                            <name>maxActive</name>
>                            <value>10</value>
>                        </parameter>
>                        <parameter>
>                            <name>maxIdle</name>
>                            <value>1</value>
>                        </parameter>
>                        <parameter>
>                            <name>maxWait</name>
>                            <value>10000</value>
>                        </parameter>
>                        <parameter>
>                            <name>username</name>
>                            <value>rreddy</value>
>                        </parameter>
>                        <parameter>
>                            <name>password</name>
>                            <value>password</value>
>                        </parameter>
>                        <parameter>
>                            <name>driverClassName</name>
>                            <value>net.sourceforge.jtds.jdbc.Driver</value>
>                        </parameter>
>                        <parameter>
>                            <name>url</name>
> 
> <value>jdbc:jtds:sqlserver://123.456.789.96/mrs;user=rreddy;password=pv123ankita</value>
>                         </parameter>
>                    </ResourceParams>
>                         </Context>
>                         </Host>
> <Logger className="org.apache.catalina.logger.FileLogger"
> prefix="catalina_log." suffix=".txt" timestamp="true"/>
>       <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
>     </Engine>
>   </Service>
> </Server>
> 
> 
> 
> Jeffrey C. Baldwin wrote:
>> Chris,
>>
>> Thank you for the time. However, I'm still not having any luck...
>>
>> Again, I have the entries in server.xml, so if I restart the Tomcat
>> service AFTER deploying the app, all is well.  However, I want the
>> application developers to be able to deploy their app and not have to,
>> or need to contact me to, restart the Tomcat service.
>>
>> Thanks again!
>>
>> In:
>> /usr/local/tomcat/webapps/mrs2/META-INF
>>
>> I have:
>>
>> <?xml version='1.0' encoding='utf-8'?>
>> <Context docBase="/usr/local/tomcat/webapps/mrs2" path="/mrs2"
>> workDir="work/Catalina/localhost/mrs2">
>>   <Resource auth="Container" description="zos DB2 Connection"
>> name="jdbc/ZosDataSource" type="javax.sql.DataSource"/>
>>   <Resource auth="Container" description="local DB2 Connection"
>> name="jdbc/db2ds" type="javax.sql.DataSource"/>
>>   <Resource auth="Container" description="msql DB Connection"
>> name="jdbc/mssql2000ds" type="javax.sql.DataSource"/>
>>   <ResourceParams name="jdbc/ZosDataSource">
>>     <parameter>
>>       <name>maxWait</name>
>>       <value>10000</value>
>>     </parameter>
>>     <parameter>
>>       <name>maxActive</name>
>>       <value>2</value>
>>     </parameter>
>>     <parameter>
>>       <name>password</name>
>>       <value>test</value>
>>     </parameter>
>>     <parameter>
>>       <name>url</name>
>>       <value>jdbc:db2://123.456.789.120:5019/NETSNDB01</value>
>>     </parameter>
>>     <parameter>
>>       <name>driverClassName</name>
>>       <value>com.ibm.db2.jcc.DB2Driver</value>
>>     </parameter>
>>     <parameter>
>>       <name>maxIdle</name>
>>       <value>1</value>
>>     </parameter>
>>     <parameter>
>>       <name>username</name>
>>       <value>TS59MRS</value>
>>     </parameter>
>>   </ResourceParams>
>>   <ResourceParams name="jdbc/db2ds">
>>     <parameter>
>>       <name>driverClassName</name>
>>       <value></value>
>>     </parameter>
>>   </ResourceParams>
>>   <ResourceParams name="jdbc/mssql2000ds">
>>     <parameter>
>>       <name>maxWait</name>
>>       <value>10000</value>
>>     </parameter>
>>     <parameter>
>>       <name>maxActive</name>
>>       <value>2</value>
>>     </parameter>
>>     <parameter>
>>       <name>password</name>
>>       <value>password</value>
>>     </parameter>
>>     <parameter>
>>       <name>url</name>
>> <value>jdbc:jtds:sqlserver://123.456.789.96/mrsuat;user=rreddy;password=password</value>
>>     </parameter>
>>     <parameter>
>>       <name>driverClassName</name>
>>       <value>net.sourceforge.jtds.jdbc.Driver</value>
>>     </parameter>
>>     <parameter>
>>       <name>maxIdle</name>
>>       <value>1</value>
>>     </parameter>
>>     <parameter>
>>       <name>username</name>
>>       <value>rreddy</value>
>>     </parameter>
>>   </ResourceParams>
>> </Context>
>>
>>
>> Christopher Schultz wrote:
>>> Jeffrey,
>>>
>>> Jeffrey C. Baldwin wrote:
>>>> I appreciate all the input guys.  I put everything into server.xml and
>>>> the application is working great.
>>> You should put that setup into META-INF/context.xml in your webapp
>>> directory (or your WAR file) instead of into server.xml. This is likely
>>> to fix your problem.
>>>
>>>> So, my question is, I was trying to set it up so that my developers
>>>> could just deploy/undeploy/stop/start their apps all through the web,
>>>> w/out needing shell access to the server.  Is there a way for them to
>>>> restart the Tomcat service through a web interface?
>>> Restart the entire Tomcat service? I don't think Tomcat includes this
>>> capability. You'd have to write your own, separate utility app that can
>>> take down and restart Tomcat.
>>>
>>>> Is it normal that they should have to restart the entire Tomcat service
>>>> for their app to be able to talk to the configured database connections
>>>> in server.xml?
>>> No, it's not. Configuring those connections in context.xml will
>>> certainly alleviate this problem.
>>>
>>> -chris
>>>
>> ---------------------------------------------------------------------
>> 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
>>
>>
>> ---------------------------------------------------------------------
>> 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
>>
> 
> ---------------------------------------------------------------------
> 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
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGeAW+9CaO5/Lv0PARAuPsAJ0YG9txmGYz3GnCLSpdECzWoZNE9wCdGBf8
mISkIX/kQ+mRGOgeYJ1D6Ps=
=BdTV
-----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: Data Sources Overwritten

Posted by "Jeffrey C. Baldwin" <Je...@ncmail.net>.
Also, here is a copy of my server.xml.

<?xml version='1.0' encoding='utf-8'?>
<Server>
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
  <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
  <GlobalNamingResources>
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
    <Resource auth="Container" description="User database that can be
updated and saved" name="UserDatabase"
type="org.apache.catalina.UserDatabase"/>
    <ResourceParams name="UserDatabase">
      <parameter>
        <name>factory</name>
        <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
      </parameter>
      <parameter>
        <name>pathname</name>
        <value>conf/tomcat-users.xml</value>
      </parameter>
    </ResourceParams>
  </GlobalNamingResources>
  <Service name="Catalina">
    <Connector acceptCount="100" connectionTimeout="20000"
disableUploadTimeout="true" port="8080" redirectPort="8443"
maxSpareThreads="75" maxThreads="150"
minSpareThreads="25">
    </Connector>
    <Connector port="8009" protocol="AJP/1.3"
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"
redirectPort="8443">
    </Connector>
    <Engine defaultHost="localhost" name="Catalina">
<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true"
autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common" resolveHosts="fal
se" />
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="localhost_log." suffix=".txt" timestamp="true" />
<Context debug="0" docBase="mrs2" path="/mrs2" reloadable="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_mrs2_log." suffix=".txt" timestamp="true"/>
                   <Resource name="jdbc/ZosDataSource" auth="Container"
type="javax.sql.DataSource"></Resource>
                   <ResourceParams name="jdbc/ZosDataSource">
                       <parameter>
                           <name>factory</name>

<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
                       </parameter>
                       <parameter>
                           <name>maxActive</name>
                           <value>5</value>
                       </parameter>
                       <parameter>
                           <name>maxIdle</name>
                           <value>1</value>
                       </parameter>
                       <parameter>
                           <name>maxWait</name>
                           <value>10000</value>
                       </parameter>
                       <parameter>
                           <name>username</name>
                           <value>TS59MRS</value>
                       </parameter>
                       <parameter>
                           <name>password</name>
                           <value>password</value>
                       </parameter>
                       <parameter>
                           <name>driverClassName</name>
                           <value>com.ibm.db2.jcc.DB2Driver</value>
                       </parameter>
                       <parameter>
                           <name>url</name>

<value>jdbc:db2://123.456.789.120:5019/NETSNDB01</value>  <!--
production 123.456.789.120:5019/NETSNDB01 -->
                       </parameter>
                   </ResourceParams>
                   <Resource name="jdbc/mssql2000ds" auth="Container"
type="javax.sql.DataSource"></Resource>
                   <ResourceParams name="jdbc/mssql2000ds">
                       <parameter>
                           <name>factory</name>

<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
                       </parameter>
                       <parameter>
                           <name>maxActive</name>
                           <value>10</value>
                       </parameter>
                       <parameter>
                           <name>maxIdle</name>
                           <value>1</value>
                       </parameter>
                       <parameter>
                           <name>maxWait</name>
                           <value>10000</value>
                       </parameter>
                       <parameter>
                           <name>username</name>
                           <value>rreddy</value>
                       </parameter>
                       <parameter>
                           <name>password</name>
                           <value>password</value>
                       </parameter>
                       <parameter>
                           <name>driverClassName</name>
                           <value>net.sourceforge.jtds.jdbc.Driver</value>
                       </parameter>
                       <parameter>
                           <name>url</name>

<value>jdbc:jtds:sqlserver://123.456.789.96/mrs;user=rreddy;password=pv123ankita</value>
                        </parameter>
                   </ResourceParams>
                        </Context>
                        </Host>
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="catalina_log." suffix=".txt" timestamp="true"/>
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
    </Engine>
  </Service>
</Server>



Jeffrey C. Baldwin wrote:
> Chris,
> 
> Thank you for the time. However, I'm still not having any luck...
> 
> Again, I have the entries in server.xml, so if I restart the Tomcat
> service AFTER deploying the app, all is well.  However, I want the
> application developers to be able to deploy their app and not have to,
> or need to contact me to, restart the Tomcat service.
> 
> Thanks again!
> 
> In:
> /usr/local/tomcat/webapps/mrs2/META-INF
> 
> I have:
> 
> <?xml version='1.0' encoding='utf-8'?>
> <Context docBase="/usr/local/tomcat/webapps/mrs2" path="/mrs2"
> workDir="work/Catalina/localhost/mrs2">
>   <Resource auth="Container" description="zos DB2 Connection"
> name="jdbc/ZosDataSource" type="javax.sql.DataSource"/>
>   <Resource auth="Container" description="local DB2 Connection"
> name="jdbc/db2ds" type="javax.sql.DataSource"/>
>   <Resource auth="Container" description="msql DB Connection"
> name="jdbc/mssql2000ds" type="javax.sql.DataSource"/>
>   <ResourceParams name="jdbc/ZosDataSource">
>     <parameter>
>       <name>maxWait</name>
>       <value>10000</value>
>     </parameter>
>     <parameter>
>       <name>maxActive</name>
>       <value>2</value>
>     </parameter>
>     <parameter>
>       <name>password</name>
>       <value>test</value>
>     </parameter>
>     <parameter>
>       <name>url</name>
>       <value>jdbc:db2://123.456.789.120:5019/NETSNDB01</value>
>     </parameter>
>     <parameter>
>       <name>driverClassName</name>
>       <value>com.ibm.db2.jcc.DB2Driver</value>
>     </parameter>
>     <parameter>
>       <name>maxIdle</name>
>       <value>1</value>
>     </parameter>
>     <parameter>
>       <name>username</name>
>       <value>TS59MRS</value>
>     </parameter>
>   </ResourceParams>
>   <ResourceParams name="jdbc/db2ds">
>     <parameter>
>       <name>driverClassName</name>
>       <value></value>
>     </parameter>
>   </ResourceParams>
>   <ResourceParams name="jdbc/mssql2000ds">
>     <parameter>
>       <name>maxWait</name>
>       <value>10000</value>
>     </parameter>
>     <parameter>
>       <name>maxActive</name>
>       <value>2</value>
>     </parameter>
>     <parameter>
>       <name>password</name>
>       <value>password</value>
>     </parameter>
>     <parameter>
>       <name>url</name>
> <value>jdbc:jtds:sqlserver://123.456.789.96/mrsuat;user=rreddy;password=password</value>
>     </parameter>
>     <parameter>
>       <name>driverClassName</name>
>       <value>net.sourceforge.jtds.jdbc.Driver</value>
>     </parameter>
>     <parameter>
>       <name>maxIdle</name>
>       <value>1</value>
>     </parameter>
>     <parameter>
>       <name>username</name>
>       <value>rreddy</value>
>     </parameter>
>   </ResourceParams>
> </Context>
> 
> 
> Christopher Schultz wrote:
>> Jeffrey,
>>
>> Jeffrey C. Baldwin wrote:
>>> I appreciate all the input guys.  I put everything into server.xml and
>>> the application is working great.
>> You should put that setup into META-INF/context.xml in your webapp
>> directory (or your WAR file) instead of into server.xml. This is likely
>> to fix your problem.
>>
>>> So, my question is, I was trying to set it up so that my developers
>>> could just deploy/undeploy/stop/start their apps all through the web,
>>> w/out needing shell access to the server.  Is there a way for them to
>>> restart the Tomcat service through a web interface?
>> Restart the entire Tomcat service? I don't think Tomcat includes this
>> capability. You'd have to write your own, separate utility app that can
>> take down and restart Tomcat.
>>
>>> Is it normal that they should have to restart the entire Tomcat service
>>> for their app to be able to talk to the configured database connections
>>> in server.xml?
>> No, it's not. Configuring those connections in context.xml will
>> certainly alleviate this problem.
>>
>> -chris
>>
> 
> ---------------------------------------------------------------------
> 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
> 
> 
> ---------------------------------------------------------------------
> 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
> 

---------------------------------------------------------------------
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: Data Sources Overwritten

Posted by "Jeffrey C. Baldwin" <Je...@ncmail.net>.
Chris,

Thank you for the time. However, I'm still not having any luck...

Again, I have the entries in server.xml, so if I restart the Tomcat
service AFTER deploying the app, all is well.  However, I want the
application developers to be able to deploy their app and not have to,
or need to contact me to, restart the Tomcat service.

Thanks again!

In:
/usr/local/tomcat/webapps/mrs2/META-INF

I have:

<?xml version='1.0' encoding='utf-8'?>
<Context docBase="/usr/local/tomcat/webapps/mrs2" path="/mrs2"
workDir="work/Catalina/localhost/mrs2">
  <Resource auth="Container" description="zos DB2 Connection"
name="jdbc/ZosDataSource" type="javax.sql.DataSource"/>
  <Resource auth="Container" description="local DB2 Connection"
name="jdbc/db2ds" type="javax.sql.DataSource"/>
  <Resource auth="Container" description="msql DB Connection"
name="jdbc/mssql2000ds" type="javax.sql.DataSource"/>
  <ResourceParams name="jdbc/ZosDataSource">
    <parameter>
      <name>maxWait</name>
      <value>10000</value>
    </parameter>
    <parameter>
      <name>maxActive</name>
      <value>2</value>
    </parameter>
    <parameter>
      <name>password</name>
      <value>test</value>
    </parameter>
    <parameter>
      <name>url</name>
      <value>jdbc:db2://123.456.789.120:5019/NETSNDB01</value>
    </parameter>
    <parameter>
      <name>driverClassName</name>
      <value>com.ibm.db2.jcc.DB2Driver</value>
    </parameter>
    <parameter>
      <name>maxIdle</name>
      <value>1</value>
    </parameter>
    <parameter>
      <name>username</name>
      <value>TS59MRS</value>
    </parameter>
  </ResourceParams>
  <ResourceParams name="jdbc/db2ds">
    <parameter>
      <name>driverClassName</name>
      <value></value>
    </parameter>
  </ResourceParams>
  <ResourceParams name="jdbc/mssql2000ds">
    <parameter>
      <name>maxWait</name>
      <value>10000</value>
    </parameter>
    <parameter>
      <name>maxActive</name>
      <value>2</value>
    </parameter>
    <parameter>
      <name>password</name>
      <value>password</value>
    </parameter>
    <parameter>
      <name>url</name>
<value>jdbc:jtds:sqlserver://123.456.789.96/mrsuat;user=rreddy;password=password</value>
    </parameter>
    <parameter>
      <name>driverClassName</name>
      <value>net.sourceforge.jtds.jdbc.Driver</value>
    </parameter>
    <parameter>
      <name>maxIdle</name>
      <value>1</value>
    </parameter>
    <parameter>
      <name>username</name>
      <value>rreddy</value>
    </parameter>
  </ResourceParams>
</Context>


Christopher Schultz wrote:
> Jeffrey,
> 
> Jeffrey C. Baldwin wrote:
>> I appreciate all the input guys.  I put everything into server.xml and
>> the application is working great.
> 
> You should put that setup into META-INF/context.xml in your webapp
> directory (or your WAR file) instead of into server.xml. This is likely
> to fix your problem.
> 
>> So, my question is, I was trying to set it up so that my developers
>> could just deploy/undeploy/stop/start their apps all through the web,
>> w/out needing shell access to the server.  Is there a way for them to
>> restart the Tomcat service through a web interface?
> 
> Restart the entire Tomcat service? I don't think Tomcat includes this
> capability. You'd have to write your own, separate utility app that can
> take down and restart Tomcat.
> 
>> Is it normal that they should have to restart the entire Tomcat service
>> for their app to be able to talk to the configured database connections
>> in server.xml?
> 
> No, it's not. Configuring those connections in context.xml will
> certainly alleviate this problem.
> 
> -chris
> 

---------------------------------------------------------------------
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


---------------------------------------------------------------------
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: Data Sources Overwritten

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jeffrey,

Jeffrey C. Baldwin wrote:
> I appreciate all the input guys.  I put everything into server.xml and
> the application is working great.

You should put that setup into META-INF/context.xml in your webapp
directory (or your WAR file) instead of into server.xml. This is likely
to fix your problem.

> So, my question is, I was trying to set it up so that my developers
> could just deploy/undeploy/stop/start their apps all through the web,
> w/out needing shell access to the server.  Is there a way for them to
> restart the Tomcat service through a web interface?

Restart the entire Tomcat service? I don't think Tomcat includes this
capability. You'd have to write your own, separate utility app that can
take down and restart Tomcat.

> Is it normal that they should have to restart the entire Tomcat service
> for their app to be able to talk to the configured database connections
> in server.xml?

No, it's not. Configuring those connections in context.xml will
certainly alleviate this problem.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGcXWJ9CaO5/Lv0PARAmhvAJ0aJATm+wlRQ5vjomN7DrDqXR3GxACeJ07h
NiTcmPBAk0XsmYRUySzWPl4=
=Ek8Y
-----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: Data Sources Overwritten

Posted by "Jeffrey C. Baldwin" <Je...@ncmail.net>.
I appreciate all the input guys.  I put everything into server.xml and
the application is working great.

One small problem though... if I undeploy the app, then deploy it
again... I get the same database problem, UNTIL I restart the TomCat
service itself.  Once I restart Tomcat, all is well..

So, my question is, I was trying to set it up so that my developers
could just deploy/undeploy/stop/start their apps all through the web,
w/out needing shell access to the server.  Is there a way for them to
restart the Tomcat service through a web interface?

Is it normal that they should have to restart the entire Tomcat service
for their app to be able to talk to the configured database connections
in server.xml?

Thanks!

Johnny Kewl wrote:
> Jeff, I dont use JNDI for dbs, got my own, but its sounds like you just
> not configuring some xml somewhere...
> On your system have a look at this link...
> http://localhost:8080/tomcat-docs/jndi-datasource-examples-howto.html
> 
> As I said, no expert, but you can see that in the server.xml, thats
> where the pool is actually
> setup. So those setting will say create 20 dB connections. This is done
> so that your app reacts quickly.
> 
> Then in Web.xml, just looks like a mapping of the pool objects to a
> database object...
> 
> and then finally your application will get the context, which really
> just grabs a connection from the pool, and returns it as a
> javax.sql.DataSource to your application.
> 
> Anyway have a look at that and if you think you have it all, post the
> equiv snippets of your config, and I'm sure the guru's will spot the
> problem.
> If I had to guess, I think your problem is in server.xml, because when
> you do it yourself, thats where it should have happened.
> ie when the server starts up, it will make the pool.... and thats
> probably why it kills the pool every time its started.
> 
> good luck...
> 
> 
> 
> ----- Original Message ----- From: "Jeffrey C. Baldwin"
> <Je...@ncmail.net>
> To: <us...@tomcat.apache.org>
> Sent: Thursday, June 14, 2007 4:46 PM
> Subject: Data Sources Overwritten
> 
> 
>> (Tomcat 5.0.28 running on CentOS 4.4 using Java 1.4.2_14-b05)
>>
>> Hello All,
>>
>> I have a problem with my understanding of data sources within Tomcat.
>>
>> I have an application (MRS).  I deploy MRS using the Tomcat Manager.  I
>> then open up Tomcat Administration and I see MRS under:
>>
>> Tomcat Server - Service (Catalina) - Host (localhost) - Context (mrs)
>>
>> I then open up Resources -> Data Sources, and I 2 data source entries
>> have been crated (mssql & db2), however their configuration information
>> (url, driver class, etc..) is complete empty.  And, of course, the
>> application doesn't work because the JDBC calls are broken.
>>
>> I go in, using the Administration tool again, configure the data
>> sources, providing URL, driver class, etc.. commit the changes and
>> everything works great.
>>
>> THIS IS WHERE THE PROBLEM comes in, it all works great until we deploy
>> the application again.  Then the application, when deployed, just
>> overwrites all the data source information and I'm forced to enter it
>> all again for the app to work.
>>
>> I,  using the Administration tool, tried putting the data source entries
>> in for the entire Tomcat Server (Tomcat Server - Resources - Data
>> Sources) versus putting them in for the specific application.  However,
>> the app. still dosen't work.
>>
>> My question is, how do I make these data source entires 'stay put', so
>> that when the app is redeployed it can still make the JDBC calls?
>> Obviously I don't want to have to keep putting these in every time the
>> app is deployed.
>>
>> All help is appreciated.
>>
>> -jeff
>>
>>
>> ---------------------------------------------------------------------
>> 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
>>
>>
> 
> 
> ---------------------------------------------------------------------
> 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
> 

---------------------------------------------------------------------
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: Data Sources Overwritten

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
Jeff, I dont use JNDI for dbs, got my own, but its sounds like you just not 
configuring some xml somewhere...
On your system have a look at this link...
http://localhost:8080/tomcat-docs/jndi-datasource-examples-howto.html

As I said, no expert, but you can see that in the server.xml, thats where 
the pool is actually
setup. So those setting will say create 20 dB connections. This is done so 
that your app reacts quickly.

Then in Web.xml, just looks like a mapping of the pool objects to a database 
object...

and then finally your application will get the context, which really just 
grabs a connection from the pool, and returns it as a javax.sql.DataSource 
to your application.

Anyway have a look at that and if you think you have it all, post the equiv 
snippets of your config, and I'm sure the guru's will spot the problem.
If I had to guess, I think your problem is in server.xml, because when you 
do it yourself, thats where it should have happened.
ie when the server starts up, it will make the pool.... and thats probably 
why it kills the pool every time its started.

good luck...



----- Original Message ----- 
From: "Jeffrey C. Baldwin" <Je...@ncmail.net>
To: <us...@tomcat.apache.org>
Sent: Thursday, June 14, 2007 4:46 PM
Subject: Data Sources Overwritten


> (Tomcat 5.0.28 running on CentOS 4.4 using Java 1.4.2_14-b05)
>
> Hello All,
>
> I have a problem with my understanding of data sources within Tomcat.
>
> I have an application (MRS).  I deploy MRS using the Tomcat Manager.  I
> then open up Tomcat Administration and I see MRS under:
>
> Tomcat Server - Service (Catalina) - Host (localhost) - Context (mrs)
>
> I then open up Resources -> Data Sources, and I 2 data source entries
> have been crated (mssql & db2), however their configuration information
> (url, driver class, etc..) is complete empty.  And, of course, the
> application doesn't work because the JDBC calls are broken.
>
> I go in, using the Administration tool again, configure the data
> sources, providing URL, driver class, etc.. commit the changes and
> everything works great.
>
> THIS IS WHERE THE PROBLEM comes in, it all works great until we deploy
> the application again.  Then the application, when deployed, just
> overwrites all the data source information and I'm forced to enter it
> all again for the app to work.
>
> I,  using the Administration tool, tried putting the data source entries
> in for the entire Tomcat Server (Tomcat Server - Resources - Data
> Sources) versus putting them in for the specific application.  However,
> the app. still dosen't work.
>
> My question is, how do I make these data source entires 'stay put', so
> that when the app is redeployed it can still make the JDBC calls?
> Obviously I don't want to have to keep putting these in every time the
> app is deployed.
>
> All help is appreciated.
>
> -jeff
>
>
> ---------------------------------------------------------------------
> 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
>
> 


---------------------------------------------------------------------
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