Try: * conf/Catalina/localhost/mywebapp.xml OR * webapps/mywebapp/META-INF/context.xml OR * If you put it in GlobalNamingResources then you have to add a <Resource-Link> to <Context>. See the Configuration documentation.
http://tomcat.apache.org/tomcat-5.5-doc/config/context.html has all the details. On Fri, 2011-09-30 at 06:17 +0300, Arttu Tanner wrote: > OS: Linux / CentOS / 2.6.18-028stab092.1 > Tomcat: 5.5.23 > > I have simple XML-RPC -WebApp, that uses MySQL database. > Currently I have defined the JDBC resource in server.xml inside the > <Host> -tags as follows: > > <Context docBase="mywebapp" path="/mywebapp" reloadable="true" > source="org.eclipse.jst.j2ee.server:mywebapp"> > <Resource name="jdbc/MyDB" > auth="Container" > type="javax.sql.DataSource" > driverClassName="com.mysql.jdbc.Driver" > factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" > url="jdbc:mysql://server.com:3306/db_name" > username="db_username" > password="db_password" > maxActive="20" > maxIdle="10" > maxWait="5" > validationQuery="SELECT 1" > testOnBorrow="TRUE" > testWhileIdle="TRUE" > timeBetweenEvictionRunsMillis="10000" > minEvictableIdleTimeMillis="60000" > /> > </Context> > > In the WebApp the connection is formed like this: > > DataSource ds =(DataSource)ctx.lookup("java:comp/env/jdbc/MyDB"); > Connection conn=ds.getConnection(); > > This works fine, but when resource is defined in server.xml, WebApp > AutoDeploy won't work and even the manager application can't undeploy > it. If I take the <Context> -element out of the server.xml (and put > it elsewhere) AutoDeploy works, but database connections throw: > javax.naming.NameNotFoundException: Name jdbc is not bound in this Context > > I've tried to put the context element in several different files, including: > -webapps/mywebapp/WEB-INF/context.xml > -context.xml in SERVERROOT/conf/ > -server.xml, only the <Resource> -tag in <GlobalNamingResources> -element > > None of these work, and I end up with the same exception. > > There must be a way to get both the MySQL connection and > AutoDeployment at the same time. > Can somebody point me to right direction? > > -Arttu > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org