Hi again David !!! :

 Many thanks again!!!!. I've checked the mysql driver was in Tomcat's
"common/lib" directory... it was. So, i've been reading again the
Tomcat docs a lot of time, trying this, trying that... and finally
i've solved the problem!!!!!!!. The problem was the "name" atribute in
the "Resource" element, I've changed it from "java:comp/env/jdbc/DB"
to "jdbc/DB" and it began to work fine !!!!!!.. yeah!!!!

 I've problems with Axis 2 now, but I can connect to the remote
Database without problems. Many, many thanks again for spending your
time with this problem!!!!!.




2007/7/12, David Smith <[EMAIL PROTECTED]>:
No problem.  One of the typical causes of this error is the <Resource
... /> element is missing or doesn't match what you've declared in
axis2/WEB-INF/web.xml.  In your case it could be there's a completing
<Context ... >...</Context> definition at
conf/Catalina/localhost/axis2.xml?  If so, delete the axis2.xml (or use
it and fix it's declaration) and restart tomcat.

Also be sure your mysql driver jar file is in tomcat's common/lib
directory.  I would think the error would be different if this weren't
in the right place, but it's a good thing to check anyway.... especially
since the direct connect method worked in your original post.

--David

albert quinn wrote:

> Hi David !! :
>
>  Many thanks for your advices. I've tried it. I've dropped the
> context definition in my server.xml (i'd put it there after reading
> this tutorial
> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
>
> in the Tomcat docs), i've fixed the port number in my
> "axis2/META-INF/context.xml file" and dropped the "autoReconnect"
> paramater, adding validationQuery="select 1" to my Resource element.
>
>  After that changes, i've removed the Tomcat logs and reboot Tomcat.
> Then I've  tried the web service, getting this new Exception message :
>
>  Cannot create JDBC driver of class '' for connect URL 'null'
>
>
>  Then I've read the Tomcat logs looking for ideas about what [EMAIL 
PROTECTED]&
> is going wrong with this, but I've not found any information that help
> to discover what's happening. Any new ideas about what's going on or
> about how to find the problem?
>
>  Many thanks again by spending your (sure precious) time with this.
>
>
>
>
>
>
> 2007/7/12, David Smith <[EMAIL PROTECTED]>:
>
>> I'd recommend dropping the context definition in your server.xml.  Under
>> normal conditions you should never have to modify that file except to
>> alter server-wide settings like which ports it listens on.
>>
>> Also looking at your axis2/META-INF/context.xml file, I see the port
>> number is incorrect.
>>
>> Lastly, I would recommend you drop the autoReconnect parameter of your
>> database url and add validationQuery="select 1" to your Resource
>> element.  Autoreconnect is of minimal usefullness and validationQuery
>> can test the db connection before your app attemps to use it.
>>
>> --David
>>
>> albert quinn wrote:
>> > 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]



---------------------------------------------------------------------
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