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 MKW <m....@ru.ac.za> on 2005/04/03 03:36:03 UTC

MySQL and Axis

Does anyone please know the right configuration inside Tomcat's 
server.xml for accessing a MySql database inside an Axis web service?

This is what I've tried inside server.xml:
<Context path="/axis" docBase="axis"
         debug="5" reloadable="true" crossContext="true">

       <Resource name="jdbc/axis" auth="Container" 
type="javax.sql.DataSource"
                maxActive="100" maxIdle="30" maxWait="10000"
                username="XX" password="xxx" 
driverClassName="com.mysql.jdbc.Driver"
 
url="jdbc:mysql://localhost:3306/dbname?autoReconnect=true"/>
  </Context>

With this added to the Axis web.xml:
<description>dbName</description>
   <resource-ref>
       <description>DB Connection</description>
       <res-ref-name>jdbc/axis</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <res-auth>Container</res-auth>
   </resource-ref>

It doesn't work.  Any ideas, please?

Thanks.

Madeleine


Re: MySQL and Axis

Posted by MKW <m....@ru.ac.za>.
Thanks, Axel, for your helpful article.  And apologies to Larry for the 
lack of specificity in my posting! - he was right.  I've now got it all 
up and working - and no exceptions.  BUT something weird is happening 
with the Axis servlet after I've run the program to access the service 
which connects to a MySQL database.  I've checked with the Tomcat log 
open while I try different shutdown configurations.  This happens only 
if I've run the program and has nothing to do with whether MySQL is up 
or down before I close Tomcat.  Tomcat throws the exception I've 
appended to this posting while shutting down.  Why doesn't the Axis 
servlet want to unload? every link to the database (ResultSet, 
Statement, Connection, Context) is closed at the end of my program.

Thanks.

Madeleine

INFO: ContextListener: contextDestroyed()
- Servlet AxisServlet threw unload() exception
javax.servlet.ServletException: Servlet.destroy() for servlet 
AxisServlet threw exception
	at 
org.apache.catalina.core.StandardWrapper.unload(StandardWrapper.java:1306)
	at org.apache.catalina.core.StandardWrapper.stop(StandardWrapper.java:1646)
	at 
org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:892)
	at 
org.apache.catalina.core.StandardContext.removeChild(StandardContext.java:3025)
	at org.apache.catalina.startup.ContextConfig.stop(ContextConfig.java:1011)
	at 
org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:253)
	at 
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
	at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4275)
	at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1063)
	at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1063)
	at org.apache.catalina.core.StandardEngine.stop(StandardEngine.java:445)
	at org.apache.catalina.core.StandardService.stop(StandardService.java:512)
	at org.apache.catalina.core.StandardServer.stop(StandardServer.java:717)
	at org.apache.catalina.startup.Catalina.stop(Catalina.java:586)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:561)
	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.catalina.startup.Bootstrap.start(Bootstrap.java:271)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)

Axel Burwitz wrote:
> MKW wrote:
> 
>> Does anyone please know the right configuration inside Tomcat's 
>> server.xml for accessing a MySql database inside an Axis web service?
>>
>> This is what I've tried inside server.xml:
>> <Context path="/axis" docBase="axis"
>>         debug="5" reloadable="true" crossContext="true">
>>
>>       <Resource name="jdbc/axis" auth="Container" 
>> type="javax.sql.DataSource"
>>                maxActive="100" maxIdle="30" maxWait="10000"
>>                username="XX" password="xxx" 
>> driverClassName="com.mysql.jdbc.Driver"
>>
>> url="jdbc:mysql://localhost:3306/dbname?autoReconnect=true"/>
>>  </Context>
>>
>> With this added to the Axis web.xml:
>> <description>dbName</description>
>>   <resource-ref>
>>       <description>DB Connection</description>
>>       <res-ref-name>jdbc/axis</res-ref-name>
>>       <res-type>javax.sql.DataSource</res-type>
>>       <res-auth>Container</res-auth>
>>   </resource-ref>
>>
>> It doesn't work.  Any ideas, please?
>>
>> Thanks.
>>
>> Madeleine
>>
>>
> 
> Have written a hint how I got it working, and it has helped some people 
> before, so maybe you have a look at it:
> http://www.lug-untermain.de/faqs/sqljava.php
> 
> rgds
> Axel
> 


Re: MySQL and Axis

Posted by Axel Burwitz <ax...@arcor.de>.
MKW wrote:
> Does anyone please know the right configuration inside Tomcat's 
> server.xml for accessing a MySql database inside an Axis web service?
> 
> This is what I've tried inside server.xml:
> <Context path="/axis" docBase="axis"
>         debug="5" reloadable="true" crossContext="true">
> 
>       <Resource name="jdbc/axis" auth="Container" 
> type="javax.sql.DataSource"
>                maxActive="100" maxIdle="30" maxWait="10000"
>                username="XX" password="xxx" 
> driverClassName="com.mysql.jdbc.Driver"
> 
> url="jdbc:mysql://localhost:3306/dbname?autoReconnect=true"/>
>  </Context>
> 
> With this added to the Axis web.xml:
> <description>dbName</description>
>   <resource-ref>
>       <description>DB Connection</description>
>       <res-ref-name>jdbc/axis</res-ref-name>
>       <res-type>javax.sql.DataSource</res-type>
>       <res-auth>Container</res-auth>
>   </resource-ref>
> 
> It doesn't work.  Any ideas, please?
> 
> Thanks.
> 
> Madeleine
> 
> 

Have written a hint how I got it working, and it has helped some people 
before, so maybe you have a look at it:
http://www.lug-untermain.de/faqs/sqljava.php

rgds
Axel

Re: MySQL and Axis

Posted by QM <qm...@brandxdev.net>.
On Sun, Apr 03, 2005 at 03:36:03AM +0200, MKW wrote:
: Does anyone please know the right configuration inside Tomcat's 
: server.xml for accessing a MySql database inside an Axis web service?
: 
: This is what I've tried inside server.xml:
:[snip]

This is really a Tomcat issue -- the container doesn't care whether your
code is run from Axis, directly from a servlet, etc.  =)

Check on the Tomcat m/l.  I follow it regularly and DataSource
configuration is one of the top configuration woes.  Most of the time it
boils down to a typo in server.xml or a misunderstanding of local vs
global resource refs.

Be sure to include your code (relevant portions, at least), your
server.xml, and any errors in your post.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

OT : Re: MySQL and Axis

Posted by "Michael C. Clark" <me...@michaelcclark.com>.
Please see:

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-resources-howto.html

The configuration of a JNDI resource is not related to Axis, it's a
function of the Tomcat container itself.  You are definately on the right
path, but you might try building a simple servlet to test the connection.

You are definately on the right track.

-mcc
> Does anyone please know the right configuration inside Tomcat's
> server.xml for accessing a MySql database inside an Axis web service?
>
> This is what I've tried inside server.xml:
> <Context path="/axis" docBase="axis"
>          debug="5" reloadable="true" crossContext="true">
>
>        <Resource name="jdbc/axis" auth="Container"
> type="javax.sql.DataSource"
>                 maxActive="100" maxIdle="30" maxWait="10000"
>                 username="XX" password="xxx"
> driverClassName="com.mysql.jdbc.Driver"
>
> url="jdbc:mysql://localhost:3306/dbname?autoReconnect=true"/>
>   </Context>
>
> With this added to the Axis web.xml:
> <description>dbName</description>
>    <resource-ref>
>        <description>DB Connection</description>
>        <res-ref-name>jdbc/axis</res-ref-name>
>        <res-type>javax.sql.DataSource</res-type>
>        <res-auth>Container</res-auth>
>    </resource-ref>
>
> It doesn't work.  Any ideas, please?
>
> Thanks.
>
> Madeleine
>



Re: MySQL and Axis

Posted by Larry Meadors <la...@gmail.com>.
Wow.

I think you may have better luck getting an answer to your question if you 
actually ask one.

This message is like going to a mechanic, pointing to your car and saying 
"Umm, it's broke?" and expecting him to know exactly what the problem is.

Can you maybe provide some details?

Larry

On Apr 2, 2005 6:36 PM, MKW <m....@ru.ac.za> wrote:
> 
> Does anyone please know the right configuration inside Tomcat's
> server.xml for accessing a MySql database inside an Axis web service?
> 
> This is what I've tried inside server.xml:
> <Context path="/axis" docBase="axis"
> debug="5" reloadable="true" crossContext="true">
> 
> <Resource name="jdbc/axis" auth="Container"
> type="javax.sql.DataSource"
> maxActive="100" maxIdle="30" maxWait="10000"
> username="XX" password="xxx"
> driverClassName="com.mysql.jdbc.Driver"
> 
> url="jdbc:mysql://localhost:3306/dbname?autoReconnect=true"/>
> </Context>
> 
> With this added to the Axis web.xml:
> <description>dbName</description>
> <resource-ref>
> <description>DB Connection</description>
> <res-ref-name>jdbc/axis</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>
> 
> It doesn't work. Any ideas, please?
> 
> Thanks.
> 
> Madeleine
> 
>