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: [email protected]
For additional commands, e-mail: [email protected]