RE: JNDI datasource lost on redeploy
I'll see if I can put something together in the next couple of days. Obviously, this issue is tripping up a lot of people. And I forgot to mention one thing about my instructions below--it's for a Windows setup. I think that the syntax for the war attribute of the deploy task may be slightly different on the Unix platforms e.g. too many slashes in file:///? I also left out the actual code that takes advantage of connection pool: At initialize time: Context initialContext = new InitialContext(); Context envContext = (Context) initialContext.lookup(java:comp/env); DataSource dataSource = (DataSource) envContext.lookup(jdbc/protodb); At the time a connection is required: conn = dataSource.getConnection(); Jay -Original Message- From: Josh Rehman [mailto:[EMAIL PROTECTED] Sent: Thursday, February 05, 2004 6:19 PM To: Tomcat Users List Subject: Re: JNDI datasource lost on redeploy That's a really nice write up, Jay. Would it be convenient for you to post a simple project that does this with a build file? Sounds like something that could make it into the FAQ. If that's too much trouble I can produce a project zip perhaps. Burgess, Jay S wrote: Having just gone through this headache last week, I can provide a solution that works for me (for TC5 only!). First, create a file called context.xml and put it in a directory called META-INF at the same level in your source hierarchy as WEB-INF. context.xml should contain your Context and Resource definitions, something like: Context path=/proto docBase=proto.war override=true cachingAllowed=true useNaming=true reloadable=false debug=0 Resource name=jdbc/protodb auth=Container type=javax.sql.DataSource / ResourceParams name=jdbc/protodb ... Second, make sure your web.xml file contains the necessary resource-ref details: resource-ref res-ref-namejdbc/protodb/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Third, use the Tomcat Ant tasks to undeploy/deploy your WAR to the appbase directory: undeploy path=/${app.name} url=${manager.url} username=${manager.username} password=${manager.password} / deploy url=${manager.url} username=${manager.username} password=${manager.password} path=/${app.name} war=file:///${dist.home}/${app.name}.war / Note that I also have unpackWARs set to false in server.xml, so that the WAR is left intact. I noticed that when using this setup, Tomcat pulls context.xml out of the WAR, renames it app name.war, and puts it into the %CATALINA_HOME%/conf/Catalina/localhost directory. I just it alone, as it goes away on undeploy. Let me know if this doesn't work for you. Jay -Original Message- From: todd runstein [mailto:[EMAIL PROTECTED] Sent: Thursday, February 05, 2004 4:51 PM To: [EMAIL PROTECTED] Subject: JNDI datasource lost on redeploy I've set up a JNDI datasource on my test server that works just fine (Tomcat=5.0.18, JDK=1.4.1, RedHat=8, M$_SQL=2000). However, each time I recompile and redeploy the application, I lose my connection pool, recieving the Cannot create JDBC driver of class '' for connect URL 'null' error. I have to restart Tomcat to get it working again. This sort of makes sense, since I'm defining the Resource within a Context in server.xml. It seems that I either need to make the resource globally available to every web app, or move the resource definition to within my web app. Unfortunately, I don't know what to move or where to move it or what options might work. Any advice or suggestions? I'm including all the code used to get the connection as it stands now. Again, this currently works up until I try to redeploy the web app. My driver jars (there are 3 for MS SQL) are in $CATALINA_HOME/common/lib server.xml: Context path=/mfgreports docBase=mfgreports debug=5 Resource name=datasource.testtrk.circuits auth=Container type=javax.sql.DataSource / ResourceParams name=datasource.testtrk.circuits parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter . parameter namedriverClassName/name valuecom.microsoft.jdbc.sqlserver.SQLServerDriver/value /parameter parameter nameurl/name valuejdbc:microsoft:sqlserver://testtrk:1433;databasename=Circuits/va lue /parameter /ResourceParams /Context web.xml: resource-ref res-ref-namedatasource.testtrk.circuits/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Code used to get
Re: JNDI datasource lost on redeploy
Can't solve your problem, but two things:first, try posting a war that reproduces the bug. In this case it might be an ant script that undeploys and redeploys a trivial war. Second, it has recently come to light that you aren't supposed to mess with server.xml Contexts anymore with TC5. You should modify the context xml fragment in conf/Catalina/localhost/ (or something like that). The fragment will be named after the context. todd runstein wrote: problems.. -- Josh Rehman citysearch.com 213.739.3559 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JNDI datasource lost on redeploy - solved
Got it! The reference to conf/Catalina/localhost helped me search the archives to find a message from Derek Mahar on 12/15/03 named JNDI Issue with GlobalNamingResources DefaultContext Solved. In it, Derek suggests placing the context file in META-INF/context.xml. So I pulled out the Context node from server.xml, pasted that in a new file named context.xml, had ant put that file in META-INF while building the war file and viola - success! Thanks Josh and Derek! --- Josh Rehman [EMAIL PROTECTED] wrote: Can't solve your problem, but two things:first, try posting a war that reproduces the bug. In this case it might be an ant script that undeploys and redeploys a trivial war. Second, it has recently come to light that you aren't supposed to mess with server.xml Contexts anymore with TC5. You should modify the context xml fragment in conf/Catalina/localhost/ (or something like that). The fragment will be named after the context. todd runstein wrote: problems.. -- Josh Rehman citysearch.com 213.739.3559 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] = The only dumb question is the one you were too afraid to ask. Check out RouteRuler - Free software for runners, cyclists, walkers, etc. http://routeruler.sourceforge.net __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JNDI datasource lost on redeploy
Having just gone through this headache last week, I can provide a solution that works for me (for TC5 only!). First, create a file called context.xml and put it in a directory called META-INF at the same level in your source hierarchy as WEB-INF. context.xml should contain your Context and Resource definitions, something like: Context path=/proto docBase=proto.war override=true cachingAllowed=true useNaming=true reloadable=false debug=0 Resource name=jdbc/protodb auth=Container type=javax.sql.DataSource / ResourceParams name=jdbc/protodb ... Second, make sure your web.xml file contains the necessary resource-ref details: resource-ref res-ref-namejdbc/protodb/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Third, use the Tomcat Ant tasks to undeploy/deploy your WAR to the appbase directory: undeploy path=/${app.name} url=${manager.url} username=${manager.username} password=${manager.password} / deploy url=${manager.url} username=${manager.username} password=${manager.password} path=/${app.name} war=file:///${dist.home}/${app.name}.war / Note that I also have unpackWARs set to false in server.xml, so that the WAR is left intact. I noticed that when using this setup, Tomcat pulls context.xml out of the WAR, renames it app name.war, and puts it into the %CATALINA_HOME%/conf/Catalina/localhost directory. I just it alone, as it goes away on undeploy. Let me know if this doesn't work for you. Jay -Original Message- From: todd runstein [mailto:[EMAIL PROTECTED] Sent: Thursday, February 05, 2004 4:51 PM To: [EMAIL PROTECTED] Subject: JNDI datasource lost on redeploy I've set up a JNDI datasource on my test server that works just fine (Tomcat=5.0.18, JDK=1.4.1, RedHat=8, M$_SQL=2000). However, each time I recompile and redeploy the application, I lose my connection pool, recieving the Cannot create JDBC driver of class '' for connect URL 'null' error. I have to restart Tomcat to get it working again. This sort of makes sense, since I'm defining the Resource within a Context in server.xml. It seems that I either need to make the resource globally available to every web app, or move the resource definition to within my web app. Unfortunately, I don't know what to move or where to move it or what options might work. Any advice or suggestions? I'm including all the code used to get the connection as it stands now. Again, this currently works up until I try to redeploy the web app. My driver jars (there are 3 for MS SQL) are in $CATALINA_HOME/common/lib server.xml: Context path=/mfgreports docBase=mfgreports debug=5 Resource name=datasource.testtrk.circuits auth=Container type=javax.sql.DataSource / ResourceParams name=datasource.testtrk.circuits parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter . parameter namedriverClassName/name valuecom.microsoft.jdbc.sqlserver.SQLServerDriver/value /parameter parameter nameurl/name valuejdbc:microsoft:sqlserver://testtrk:1433;databasename=Circuits/va lue /parameter /ResourceParams /Context web.xml: resource-ref res-ref-namedatasource.testtrk.circuits/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Code used to get connection: public class JNDIConnection { public static Connection getConnection(String datasource) throws NamingException, SQLException{ Context ctx = new InitialContext(); //This syntax is a bit different than the docs show, but it appears to be working DataSource ds = (DataSource)ctx.lookup(java:comp/env/+datasource); return ds.getConnection(); } } Thanks again! = The only dumb question is the one you were too afraid to ask. Check out RouteRuler - Free software for runners, cyclists, walkers, etc. http://routeruler.sourceforge.net __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JNDI datasource lost on redeploy
That's a really nice write up, Jay. Would it be convenient for you to post a simple project that does this with a build file? Sounds like something that could make it into the FAQ. If that's too much trouble I can produce a project zip perhaps. Burgess, Jay S wrote: Having just gone through this headache last week, I can provide a solution that works for me (for TC5 only!). First, create a file called context.xml and put it in a directory called META-INF at the same level in your source hierarchy as WEB-INF. context.xml should contain your Context and Resource definitions, something like: Context path=/proto docBase=proto.war override=true cachingAllowed=true useNaming=true reloadable=false debug=0 Resource name=jdbc/protodb auth=Container type=javax.sql.DataSource / ResourceParams name=jdbc/protodb ... Second, make sure your web.xml file contains the necessary resource-ref details: resource-ref res-ref-namejdbc/protodb/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Third, use the Tomcat Ant tasks to undeploy/deploy your WAR to the appbase directory: undeploy path=/${app.name} url=${manager.url} username=${manager.username} password=${manager.password} / deploy url=${manager.url} username=${manager.username} password=${manager.password} path=/${app.name} war=file:///${dist.home}/${app.name}.war / Note that I also have unpackWARs set to false in server.xml, so that the WAR is left intact. I noticed that when using this setup, Tomcat pulls context.xml out of the WAR, renames it app name.war, and puts it into the %CATALINA_HOME%/conf/Catalina/localhost directory. I just it alone, as it goes away on undeploy. Let me know if this doesn't work for you. Jay -Original Message- From: todd runstein [mailto:[EMAIL PROTECTED] Sent: Thursday, February 05, 2004 4:51 PM To: [EMAIL PROTECTED] Subject: JNDI datasource lost on redeploy I've set up a JNDI datasource on my test server that works just fine (Tomcat=5.0.18, JDK=1.4.1, RedHat=8, M$_SQL=2000). However, each time I recompile and redeploy the application, I lose my connection pool, recieving the Cannot create JDBC driver of class '' for connect URL 'null' error. I have to restart Tomcat to get it working again. This sort of makes sense, since I'm defining the Resource within a Context in server.xml. It seems that I either need to make the resource globally available to every web app, or move the resource definition to within my web app. Unfortunately, I don't know what to move or where to move it or what options might work. Any advice or suggestions? I'm including all the code used to get the connection as it stands now. Again, this currently works up until I try to redeploy the web app. My driver jars (there are 3 for MS SQL) are in $CATALINA_HOME/common/lib server.xml: Context path=/mfgreports docBase=mfgreports debug=5 Resource name=datasource.testtrk.circuits auth=Container type=javax.sql.DataSource / ResourceParams name=datasource.testtrk.circuits parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter . parameter namedriverClassName/name valuecom.microsoft.jdbc.sqlserver.SQLServerDriver/value /parameter parameter nameurl/name valuejdbc:microsoft:sqlserver://testtrk:1433;databasename=Circuits/va lue /parameter /ResourceParams /Context web.xml: resource-ref res-ref-namedatasource.testtrk.circuits/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Code used to get connection: public class JNDIConnection { public static Connection getConnection(String datasource) throws NamingException, SQLException{ Context ctx = new InitialContext(); //This syntax is a bit different than the docs show, but it appears to be working DataSource ds = (DataSource)ctx.lookup(java:comp/env/+datasource); return ds.getConnection(); } } Thanks again! = The only dumb question is the one you were too afraid to ask. Check out RouteRuler - Free software for runners, cyclists, walkers, etc. http://routeruler.sourceforge.net __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe,
RE: JNDI datasource lost on redeploy
Hi there, I have the same problem . . . . But by no means I manage to get the context.xml file processed: some parameters donnot make any change when I check in Admin. I am using W2K and Ant makes meta-inf in lower case. Would that be the problem? I already did every test and nothing seems to work. I have already set unpackWARs to false which improved the way the app is loaded. Any help will be very much appreciated. Thanks, Hernani -Original Message- From: Burgess, Jay S [mailto:[EMAIL PROTECTED] Sent: quinta-feira, 5 de Fevereiro de 2004 23:48 To: Tomcat Users List Subject: RE: JNDI datasource lost on redeploy Having just gone through this headache last week, I can provide a solution that works for me (for TC5 only!). First, create a file called context.xml and put it in a directory called META-INF at the same level in your source hierarchy as WEB-INF. context.xml should contain your Context and Resource definitions, something like: Context path=/proto docBase=proto.war override=true cachingAllowed=true useNaming=true reloadable=false debug=0 Resource name=jdbc/protodb auth=Container type=javax.sql.DataSource / ResourceParams name=jdbc/protodb ... Second, make sure your web.xml file contains the necessary resource-ref details: resource-ref res-ref-namejdbc/protodb/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Third, use the Tomcat Ant tasks to undeploy/deploy your WAR to the appbase directory: undeploy path=/${app.name} url=${manager.url} username=${manager.username} password=${manager.password} / deploy url=${manager.url} username=${manager.username} password=${manager.password} path=/${app.name} war=file:///${dist.home}/${app.name}.war / Note that I also have unpackWARs set to false in server.xml, so that the WAR is left intact. I noticed that when using this setup, Tomcat pulls context.xml out of the WAR, renames it app name.war, and puts it into the %CATALINA_HOME%/conf/Catalina/localhost directory. I just it alone, as it goes away on undeploy. Let me know if this doesn't work for you. Jay -Original Message- From: todd runstein [mailto:[EMAIL PROTECTED] Sent: Thursday, February 05, 2004 4:51 PM To: [EMAIL PROTECTED] Subject: JNDI datasource lost on redeploy I've set up a JNDI datasource on my test server that works just fine (Tomcat=5.0.18, JDK=1.4.1, RedHat=8, M$_SQL=2000). However, each time I recompile and redeploy the application, I lose my connection pool, recieving the Cannot create JDBC driver of class '' for connect URL 'null' error. I have to restart Tomcat to get it working again. This sort of makes sense, since I'm defining the Resource within a Context in server.xml. It seems that I either need to make the resource globally available to every web app, or move the resource definition to within my web app. Unfortunately, I don't know what to move or where to move it or what options might work. Any advice or suggestions? I'm including all the code used to get the connection as it stands now. Again, this currently works up until I try to redeploy the web app. My driver jars (there are 3 for MS SQL) are in $CATALINA_HOME/common/lib server.xml: Context path=/mfgreports docBase=mfgreports debug=5 Resource name=datasource.testtrk.circuits auth=Container type=javax.sql.DataSource / ResourceParams name=datasource.testtrk.circuits parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter . parameter namedriverClassName/name valuecom.microsoft.jdbc.sqlserver.SQLServerDriver/value /parameter parameter nameurl/name valuejdbc:microsoft:sqlserver://testtrk:1433;databasename=Circuits/va lue /parameter /ResourceParams /Context web.xml: resource-ref res-ref-namedatasource.testtrk.circuits/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Code used to get connection: public class JNDIConnection { public static Connection getConnection(String datasource) throws NamingException, SQLException{ Context ctx = new InitialContext(); //This syntax is a bit different than the docs show, but it appears to be working DataSource ds = (DataSource)ctx.lookup(java:comp/env/+datasource); return ds.getConnection(); } } Thanks again! = The only dumb question is the one you were too afraid to ask. Check out RouteRuler - Free software for runners, cyclists, walkers, etc. http://routeruler.sourceforge.net
RE: JNDI datasource lost on redeploy
Don't know if this is the reason, but this is from the ant manuals war task entry: We regulary receive bug reports that this task is creating the WEB-INF directory, and thus it is our fault your webapp doesn't work. The cause of these complaints lies in WinZip, which turns an all upper-case directory into an all lower case one in a fit of helpfulness. Please check that jar xvf yourwebapp.war shows the same behaviour before filing another report. --- Hernani_Mourao [EMAIL PROTECTED] wrote: Hi there, I have the same problem . . . . But by no means I manage to get the context.xml file processed: some parameters donnot make any change when I check in Admin. I am using W2K and Ant makes meta-inf in lower case. Would that be the problem? I already did every test and nothing seems to work. I have already set unpackWARs to false which improved the way the app is loaded. Any help will be very much appreciated. Thanks, Hernani -Original Message- From: Burgess, Jay S [mailto:[EMAIL PROTECTED] Sent: quinta-feira, 5 de Fevereiro de 2004 23:48 To: Tomcat Users List Subject: RE: JNDI datasource lost on redeploy Having just gone through this headache last week, I can provide a solution that works for me (for TC5 only!). First, create a file called context.xml and put it in a directory called META-INF at the same level in your source hierarchy as WEB-INF. context.xml should contain your Context and Resource definitions, something like: Context path=/proto docBase=proto.war override=true cachingAllowed=true useNaming=true reloadable=false debug=0 Resource name=jdbc/protodb auth=Container type=javax.sql.DataSource / ResourceParams name=jdbc/protodb ... Second, make sure your web.xml file contains the necessary resource-ref details: resource-ref res-ref-namejdbc/protodb/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Third, use the Tomcat Ant tasks to undeploy/deploy your WAR to the appbase directory: undeploy path=/${app.name} url=${manager.url} username=${manager.username} password=${manager.password} / deploy url=${manager.url} username=${manager.username} password=${manager.password} path=/${app.name} war=file:///${dist.home}/${app.name}.war / Note that I also have unpackWARs set to false in server.xml, so that the WAR is left intact. I noticed that when using this setup, Tomcat pulls context.xml out of the WAR, renames it app name.war, and puts it into the %CATALINA_HOME%/conf/Catalina/localhost directory. I just it alone, as it goes away on undeploy. Let me know if this doesn't work for you. Jay -Original Message- From: todd runstein [mailto:[EMAIL PROTECTED] Sent: Thursday, February 05, 2004 4:51 PM To: [EMAIL PROTECTED] Subject: JNDI datasource lost on redeploy I've set up a JNDI datasource on my test server that works just fine (Tomcat=5.0.18, JDK=1.4.1, RedHat=8, M$_SQL=2000). However, each time I recompile and redeploy the application, I lose my connection pool, recieving the Cannot create JDBC driver of class '' for connect URL 'null' error. I have to restart Tomcat to get it working again. This sort of makes sense, since I'm defining the Resource within a Context in server.xml. It seems that I either need to make the resource globally available to every web app, or move the resource definition to within my web app. Unfortunately, I don't know what to move or where to move it or what options might work. Any advice or suggestions? I'm including all the code used to get the connection as it stands now. Again, this currently works up until I try to redeploy the web app. My driver jars (there are 3 for MS SQL) are in $CATALINA_HOME/common/lib server.xml: Context path=/mfgreports docBase=mfgreports debug=5 Resource name=datasource.testtrk.circuits auth=Container type=javax.sql.DataSource / ResourceParams name=datasource.testtrk.circuits parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter . parameter namedriverClassName/name valuecom.microsoft.jdbc.sqlserver.SQLServerDriver/value /parameter parameter nameurl/name valuejdbc:microsoft:sqlserver://testtrk:1433;databasename=Circuits/va lue /parameter /ResourceParams /Context web.xml: resource-ref res-ref-namedatasource.testtrk.circuits/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Code used to get connection: public class JNDIConnection { public static Connection getConnection(String
RE: JNDI datasource lost on redeploy
thanks anyway: it did help me for changing the focus into another possible reason: now I have the META-INF in uppercase. I just changed a setting in winzip and it went ok. But my problem steel remains. The context.xml simply does not execute. Hernani -Original Message- From: todd runstein [mailto:[EMAIL PROTECTED] Sent: sexta-feira, 6 de Fevereiro de 2004 0:50 To: Tomcat Users List Subject: RE: JNDI datasource lost on redeploy Don't know if this is the reason, but this is from the ant manuals war task entry: We regulary receive bug reports that this task is creating the WEB-INF directory, and thus it is our fault your webapp doesn't work. The cause of these complaints lies in WinZip, which turns an all upper-case directory into an all lower case one in a fit of helpfulness. Please check that jar xvf yourwebapp.war shows the same behaviour before filing another report. --- Hernani_Mourao [EMAIL PROTECTED] wrote: Hi there, I have the same problem . . . . But by no means I manage to get the context.xml file processed: some parameters donnot make any change when I check in Admin. I am using W2K and Ant makes meta-inf in lower case. Would that be the problem? I already did every test and nothing seems to work. I have already set unpackWARs to false which improved the way the app is loaded. Any help will be very much appreciated. Thanks, Hernani -Original Message- From: Burgess, Jay S [mailto:[EMAIL PROTECTED] Sent: quinta-feira, 5 de Fevereiro de 2004 23:48 To: Tomcat Users List Subject: RE: JNDI datasource lost on redeploy Having just gone through this headache last week, I can provide a solution that works for me (for TC5 only!). First, create a file called context.xml and put it in a directory called META-INF at the same level in your source hierarchy as WEB-INF. context.xml should contain your Context and Resource definitions, something like: Context path=/proto docBase=proto.war override=true cachingAllowed=true useNaming=true reloadable=false debug=0 Resource name=jdbc/protodb auth=Container type=javax.sql.DataSource / ResourceParams name=jdbc/protodb ... Second, make sure your web.xml file contains the necessary resource-ref details: resource-ref res-ref-namejdbc/protodb/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Third, use the Tomcat Ant tasks to undeploy/deploy your WAR to the appbase directory: undeploy path=/${app.name} url=${manager.url} username=${manager.username} password=${manager.password} / deploy url=${manager.url} username=${manager.username} password=${manager.password} path=/${app.name} war=file:///${dist.home}/${app.name}.war / Note that I also have unpackWARs set to false in server.xml, so that the WAR is left intact. I noticed that when using this setup, Tomcat pulls context.xml out of the WAR, renames it app name.war, and puts it into the %CATALINA_HOME%/conf/Catalina/localhost directory. I just it alone, as it goes away on undeploy. Let me know if this doesn't work for you. Jay -Original Message- From: todd runstein [mailto:[EMAIL PROTECTED] Sent: Thursday, February 05, 2004 4:51 PM To: [EMAIL PROTECTED] Subject: JNDI datasource lost on redeploy I've set up a JNDI datasource on my test server that works just fine (Tomcat=5.0.18, JDK=1.4.1, RedHat=8, M$_SQL=2000). However, each time I recompile and redeploy the application, I lose my connection pool, recieving the Cannot create JDBC driver of class '' for connect URL 'null' error. I have to restart Tomcat to get it working again. This sort of makes sense, since I'm defining the Resource within a Context in server.xml. It seems that I either need to make the resource globally available to every web app, or move the resource definition to within my web app. Unfortunately, I don't know what to move or where to move it or what options might work. Any advice or suggestions? I'm including all the code used to get the connection as it stands now. Again, this currently works up until I try to redeploy the web app. My driver jars (there are 3 for MS SQL) are in $CATALINA_HOME/common/lib server.xml: Context path=/mfgreports docBase=mfgreports debug=5 Resource name=datasource.testtrk.circuits auth=Container type=javax.sql.DataSource / ResourceParams name=datasource.testtrk.circuits parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter . parameter namedriverClassName/name valuecom.microsoft.jdbc.sqlserver.SQLServerDriver/value /parameter parameter nameurl/name valuejdbc:microsoft:sqlserver://testtrk:1433;databasename=Circuits