You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Prótár Gábor <pr...@gmail.com> on 2006/09/19 14:08:32 UTC
Tomcat + Axis2 + MySQL
Hello!
I have a problem and I can't find the answer. (list archive, google :-), .)
I am using Tomcat v5.5.17, Axis 2 v1.0, MySQL v5.0.24, MySQL Connector/J
v5.0.3
I tried to configure Tomcat's Datasources but it still not works.
1.: put a context.xml file into this directory: <tomcat install
folder>/webapps/axis2/meta-inf
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Resource
name="jdbc/TestDB"
type="javax.sql.DataSource"
username="wsuser"
password="abc"
driverClassName="com.mysql.jdbc.Driver"
maxIdle="2"
maxWait="5000"
url="jdbc:mysql://localhost:3306/ws?autoReconnect=true"
maxActive="4"/>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>
2.: write new lines to the web.xml file at <tomcat install
folder>/webapps/axis2/web-inf
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/TestDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
3.: use it
Context envContext = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/TestDB");
Connection conn = ds.getConnection();
Statement ins = conn.createStatement();
ins.execute("insert into w(name) values('" + transactions[i].getName() +
"')");
conn.close();
4.: No error, but there is nothing changed in the database. Please help me
solve this problem.
---
Also I have another problem, I can't see error messages from MySQL connector
and when I use System.out.println(); int he webservice code I can't see it
in any log files? (stdout_<timestamp>.log and stderr__<timestamp>.log files
are created by the Tomcat server, but they are only holding information
about loading modules) How can I configure proper logging?
For example:
- Deploying module : addressing-1.0
- Deploying module : soapmonitor-1.0
Retrieving document at ''.
Thanks,
Prótár Gábor
Ps.: sorry for my bad english :-)