You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Matteo Redaelli <ma...@libero.it> on 2009/06/06 11:33:35 UTC
bundle now is "Started" but at runtime I get "SQLException: No
suitable driver"
Thanks for your help
Now I can start my bundle (if and only if bundle wrap vmcn mysql is
installed)
[ 242] [Active ] [ ] [ 60] Spring JDBC (2.5.6)
[ 262] [Active ] [ ] [ 60]
wrap_mvn_mysql_mysql-connector-java_5.1.6 (0)
[ 264] [Active ] [Started] [ 60] A CXF WSDL First OSGi Project
(1.0.0.SNAPSHOT)
But when I test it (the db mysql is up and running) with client.html I get
STATUS: 500
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault>
<faultcode>soap:Server</faultcode><faultstring>Could not get JDBC
Connection; nested exception is java.sql.SQLException: No suitable
driver</faultstring></soap:Fault></soap:Body></soap:Envelope>
for details my project files are
http://www.nabble.com/file/p23900182/test-wsdl-first-osgi-2009-06-06.zip
test-wsdl-first-osgi-2009-06-06.zip
my log/d is
10:25:33,107 | INFO | 14564487@qtp0-1 | PhaseInterceptorChain |
ransport.ChainInitiationObserver 89 | Application has thrown exception,
unwinding now
org.apache.cxf.interceptor.Fault: Could not get JDBC Connection; nested
exception is java.sql.SQLException: No suitable driver
at
org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:148)
at
org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:83)
at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:114)
at
org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:55)
at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:68)
at
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:57)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
at java.util.concurrent.FutureTask.run(FutureTask.java:123)
at
org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
at
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:95)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:89)
at
org.apache.servicemix.cxf.transport.http_osgi.OsgiDestination.doMessage(OsgiDestination.java:83)
at
org.apache.servicemix.cxf.transport.http_osgi.OsgiServlet.invokeDestination(OsgiServlet.java:291)
at
org.apache.servicemix.cxf.transport.http_osgi.OsgiServlet.invoke(OsgiServlet.java:148)
at
org.apache.servicemix.cxf.transport.http_osgi.SpringOsgiServlet.invoke(SpringOsgiServlet.java:48)
at
org.apache.servicemix.cxf.transport.http_osgi.OsgiServlet.doPost(OsgiServlet.java:71)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
at
org.ops4j.pax.web.service.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
at
org.ops4j.pax.web.service.internal.HttpServiceContext.handle(HttpServiceContext.java:108)
at
org.ops4j.pax.web.service.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
at
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:879)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:741)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:213)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)
Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Could
not get JDBC Connection; nested exception is java.sql.SQLException: No
suitable driver
at
org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:82)
at
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:382)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:458)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:466)
at
org.springframework.jdbc.core.JdbcTemplate.queryForList(JdbcTemplate.java:497)
at
org.apache.servicemix.samples.wsdl_first.PersonImpl.getPerson(PersonImpl.java:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:166)
at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:82)
... 33 more
Caused by: java.sql.SQLException: No suitable driver
Please can you help me?
Thanks in advance
Matteo
http://www.redaelli.org/matteo/
Freeman Fang wrote:
>
> Hi,
> You can do it like
> <bean id="person"
> class="org.apache.servicemix.samples.wsdl_first.PersonImpl">
> <property name="dataSource" ref="moodleDB" />
> </bean>
> then in your jaxws:endpoint
> <jaxws:endpoint id="HTTPEndpoint"
> implementor="#person"
> address="/PersonService"
> ...
> This is the way to refer a spring managed-bean in your jaxws:endpoint
> Freeman
>
> Matteo Redaelli wrote:
>> Ciao
>>
>> In beans.xml I have added the info about my db (<bean id="moodleDB" ...)
>>
>> Now where do I have to insert the "dataSource" property I need in class
>> "org.apache.servicemix.samples.wsdl_first.PersonImpl"
>>
>> I would add something like
>>
>> <bean class="org.apache.servicemix.samples.wsdl_first.PersonImpl">
>> <property name="dataSource" ref="moodleDB" />
>> </bean>
>>
>> bit where?
>>
>> Thanks in advanve
>>
>> My beans.xml, generated by maven archetype is
>>
>>
>> <beans xmlns="http://www.springframework.org/schema/beans"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns:jaxws="http://cxf.apache.org/jaxws"
>> xsi:schemaLocation="
>> http://www.springframework.org/schema/beans
>> http://www.springframework.org/schema/beans/spring-beans.xsd
>> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
>> http://www.springframework.org/schema/osgi
>> http://www.springframework.org/schema/osgi/spring-osgi.xsd">
>>
>> <import resource="classpath:META-INF/cxf/cxf.xml" />
>> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
>> <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
>> <import resource="classpath:META-INF/cxf/osgi/cxf-extension-osgi.xml"
>> />
>>
>> <bean id="moodleDB"
>>
>> class="org.springframework.jdbc.datasource.DriverManagerDataSource">
>> <property name="driverClassName"
>> value="com.mysql.jdbc.Driver" />
>> <property name="url"
>> value="jdbc:mysql://localhost:3306/moodle" />
>> <property name="username" value="root" />
>> <property name="password" value="" />
>> </bean>
>>
>> <jaxws:endpoint id="HTTPEndpoint"
>> implementor="org.apache.servicemix.samples.wsdl_first.PersonImpl"
>> address="/PersonService"
>> wsdlLocation="wsdl/person.wsdl"
>> endpointName="e:soap"
>> serviceName="s:PersonService"
>> xmlns:e="http://servicemix.apache.org/samples/wsdl-first"
>> xmlns:s="http://servicemix.apache.org/samples/wsdl-first">
>> </jaxws:endpoint>
>>
>>
>>
>> Matteo Redaelli wrote:
>>
>>> Hello
>>>
>>> In smx4 I'm tring to convert the JBI example cxf-wsdl-first-jdbc
>>> (http://matteoredaelli.wordpress.com/2009/05/30/connecting-to-a-database-with-a-webservice-cxf-deployed-jbi-in-servicemix/)
>>> with a similar OSGI project.
>>>
>>> I created a project using
>>>
>>> mvn archetype:create \
>>> -DarchetypeGroupId=org.apache.servicemix.tooling \
>>> -DarchetypeArtifactId=servicemix-osgi-cxf-wsdl-first-archetype \
>>> -DarchetypeVersion=2008.01-SNAPSHOT \
>>> -DgroupId=com.yourcompany \
>>> -DartifactId=test-wsdl-first-osgi \
>>> -Dversion=1.0-SNAPSHOT \
>>>
>>> -DremoteRepositories=http://people.apache.org/repo/m2-snapshot-repository/
>>>
>>> Than I added osgi wraps for spring-jdnc and mysql with
>>>
>>> osgi/install wrap mvn:org.springframework/spring-jdbc/2.5.6
>>> osgi/install wrap mvn:mysql/mysql-connector-java/5.0.8
>>>
>>> [ 181] [Active ] [ ] [ 60] Spring JDBC (2.5.6)
>>> [ 272] [Active ] [ ] [ 60]
>>> mvn:mysql/mysql-connector-java/5.0.8
>>>
>>> MY changes in pom.xml are:
>>>
>>> <dependency>
>>> <groupId>mysql</groupId>
>>> <artifactId>mysql-connector-java</artifactId>
>>> <version>5.0.8</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>org.springframework</groupId>
>>> <artifactId>spring-jdbc</artifactId>
>>> <version>2.5.6</version>
>>> </dependency>
>>> ...
>>> <Import-Package>
>>> ...
>>> org.springframework.jdbc.datasource,
>>> com.mysql.jdbc, *
>>> </Import-Package>
>>> ...
>>> <DynamicImport-Package>*</DynamicImport-Package>
>>>
>>> MY beans.xml
>>> ...
>>> <bean id="moodleDB"
>>>
>>> class="org.springframework.jdbc.datasource.DriverManagerDataSource">
>>> <property name="driverClassName"
>>> value="com.mysql.jdbc.Driver" />
>>> <property name="url"
>>> value="jdbc:mysql://localhost:3306/moodle" />
>>> <property name="username" value="root" />
>>> <property name="password" value="" />
>>> </bean>
>>> ...
>>>
>>>
>>> Questions:
>>>
>>> 1) how can load properly mysql jar in smx?
>>>
>>> I have the error
>>>
>>> smx@root:/> osgi/start 292
>>> ERROR CommandLineExecutionFailed:
>>> org.apache.geronimo.gshell.command.CommandException:
>>> org.osgi.framework.BundleException: Unresolved constraint in bundle 292:
>>> package; (package=com.mysql.jdbc)
>>>
>>> In a camel tutorial I found
>>>
>>> <feature name="jdbc-driver">
>>> ...
>>>
>>> <bundle>mvn:com.mysql.jdbc/com.springsource.com.mysql.jdbc/5.1.6</bundle>
>>> </feature>
>>>
>>> but osgi/install wrap
>>> mvn:com.mysql.jdbc/com.springsource.com.mysql.jdbc/5.1.6 doesn't work
>>>
>>>
>>> 2) the file beans.xml generated by maven archetype is quite different
>>> from
>>> the one of cxf-wsdl-first. where/how can I add the "property datasource"
>>> ?
>>>
>>> I see
>>>
>>> <jaxws:endpoint id="HTTPEndpoint"
>>> implementor="org.apache.servicemix.samples.wsdl_first.PersonImpl"
>>> address="/PersonService"
>>> wsdlLocation="wsdl/person.wsdl"
>>> endpointName="e:soap"
>>> serviceName="s:PersonService"
>>> xmlns:e="http://servicemix.apache.org/samples/wsdl-first"
>>> xmlns:s="http://servicemix.apache.org/samples/wsdl-first"/>
>>>
>>> Thanks in advance
>>> Matteo
>>>
>>>
>>
>>
>
>
> --
> Freeman Fang
> ------------------------
> Open Source SOA: http://fusesource.com
>
>
>
--
View this message in context: http://www.nabble.com/sample-cxf-wsdl-first-jdbc-as-OSGI-package-tp23820077p23900182.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.