Hi ! :

 First of all : excuse my poor english. Second : I'm trying to set up
a MySQL connection pool on Tomcat 5.5.17 (running over Windows XP) to
connect to a remote DB from a web service running on the Axis 2
deployed in Tomcat. I've read the Tomcat docs and the Tomcat mailing
lists but i've not founded any answers that help me to fix the
problem. I've this in my "conf\server.xml" :


.....
          <Context docBase="axis2" path="C:\Archivos de
programa\Apache Software Foundation\Tomcat 5.5\webapps\axis2"
reloadable="true">

               <Resource auth="Container" driverClassName="
com.mysql.jdbc.Driver" maxActive="100" maxIdle="30" maxWait="10000"
name="java:comp/env/jdbc/DB" password="mypassword"
type="javax.sql.DataSource"
url="jdbc:mysql://remoteaddress.com:3306/db?autoReconnect=true"
username="myname"/>

          </Context>
     </Host>

....


I've this "C:\Archivos de programa\Apache Software Foundation\Tomcat
5.5\webapps\axis2\META-INF\context.xml " file :

<?xml version="1.0" encoding="UTF-8"?>
<Context>

   <WatchedResource>WEB-INF/web.xml</WatchedResource>

     <Resource auth="Container" driverClassName="
com.mysql.jdbc.Driver" maxActive="100" maxIdle="30" maxWait="10000"
name="jdbc/DB" password="mypassword" type="javax.sql.DataSource"
url="jdbc:mysql://remoteaddress.com:3036/db?autoReconnect=true"
username="myname"/>

</Context>

I've these lines in "C:\Archivos de programa\Apache Software
Foundation\Tomcat 5.5\webapps\axis2\WEB-INF\web.xml"

   <resource-ref>
       <description>
           a description
       </description>
       <res-ref-name>
           jdbc/DB
       </res-ref-name>
       <res-type>
           javax.sql.DataSource
       </res-type>
       <res-auth>
           Container
       </res-auth>
   </resource-ref>

 When i call the web service running on Axis 2, after a long time i
get the next Exception message :

Cannot create PoolableConnectionFactory (Server connection failure
during transaction. Due to underlying exception:
'java.net.SocketException: java.net.NoRouteToHostException: No route
to host: connect'.

** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: java.net.NoRouteToHostException: No route to host: connect

STACKTRACE:

java.net.SocketException: java.net.NoRouteToHostException: No route to
host: connect

   at 
com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)

   at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:284)

   at com.mysql.jdbc.Connection.createNewIO(Connection.java :2680)

   at com.mysql.jdbc.Connection.<init>(Connection.java:1485)

   at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)

   at org.apache.tomcat.dbcp.dbcp.DriverConnectionFactory.createConnection
(DriverConnectionFactory.java:37)

   at 
org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:290)

   at org.apache.tomcat.dbcp.dbcp.BasicDataSource.validateConnectionFactory
(BasicDataSource.java:877)

   at 
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:851)

   at 
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)

   at code.prueba.PruebaBD.getUserLogin(PruebaBD.java:20)

   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

   at java.lang.reflect.Method.invoke(Unknown Source)

   at 
org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java
:91)

   at 
org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:39)

   at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:144)

   at 
org.apache.axis2.transport.http.util.RESTUtil.invokeAxisEngine(RESTUtil.java:122)

   at 
org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(RESTUtil.java:116)

   at 
org.apache.axis2.transport.http.AxisServlet$ProcessRESTRequest.processURLRequest
(AxisServlet.java:776)

   at org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:238)

   at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)

   at javax.servlet.http.HttpServlet.service (HttpServlet.java:802)

   at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)

   at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java
:173)

   at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)

   at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)

   at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:126)

   at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)

   at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)

   at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)

   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)

   at 
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection
(Http11BaseProtocol.java:664)

   at 
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)

   at 
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java
:80)

   at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)

   at java.lang.Thread.run(Unknown Source)



** END NESTED EXCEPTION **


Attempted reconnect 3 times. Giving up.)


 I've tried to turn it off the FireWall, but i've got the same
Exception message.  The lines in the web service are :


           Context oContext = new InitialContext();
           DataSource oDataSource = (DataSource)
oContext.lookup("java:comp/env/jdbc/DB");
           Connection oConnection = oDataSource.getConnection();

 I've tried to modify the web service to connect to the DB using the
JDBC Driver directly with :


           Class jdbcDriverClass = Class.forName( "com.mysql.jdbc.Driver" );
           Driver oDriver = (Driver) jdbcDriverClass.newInstance();
           DriverManager.registerDriver(oDriver);
           Connection oConnection =
DriverManager.getConnection("jdbc:mysql://remoteaddress.com:3306/db","myname","mypassword");

 That way i can connect to the remote database without problems. Of
course i've the mysql jar in the Tomcat's "common\lib" directory. But
after many hours of reading and trying and knocking on heaven's door
(hard, with the head!! ;)  i've no idea of what is happening, even
worse... i've no idea of what to do to find the problem. Does anybody
have any idea to help me to discover where is the problem? Many thanks
to anybody who help!!!!

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to