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/01 20:49:36 UTC

cxf

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
-- 
View this message in context: http://www.nabble.com/cxf-tp23820077p23820077.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


bundle now is "Started" but at runtime I get "SQLException: No suitable driver"

Posted by Matteo Redaelli <ma...@libero.it>.
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.


Re: datasouce property in beans.xml (cxf-wsdl-first & osgi)

Posted by Freeman Fang <fr...@gmail.com>.
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


datasouce property in beans.xml (cxf-wsdl-first & osgi)

Posted by Matteo Redaelli <ma...@libero.it>.
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
> 

-- 
View this message in context: http://www.nabble.com/sample-cxf-wsdl-first-jdbc-as-OSGI-package-tp23820077p23893731.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: sample cxf-wsdl-first-jdbc as OSGI package

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Ooops sorry, I have requested the same thing :)

Gert is always too quick for me :)

Regards
JB

Gert Vanthienen wrote:
> Matteo,
> 
> Could you do an osgi/headers for the mysql to see what imports it
> requires?  Perhaps that gives us an idea on what constraint it is
> talking about...
> 
> Regards,
> 
> Gert Vanthienen
> ------------------------
> Open Source SOA: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
> 
> 
> 
> 2009/6/1 Matteo Redaelli <ma...@libero.it>:
>> 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
>> --
>> View this message in context: http://www.nabble.com/sample-cxf-wsdl-first-jdbc-as-OSGI-package-tp23820077p23820077.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>

-- 
Jean-Baptiste Onofré (Nanthrax)
BuildProcess/AutoDeploy Project Leader
http://buildprocess.sourceforge.net
jb@nanthrax.net
PGP : 17D4F086

Re: sample cxf-wsdl-first-jdbc as OSGI package

Posted by Gert Vanthienen <ge...@gmail.com>.
Matteo,

Could you do an osgi/headers for the mysql to see what imports it
requires?  Perhaps that gives us an idea on what constraint it is
talking about...

Regards,

Gert Vanthienen
------------------------
Open Source SOA: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/



2009/6/1 Matteo Redaelli <ma...@libero.it>:
>
> 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
> --
> View this message in context: http://www.nabble.com/sample-cxf-wsdl-first-jdbc-as-OSGI-package-tp23820077p23820077.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>

Re: sample cxf-wsdl-first-jdbc as OSGI package

Posted by Matteo Redaelli <ma...@libero.it>.
With "OSGi bundles headers" do U mean my pom.xml? it is the standard one
generated by the mvn archetype with the few changes I wrote  in my initial
message... In any case (
http://www.nabble.com/file/p23822127/test-wsdl-first-osgi.tgz
test-wsdl-first-osgi.tgz )

my POM.XML

                <extensions>true</extensions>
                <configuration>
                    <instructions>
                       
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
                        <Import-Package>
                            javax.jws,
                            javax.wsdl,
                            javax.xml.bind,
                            javax.xml.bind.annotation,
			                javax.xml.namespace,
			                javax.xml.ws,
			                META-INF.cxf,
                            META-INF.cxf.osgi,
                            org.apache.cxf.bus,
                            org.apache.cxf.bus.spring,
                            org.apache.cxf.bus.resource,
                            org.apache.cxf.configuration.spring,
                            org.apache.cxf.resource,
                            org.apache.cxf.jaxws,
                            org.apache.servicemix.cxf.transport.http_osgi,
                            org.springframework.beans.factory.config,
                            org.springframework.jdbc.datasource,
                            com.mysql.jdbc, *
                        </Import-Package>
                        <!-- Update Private Package tag with appropriate
package name -->
                        <Private-Package>
                            org.apache.servicemix.samples.wsdl_first,
                            org.apache.servicemix.samples.wsdl_first.types
                        </Private-Package>
                       
<Require-Bundle>org.apache.cxf.cxf-bundle</Require-Bundle>
                        <DynamicImport-Package>*</DynamicImport-Package>
                    </instructions>
                </configuration>

Other infos

smx@root:/> features/list|grep -i cxf
[uninstalled]  [      4.0.0] examples-cxf-camel-nmr
[uninstalled]  [      4.0.0] examples-cxf-nmr
[installed  ]  [      2.1.4] cxf
[installed  ]  [ 2009.01] servicemix-cxf-bc
[installed  ]  [ 2009.01] servicemix-cxf-se
[installed  ]  [      1.6.0] camel-cxf
[uninstalled]  [      4.0.0] cxf-nmr
[uninstalled]  [      4.0.0] examples-cxf-osgi
[installed  ]  [      4.0.0] cxf-osgi

smx@root:/> osgi/list| grep -i jdbc
[ 164] [Active     ] [       ] [   60] camel-jdbc (1.6.0)
[ 181] [Active     ] [       ] [   60] Spring JDBC (2.5.6)
smx@root:/> osgi/list| grep -i sql 
[ 182] [Active     ] [       ] [   60] camel-sql (1.6.0)
[ 200] [Active     ] [       ] [   60] Apache ServiceMix Bundles:
ibatis-sqlmap-2.3.4.726 (2.3.4.726_1)
[ 272] [Active     ] [       ] [   60] mvn:mysql/mysql-connector-java/5.0.8
smx@root:/> osgi/list| grep -i cxf
[ 111] [Active     ] [       ] [   60] Apache CXF Bundle Jar (2.1.4)
[ 113] [Active     ] [Started] [   60] ServiceMix :: CXF Binding Component
(2009.01)
[ 129] [Active     ] [       ] [   60] Apache CXF Runtime JBI Binding
(2.1.4)
[ 130] [Active     ] [       ] [   60] Apache CXF Runtime JBI Transport
(2.1.4)
[ 131] [Active     ] [Started] [   60] ServiceMix :: CXF Service Engine
(2009.01)
[ 217] [Active     ] [       ] [   60] camel-cxf (1.6.0)
[ 259] [Active     ] [Started] [   60] Apache ServiceMix CXF Transport for
OSGi (4.0.0)
[ 297] [Installed  ] [       ] [   60] A CXF WSDL First OSGi Project
(1.0.0.SNAPSHOT)

my LOG/D
21:37:01,431 | INFO  | Timer-1          | FileMonitor                      |
x.kernel.filemonitor.FileMonitor  394 | Undeploying:
/usr/local/apache-servicemix-4.0.0/deploy/test-wsdl-first-osgi-1.0-SNAPSHOT.jar
21:37:05,720 | INFO  | localShell       | CommandLineExecutorImpl          |
om.shell.CommandLineExecutorImpl   64 | Executing (String): log/d
21:37:05,721 | INFO  | localShell       | CommandLineExecutorImpl          |
om.shell.CommandLineExecutorImpl  104 | Executing (log/d): []
21:38:16,934 | INFO  | Timer-1          | FileMonitor                      |
x.kernel.filemonitor.FileMonitor  374 | Deploying:
/usr/local/apache-servicemix-4.0.0/deploy/test-wsdl-first-osgi-1.0-SNAPSHOT.jar
21:38:16,987 | WARN  | Timer-1          | FileMonitor                      |
x.kernel.filemonitor.FileMonitor  552 | Failed to start bundle:
test-wsdl-first-osgi [297]. Reason: org.osgi.framework.BundleException:
Unresolved constraint in bundle 297: package; (package=com.mysql.jdbc)
org.osgi.framework.BundleException: Unresolved constraint in bundle 297:
package; (package=com.mysql.jdbc)
	at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3059)
	at org.apache.felix.framework.Felix.startBundle(Felix.java:1439)
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:770)
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:751)
	at
org.apache.servicemix.kernel.filemonitor.FileMonitor.refreshPackagesAndStartOrUpdateBundles(FileMonitor.java:549)
	at
org.apache.servicemix.kernel.filemonitor.FileMonitor.onFilesChanged(FileMonitor.java:299)
	at
org.apache.servicemix.kernel.filemonitor.FileMonitor$1.filesChanged(FileMonitor.java:151)
	at
org.apache.servicemix.kernel.filemonitor.Scanner.reportBulkChanges(Scanner.java:431)
	at
org.apache.servicemix.kernel.filemonitor.Scanner.reportDifferences(Scanner.java:327)
	at org.apache.servicemix.kernel.filemonitor.Scanner.scan(Scanner.java:261)
	at org.apache.servicemix.kernel.filemonitor.Scanner$1.run(Scanner.java:221)
	at java.util.TimerThread.mainLoop(Timer.java:512)
	at java.util.TimerThread.run(Timer.java:462)



Jean-Baptiste Onofré wrote:
> 
> Hi Matteo,
> 
> could you send the OSGi bundles headers to check the dependencies ?
> 
> Thanks
> JB
> 
> 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
> 
> -- 
> Jean-Baptiste Onofré (Nanthrax)
> BuildProcess/AutoDeploy Project Leader
> http://buildprocess.sourceforge.net
> jb@nanthrax.net
> PGP : 17D4F086
> 
> 

-- 
View this message in context: http://www.nabble.com/sample-cxf-wsdl-first-jdbc-as-OSGI-package-tp23820077p23822127.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: sample cxf-wsdl-first-jdbc as OSGI package

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Matteo,

could you send the OSGi bundles headers to check the dependencies ?

Thanks
JB

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

-- 
Jean-Baptiste Onofré (Nanthrax)
BuildProcess/AutoDeploy Project Leader
http://buildprocess.sourceforge.net
jb@nanthrax.net
PGP : 17D4F086

Re: sample cxf-wsdl-first-jdbc as OSGI package

Posted by Freeman Fang <fr...@gmail.com>.
Matteo Redaelli wrote:
> I use smx4.0. with a clean smx4.0
>
> osgi/install wrap:mvn:mysql/mysql-connector-java/5.0.8
> osgi/start 128
>
> and it become active but not started.
>
> [ 128] [Active     ] [       ] [   60]
> wrap_mvn_mysql_mysql-connector-java_5.0.8 (0)
>   
"Started" status is for spring dm bundle only, since those two bundle 
here is not spring dm osgi bundle, so "Active" flag already means the 
bundle is ok

> is it enough?
>
> ps. Jbi packaging could be slow but at the moment it is easy how to add
> dependences)
>
>
> Freeman Fang wrote:
>   
>> Hi Matteo,
>> Which smx4 version are you using?
>> I tried with both Apache Servicemix 4.0 release and FUSE ESB 4.1 release 
>> with
>> osgi/install wrap:mvn:mysql/mysql-connector-java/5.0.8
>> But bundle status is
>> [ 158] [Resolved   ] [       ] [   60] 
>> wrap_mvn_mysql_mysql-connector-java_5.0.8 (0)
>> which means it's not started, but from your mail, you mention your 
>> bundle can start like
>> [ 272] [Active ] [ ] [ 60] mvn:mysql/mysql-connector-java/5.0.8
>> I'm wondering how it could be.
>> You can use wrap your normal jar as osgi bundle, but you will have to 
>> have all dependent packages available as bundles in the container 
>> already, I don't think all mysql needed package already available as 
>> bundles.
>> Could you please tell me exactly your process?
>> Freeman
>>
>> Matteo Redaelli wrote:
>>     
>>> I use linux debian. In any case. here is my project in zip file
>>>
>>> http://www.nabble.com/file/p23827756/test-wsdl-first-osgi.zip
>>> test-wsdl-first-osgi.zip 
>>>
>>> Regards
>>> Matteo
>>>
>>>
>>>
>>> Freeman Fang wrote:
>>>   
>>>       
>>>> Hi,
>>>> Somehow I can't extract the test-wsdl-first-osgi.tgz you append on my 
>>>> linux box.
>>>> I guess you are using Mac, right? Would you please append your testcase 
>>>> as zip file?
>>>> Freeman
>>>>
>>>> Matteo Redaelli wrote:
>>>>     
>>>>         
>>>>> Ciao
>>>>>
>>>>> Thanks for you suggestions: I'll look deeply at the links you suggested
>>>>>
>>>>> But in any case I'd like to know howto create a service with
>>>>> servicemix-osgi-cxf-wsdl-first-archetype that can get/put data in a
>>>>> database.
>>>>>
>>>>> what is wrong/missing in my package/smx4?
>>>>>
>>>>> Thanks in advance
>>>>> Matteo
>>>>>
>>>>>
>>>>> Freeman Fang wrote:
>>>>>   
>>>>>       
>>>>>           
>>>>>> Hi,
>>>>>> If you want to port cxf-wsdl-first(bc + se) example to osgi bundle in 
>>>>>> smx4, then you shouldn't use servicemix-osgi-cxf-wsdl-first-archetype, 
>>>>>> since this archetype generate cxf endpoint deployed in smx4 using osgi 
>>>>>> http service transport directly, which means in this case there's no
>>>>>> cxf 
>>>>>> bc + se get involved at all, it's a cxf endpoint deployed in smx4 
>>>>>> which 
>>>>>> can talk directly to outside client.
>>>>>> To port smx3 cxf-wsdl-first example to osgi bundle in smx4, what you 
>>>>>> need do is change the JBI package style(SA+SU) to spring dm enabled
>>>>>> osgi 
>>>>>> bundle package style, Gert already add a wiki[1] to demostrate how to
>>>>>> do 
>>>>>> it with servicemix-bean endpoint, and I'm going to add an example for 
>>>>>> cxf-wsdl-frist using spring dm osgi bundle package very soon, [2]
>>>>>> track 
>>>>>> this issue
>>>>>>
>>>>>> [1]http://cwiki.apache.org/confluence/display/SMX4/Creating+an+OSGi+bundle+for+deploying+JBI+endpoints
>>>>>> [2]https://issues.apache.org/activemq/browse/SMX4-292
>>>>>>
>>>>>> Freeman
>>>>>>
>>>>>> 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
>>>>>>
>>>>>>
>>>>>>
>>>>>>     
>>>>>>         
>>>>>>             
>>>>>   
>>>>>       
>>>>>           
>>>> -- 
>>>> Freeman Fang
>>>> ------------------------
>>>> Open Source SOA: http://fusesource.com
>>>>
>>>>
>>>>
>>>>     
>>>>         
>>>   
>>>       
>> -- 
>> Freeman Fang
>> ------------------------
>> Open Source SOA: http://fusesource.com
>>
>>
>>
>>     
>
>   


-- 
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com


Re: sample cxf-wsdl-first-jdbc as OSGI package

Posted by Matteo Redaelli <ma...@libero.it>.
I use smx4.0. with a clean smx4.0

osgi/install wrap:mvn:mysql/mysql-connector-java/5.0.8
osgi/start 128

and it become active but not started.

[ 128] [Active     ] [       ] [   60]
wrap_mvn_mysql_mysql-connector-java_5.0.8 (0)

is it enough?

ps. Jbi packaging could be slow but at the moment it is easy how to add
dependences)


Freeman Fang wrote:
> 
> Hi Matteo,
> Which smx4 version are you using?
> I tried with both Apache Servicemix 4.0 release and FUSE ESB 4.1 release 
> with
> osgi/install wrap:mvn:mysql/mysql-connector-java/5.0.8
> But bundle status is
> [ 158] [Resolved   ] [       ] [   60] 
> wrap_mvn_mysql_mysql-connector-java_5.0.8 (0)
> which means it's not started, but from your mail, you mention your 
> bundle can start like
> [ 272] [Active ] [ ] [ 60] mvn:mysql/mysql-connector-java/5.0.8
> I'm wondering how it could be.
> You can use wrap your normal jar as osgi bundle, but you will have to 
> have all dependent packages available as bundles in the container 
> already, I don't think all mysql needed package already available as 
> bundles.
> Could you please tell me exactly your process?
> Freeman
> 
> Matteo Redaelli wrote:
>> I use linux debian. In any case. here is my project in zip file
>>
>> http://www.nabble.com/file/p23827756/test-wsdl-first-osgi.zip
>> test-wsdl-first-osgi.zip 
>>
>> Regards
>> Matteo
>>
>>
>>
>> Freeman Fang wrote:
>>   
>>> Hi,
>>> Somehow I can't extract the test-wsdl-first-osgi.tgz you append on my 
>>> linux box.
>>> I guess you are using Mac, right? Would you please append your testcase 
>>> as zip file?
>>> Freeman
>>>
>>> Matteo Redaelli wrote:
>>>     
>>>> Ciao
>>>>
>>>> Thanks for you suggestions: I'll look deeply at the links you suggested
>>>>
>>>> But in any case I'd like to know howto create a service with
>>>> servicemix-osgi-cxf-wsdl-first-archetype that can get/put data in a
>>>> database.
>>>>
>>>> what is wrong/missing in my package/smx4?
>>>>
>>>> Thanks in advance
>>>> Matteo
>>>>
>>>>
>>>> Freeman Fang wrote:
>>>>   
>>>>       
>>>>> Hi,
>>>>> If you want to port cxf-wsdl-first(bc + se) example to osgi bundle in 
>>>>> smx4, then you shouldn't use servicemix-osgi-cxf-wsdl-first-archetype, 
>>>>> since this archetype generate cxf endpoint deployed in smx4 using osgi 
>>>>> http service transport directly, which means in this case there's no
>>>>> cxf 
>>>>> bc + se get involved at all, it's a cxf endpoint deployed in smx4 
>>>>> which 
>>>>> can talk directly to outside client.
>>>>> To port smx3 cxf-wsdl-first example to osgi bundle in smx4, what you 
>>>>> need do is change the JBI package style(SA+SU) to spring dm enabled
>>>>> osgi 
>>>>> bundle package style, Gert already add a wiki[1] to demostrate how to
>>>>> do 
>>>>> it with servicemix-bean endpoint, and I'm going to add an example for 
>>>>> cxf-wsdl-frist using spring dm osgi bundle package very soon, [2]
>>>>> track 
>>>>> this issue
>>>>>
>>>>> [1]http://cwiki.apache.org/confluence/display/SMX4/Creating+an+OSGi+bundle+for+deploying+JBI+endpoints
>>>>> [2]https://issues.apache.org/activemq/browse/SMX4-292
>>>>>
>>>>> Freeman
>>>>>
>>>>> 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
>>>>>
>>>>>
>>>>>
>>>>>     
>>>>>         
>>>>   
>>>>       
>>> -- 
>>> Freeman Fang
>>> ------------------------
>>> Open Source SOA: http://fusesource.com
>>>
>>>
>>>
>>>     
>>
>>   
> 
> 
> -- 
> 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-tp23820077p23840708.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: sample cxf-wsdl-first-jdbc as OSGI package

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Matteo,

If you add MySQL connector into the OSGi bundle as a bundle classpath, 
you should not define it in the Import-Package definition.

The Import-Package definition takes the lead on the bundle classpath. So 
Felix OSGi framework tries to resolve com.mysql.jdbc.* bundle first (and 
so ignore the bundle classpath).

Could you try to remove com.mysql.jdbc from your Import-Package definition ?

Regards
JB

Matteo Redaelli wrote:
> Many thanks for your usefull suggestions. I like very much the possibility to
> use maven dependences (as in jbi packaging)
> 
> BUT i doesn't work. can you do it starting from my zip sample?
> 
> I changed my pom.xml adding (initially only one and finally all your
> suggestions)
> 		<dependency>
> 			<groupId>mysql</groupId>
> 			<artifactId>mysql-connector-java</artifactId>
> 			<version>5.0.8</version>
> 		</dependency>
>                 ...
>                     <instructions>
>                        
> <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
>                         <Bundle-ClassPath>
>                             .,{maven-dependencies}
>                         </Bundle-ClassPath>
>                        
> <Include-Resource>{maven-resources}</Include-Resource> 
>                        
> <Embed-Dependency>mysql-connector-java:scope=runtime|compile</Embed-Dependency> 
>                         <Import-Package>
>                             javax.jws,
>                             javax.wsdl,
>                             javax.xml.bind,
>                             javax.xml.bind.annotation,
> 			                javax.xml.namespace,
> 			                javax.xml.ws,
> 			                META-INF.cxf,
>                             META-INF.cxf.osgi,
>                             org.apache.cxf.bus,
>                             org.apache.cxf.bus.spring,
>                             org.apache.cxf.bus.resource,
>                             org.apache.cxf.configuration.spring,
>                             org.apache.cxf.resource,
>                             org.apache.cxf.jaxws,
>                             org.apache.servicemix.cxf.transport.http_osgi,
>                             org.springframework.beans.factory.config,
>                             org.springframework.jdbc.datasource,
>                             com.mysql.jdbc, *
> 
> then
>   mvn clean install
> 
> But I get
>  | Deploying:
> /usr/local/apache-servicemix-4.0.0/deploy/test-wsdl-first-osgi-1.0-SNAPSHOT.jar
> 10:39:46,788 | WARN  | Timer-1          | FileMonitor                      |
> x.kernel.filemonitor.FileMonitor  552 | Failed to start bundle:
> test-wsdl-first-osgi [305]. Reason: org.osgi.framework.BundleException:
> Unresolved constraint in bundle 305: package; (package=com.mysql.jdbc)
> org.osgi.framework.BundleException: Unresolved constraint in bundle 305:
> package; (package=com.mysql.jdbc)
> 	at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3059)
> 	at org.apache.felix.framework.Felix.startBundle(Felix.java:1439)
> 	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:770)
> 	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:751)
> 	at
> org.apache.servicemix.kernel.filemonitor.FileMonitor.refreshPackagesAndStartOrUpdateBundles(FileMonitor.java:549)
> 	at
> org.apache.servicemix.kernel.filemonitor.FileMonitor.onFilesChanged(FileMonitor.java:299)
> 	at
> org.apache.servicemix.kernel.filemonitor.FileMonitor$1.filesChanged(FileMonitor.java:151)
> 	at
> org.apache.servicemix.kernel.filemonitor.Scanner.reportBulkChanges(Scanner.java:431)
> 	at
> org.apache.servicemix.kernel.filemonitor.Scanner.reportDifferences(Scanner.java:327)
> 	at org.apache.servicemix.kernel.filemonitor.Scanner.scan(Scanner.java:261)
> 	at org.apache.servicemix.kernel.filemonitor.Scanner$1.run(Scanner.java:221)
> 	at java.util.TimerThread.mainLoop(Timer.java:512)
> 	at java.util.TimerThread.run(Timer.java:462)
> 
> 
> my osgi/list
> 
> [ 259] [Active     ] [Started] [   60] Apache ServiceMix CXF Transport for
> OSGi (4.0.0)
> [ 272] [Active     ] [       ] [   60] mvn:mysql/mysql-connector-java/5.0.8
> [ 305] [Installed  ] [       ] [   60] A CXF WSDL First OSGi Project
> (1.0.0.SNAPSHOT)
> 
> what's wrong?
> 
> Jean-Baptiste Onofré wrote:
>> Hi Matteo,
>>
>> In your case, you want more to add several dependencies into your OSGi 
>> bundle.
>>
>> Using the felix bnd maven plugin, you can use:
>> - <Embed-Dependency/> notation. For example, you can use 
>> <Embed-Dependency>mysql-connector:scope=runtime|compile</Embed-Dependency> 
>> where mysql-connector is the artifactId.
>> - for the <Bundle-Classpath/>, you can use directly the directory path 
>> (for example <Bundle-Classpath>.,{maven-dependencies}</Bundle-Classpath>
>> - you can use <Include-Resource/> notation too, like this 
>> <Include-Resource>{maven-resources}</Include-Resource>
>>
>> All is explained here: 
>> http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html
>>
>> Regards
>> JB
>>
>> Matteo Redaelli wrote:
>>> Can "Bundle-Classpath" be used to add a folder where I can add the jars I
>>> want to include?
>>> Please can you show me how should I use it?
>>>
>>> I tried with 
>>>                         <Bundle-ClassPath>
>>>                             .,/home/matteo/tmp/test-wsdl-first-osgi/lib,
>>>                         </Bundle-ClassPath>
>>>
>>> and in 
>>>   /home/matteo/tmp/test-wsdl-first-osgi/lib
>>> I have
>>>   mysql-connector-java-5.0.8.jar
>>>
>>> but I get
>>>
>>> [WARNING] Warning building bundle
>>> com.yourcompany:test-wsdl-first-osgi:bundle:1.0-SNAPSHOT : No sub JAR or
>>> directory /home/matteo/tmp/test-wsdl-first-osgi/lib
>>> [WARNING] Warning building bundle
>>> com.yourcompany:test-wsdl-first-osgi:bundle:1.0-SNAPSHOT : Bundle uses
>>> Require Bundle, this can generate false errors because then not enough
>>> information is available without the required bundles
>>> [ERROR] Error building bundle
>>> com.yourcompany:test-wsdl-first-osgi:bundle:1.0-SNAPSHOT : Cannot find a
>>> file or directory for Bundle-Classpath entry:
>>> /home/matteo/tmp/test-wsdl-first-osgi/lib
>>>
>>> Regards
>>> Matteo
>>>
>>>
>>> Jean-Baptiste Onofré wrote:
>>>> Matteo,
>>>>
>>>> another solution is to add required dependencies into the OSGi bundle
>>>> using:
>>>> Bundle-Classpath:
>>>> notation.
>>>>
>>>> Regards
>>>> JB
>>>>
>>>> Freeman Fang wrote:
>>>>> Hi Matteo,
>>>>> Which smx4 version are you using?
>>>>> I tried with both Apache Servicemix 4.0 release and FUSE ESB 4.1
>>>>> release 
>>>>> with
>>>>> osgi/install wrap:mvn:mysql/mysql-connector-java/5.0.8
>>>>> But bundle status is
>>>>> [ 158] [Resolved   ] [       ] [   60] 
>>>>> wrap_mvn_mysql_mysql-connector-java_5.0.8 (0)
>>>>> which means it's not started, but from your mail, you mention your 
>>>>> bundle can start like
>>>>> [ 272] [Active ] [ ] [ 60] mvn:mysql/mysql-connector-java/5.0.8
>>>>> I'm wondering how it could be.
>>>>> You can use wrap your normal jar as osgi bundle, but you will have to 
>>>>> have all dependent packages available as bundles in the container 
>>>>> already, I don't think all mysql needed package already available as 
>>>>> bundles.
>>>>> Could you please tell me exactly your process?
>>>>> Freeman
>>>>>
>>>>> Matteo Redaelli wrote:
>>>>>> I use linux debian. In any case. here is my project in zip file
>>>>>>
>>>>>> http://www.nabble.com/file/p23827756/test-wsdl-first-osgi.zip
>>>>>> test-wsdl-first-osgi.zip
>>>>>> Regards
>>>>>> Matteo
>>>>>>
>>>>>>
>>>>>>
>>>>>> Freeman Fang wrote:
>>>>>>  
>>>>>>> Hi,
>>>>>>> Somehow I can't extract the test-wsdl-first-osgi.tgz you append on my 
>>>>>>> linux box.
>>>>>>> I guess you are using Mac, right? Would you please append your 
>>>>>>> testcase as zip file?
>>>>>>> Freeman
>>>>>>>
>>>>>>> Matteo Redaelli wrote:
>>>>>>>    
>>>>>>>> Ciao
>>>>>>>>
>>>>>>>> Thanks for you suggestions: I'll look deeply at the links you
>>>>>>>> suggested
>>>>>>>>
>>>>>>>> But in any case I'd like to know howto create a service with
>>>>>>>> servicemix-osgi-cxf-wsdl-first-archetype that can get/put data in a
>>>>>>>> database.
>>>>>>>>
>>>>>>>> what is wrong/missing in my package/smx4?
>>>>>>>>
>>>>>>>> Thanks in advance
>>>>>>>> Matteo
>>>>>>>>
>>>>>>>>
>>>>>>>> Freeman Fang wrote:
>>>>>>>>        
>>>>>>>>> Hi,
>>>>>>>>> If you want to port cxf-wsdl-first(bc + se) example to osgi bundle 
>>>>>>>>> in smx4, then you shouldn't use 
>>>>>>>>> servicemix-osgi-cxf-wsdl-first-archetype, since this archetype 
>>>>>>>>> generate cxf endpoint deployed in smx4 using osgi http service 
>>>>>>>>> transport directly, which means in this case there's no cxf bc + se 
>>>>>>>>> get involved at all, it's a cxf endpoint deployed in smx4  which 
>>>>>>>>> can talk directly to outside client.
>>>>>>>>> To port smx3 cxf-wsdl-first example to osgi bundle in smx4, what 
>>>>>>>>> you need do is change the JBI package style(SA+SU) to spring dm 
>>>>>>>>> enabled osgi bundle package style, Gert already add a wiki[1] to 
>>>>>>>>> demostrate how to do it with servicemix-bean endpoint, and I'm 
>>>>>>>>> going to add an example for cxf-wsdl-frist using spring dm osgi 
>>>>>>>>> bundle package very soon, [2] track this issue
>>>>>>>>>
>>>>>>>>> [1]http://cwiki.apache.org/confluence/display/SMX4/Creating+an+OSGi+bundle+for+deploying+JBI+endpoints 
>>>>>>>>>
>>>>>>>>> [2]https://issues.apache.org/activemq/browse/SMX4-292
>>>>>>>>>
>>>>>>>>> Freeman
>>>>>>>>>
>>>>>>>>> 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
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>             
>>>>>>>>         
>>>>>>> -- 
>>>>>>> Freeman Fang
>>>>>>> ------------------------
>>>>>>> Open Source SOA: http://fusesource.com
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>     
>>>>>>   
>>
> 

Re: sample cxf-wsdl-first-jdbc as OSGI package

Posted by Matteo Redaelli <ma...@libero.it>.
I miss jbi packaging :-)
OSGI is powerful but packaging is still harder to manage. At least for me.
 
Now my pom.xml is like

                    <instructions>
                       
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
                       
<Embed-Dependency>mysql-connector-java:scope=runtime|compile</Embed-Dependency> 
                        <Import-Package>
                            javax.jws,
                            javax.wsdl,
                            javax.xml.bind,
                            javax.xml.bind.annotation,
			                javax.xml.namespace,
			                javax.xml.ws,
			                META-INF.cxf,
                            META-INF.cxf.osgi,
                            org.apache.cxf.bus,
                            org.apache.cxf.bus.spring,
                            org.apache.cxf.bus.resource,
                            org.apache.cxf.configuration.spring,
                            org.apache.cxf.resource,
                            org.apache.cxf.jaxws,
                            org.apache.servicemix.cxf.transport.http_osgi,
                            org.springframework.beans.factory.config,
                            org.springframework.jdbc.datasource
                        </Import-Package>



With <DynamicImport-Package>*</DynamicImport-Package>

I get

org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'org.apache.cxf.wsdl.WSDLManager' defined in OSGi
resource[classpath:META-INF/cxf/cxf.xml|bnd.id=324|bnd.sym=test-wsdl-first-osgi]:
Instantiation of bean failed; nested exception is
org.springframework.beans.BeanInstantiationException: Could not instantiate
bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constructor threw
exception; nested exception is java.lang.ClassCastException:
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl


Without <DynamicImport-Package>*</DynamicImport-Package>

I get

org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'moodleDB' defined in URL
[bundle://322.0:0/META-INF/spring/beans.xml]: Error setting property values;
nested exception is org.springframework.beans.PropertyBatchUpdateException;
nested PropertyAccessExceptions (1) are:
PropertyAccessException 1:
org.springframework.beans.MethodInvocationException: Property
'driverClassName' threw exception; nested exception is
java.lang.IllegalStateException: Could not load JDBC driver class
[com.mysql.jdbc.Driver]


As you showed me, pom.xml can be changed in many places.. I canno t
understand with is the right combiantion of setting...

Please can anybody try to adjust and install properly in smx the sample
archetype project 

  http://www.nabble.com/file/p23827756/test-wsdl-first-osgi.zip?

Thanks in advance

Matteo


Jean-Baptiste Onofré wrote:
> 
> Hi Matteo,
> 
> I think that you haven't yet seen my previous e-mail :)
> 
> No, you should remove com.mysql.jdbc from Import-Package definition.
> 
> Now, you have a ClassCastException. As you have add all maven 
> dependencies in your bundle, maybe you have imported Xerces from your 
> dependencies. Could you check that ?
> 
> In all case, it's better to add only your requirement into the bundle 
> classpath (not all dependencies). So try defining only MySQL connector 
> into the bundle classpath (not all maven dependencies).
> 
> Regards
> JB
> 
> Matteo Redaelli wrote:
>> Do I have to keep " com.mysql.jdbc" inside "<Import-Package>"?
>> 
>> If I remove it, my bundle become active but failed
>> 
>> [ 306] [Active     ] [Failed ] [   60] A CXF WSDL First OSGi Project
>> (1.0.0.SNAPSHOT)
>> 
>> with the followin log/d
>> 
>> 
>> 10:58:18,497 | ERROR | xtenderThread-80 | OsgiBundleXmlApplicationContext 
>> |
>> gatedExecutionApplicationContext  366 | Post refresh error
>> org.springframework.beans.factory.BeanCreationException: Error creating
>> bean
>> with name 'org.apache.cxf.wsdl.WSDLManager' defined in OSGi
>> resource[classpath:META-INF/cxf/cxf.xml|bnd.id=306|bnd.sym=test-wsdl-first-osgi]:
>> Instantiation of bean failed; nested exception is
>> org.springframework.beans.BeanInstantiationException: Could not
>> instantiate
>> bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constructor threw
>> exception; nested exception is java.lang.ClassCastException:
>> com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
>> 	at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883)
>> 	at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839)
>> 	at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
>> 	at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
>> 	at java.security.AccessController.doPrivileged(Native Method)
>> 	at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
>> 	at
>> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
>> 	at
>> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
>> 	at
>> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
>> 	at
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
>> 	at
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
>> 	at
>> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
>> 	at
>> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
>> 	at
>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:68)
>> 	at
>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:343)
>> 	at
>> org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
>> 	at
>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:308)
>> 	at
>> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:138)
>> 	at java.lang.Thread.run(Thread.java:595)
>> Caused by: org.springframework.beans.BeanInstantiationException: Could
>> not
>> instantiate bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]:
>> Constructor
>> threw exception; nested exception is java.lang.ClassCastException:
>> com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
>> 	at
>> org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:115)
>> 	at
>> org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61)
>> 	at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:877)
>> 	... 18 more
>> Caused by: java.lang.ClassCastException:
>> com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
>> 	at
>> javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:98)
>> 	at java.util.XMLUtils.getLoadingDoc(XMLUtils.java:75)
>> 	at java.util.XMLUtils.load(XMLUtils.java:57)
>> 	at java.util.Properties.loadFromXML(Properties.java:701)
>> 	at
>> org.apache.cxf.common.util.PropertiesLoaderUtils.loadAllProperties(PropertiesLoaderUtils.java:71)
>> 	at
>> org.apache.cxf.wsdl11.WSDLManagerImpl.registerInitialExtensions(WSDLManagerImpl.java:224)
>> 	at
>> org.apache.cxf.wsdl11.WSDLManagerImpl.registerInitialExtensions(WSDLManagerImpl.java:219)
>> 	at
>> org.apache.cxf.wsdl11.WSDLManagerImpl.<init>(WSDLManagerImpl.java:109)
>> 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>> 	at
>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>> 	at
>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>> 	at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>> 	at
>> org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100)
>> 	... 20 more
>> 
>> 
>> 
>> Matteo Redaelli wrote:
>>> Many thanks for your usefull suggestions. I like very much the
>>> possibility
>>> to use maven dependences (as in jbi packaging)
>>>
>>> BUT i doesn't work. can you do it starting from my zip sample?
>>>
>>> I changed my pom.xml adding (initially only one and finally all your
>>> suggestions)
>>> 		<dependency>
>>> 			<groupId>mysql</groupId>
>>> 			<artifactId>mysql-connector-java</artifactId>
>>> 			<version>5.0.8</version>
>>> 		</dependency>
>>>                 ...
>>>                     <instructions>
>>>                        
>>> <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
>>>                         <Bundle-ClassPath>
>>>                             .,{maven-dependencies}
>>>                         </Bundle-ClassPath>
>>>                        
>>> <Include-Resource>{maven-resources}</Include-Resource> 
>>>                        
>>> <Embed-Dependency>mysql-connector-java:scope=runtime|compile</Embed-Dependency> 
>>>                         <Import-Package>
>>>                             javax.jws,
>>>                             javax.wsdl,
>>>                             javax.xml.bind,
>>>                             javax.xml.bind.annotation,
>>> 			                javax.xml.namespace,
>>> 			                javax.xml.ws,
>>> 			                META-INF.cxf,
>>>                             META-INF.cxf.osgi,
>>>                             org.apache.cxf.bus,
>>>                             org.apache.cxf.bus.spring,
>>>                             org.apache.cxf.bus.resource,
>>>                             org.apache.cxf.configuration.spring,
>>>                             org.apache.cxf.resource,
>>>                             org.apache.cxf.jaxws,
>>>                            
>>> org.apache.servicemix.cxf.transport.http_osgi,
>>>                             org.springframework.beans.factory.config,
>>>                             org.springframework.jdbc.datasource,
>>>                             com.mysql.jdbc, *
>>>
>>> then
>>>   mvn clean install
>>>
>>> But I get
>>>  | Deploying:
>>> /usr/local/apache-servicemix-4.0.0/deploy/test-wsdl-first-osgi-1.0-SNAPSHOT.jar
>>> 10:39:46,788 | WARN  | Timer-1          | FileMonitor                     
>>> | x.kernel.filemonitor.FileMonitor  552 | Failed to start bundle:
>>> test-wsdl-first-osgi [305]. Reason: org.osgi.framework.BundleException:
>>> Unresolved constraint in bundle 305: package; (package=com.mysql.jdbc)
>>> org.osgi.framework.BundleException: Unresolved constraint in bundle 305:
>>> package; (package=com.mysql.jdbc)
>>> 	at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3059)
>>> 	at org.apache.felix.framework.Felix.startBundle(Felix.java:1439)
>>> 	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:770)
>>> 	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:751)
>>> 	at
>>> org.apache.servicemix.kernel.filemonitor.FileMonitor.refreshPackagesAndStartOrUpdateBundles(FileMonitor.java:549)
>>> 	at
>>> org.apache.servicemix.kernel.filemonitor.FileMonitor.onFilesChanged(FileMonitor.java:299)
>>> 	at
>>> org.apache.servicemix.kernel.filemonitor.FileMonitor$1.filesChanged(FileMonitor.java:151)
>>> 	at
>>> org.apache.servicemix.kernel.filemonitor.Scanner.reportBulkChanges(Scanner.java:431)
>>> 	at
>>> org.apache.servicemix.kernel.filemonitor.Scanner.reportDifferences(Scanner.java:327)
>>> 	at
>>> org.apache.servicemix.kernel.filemonitor.Scanner.scan(Scanner.java:261)
>>> 	at
>>> org.apache.servicemix.kernel.filemonitor.Scanner$1.run(Scanner.java:221)
>>> 	at java.util.TimerThread.mainLoop(Timer.java:512)
>>> 	at java.util.TimerThread.run(Timer.java:462)
>>>
>>>
>>> my osgi/list
>>>
>>> [ 259] [Active     ] [Started] [   60] Apache ServiceMix CXF Transport
>>> for
>>> OSGi (4.0.0)
>>> [ 272] [Active     ] [       ] [   60]
>>> mvn:mysql/mysql-connector-java/5.0.8
>>> [ 305] [Installed  ] [       ] [   60] A CXF WSDL First OSGi Project
>>> (1.0.0.SNAPSHOT)
>>>
>>> what's wrong?
>>>
>>> Jean-Baptiste Onofré wrote:
>>>> Hi Matteo,
>>>>
>>>> In your case, you want more to add several dependencies into your OSGi 
>>>> bundle.
>>>>
>>>> Using the felix bnd maven plugin, you can use:
>>>> - <Embed-Dependency/> notation. For example, you can use 
>>>> <Embed-Dependency>mysql-connector:scope=runtime|compile</Embed-Dependency> 
>>>> where mysql-connector is the artifactId.
>>>> - for the <Bundle-Classpath/>, you can use directly the directory path 
>>>> (for example
>>>> <Bundle-Classpath>.,{maven-dependencies}</Bundle-Classpath>
>>>> - you can use <Include-Resource/> notation too, like this 
>>>> <Include-Resource>{maven-resources}</Include-Resource>
>>>>
>>>> All is explained here: 
>>>> http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html
>>>>
>>>> Regards
>>>> JB
>>>>
>>>> Matteo Redaelli wrote:
>>>>> Can "Bundle-Classpath" be used to add a folder where I can add the
>>>>> jars
>>>>> I
>>>>> want to include?
>>>>> Please can you show me how should I use it?
>>>>>
>>>>> I tried with 
>>>>>                         <Bundle-ClassPath>
>>>>>                            
>>>>> .,/home/matteo/tmp/test-wsdl-first-osgi/lib,
>>>>>                         </Bundle-ClassPath>
>>>>>
>>>>> and in 
>>>>>   /home/matteo/tmp/test-wsdl-first-osgi/lib
>>>>> I have
>>>>>   mysql-connector-java-5.0.8.jar
>>>>>
>>>>> but I get
>>>>>
>>>>> [WARNING] Warning building bundle
>>>>> com.yourcompany:test-wsdl-first-osgi:bundle:1.0-SNAPSHOT : No sub JAR
>>>>> or
>>>>> directory /home/matteo/tmp/test-wsdl-first-osgi/lib
>>>>> [WARNING] Warning building bundle
>>>>> com.yourcompany:test-wsdl-first-osgi:bundle:1.0-SNAPSHOT : Bundle uses
>>>>> Require Bundle, this can generate false errors because then not enough
>>>>> information is available without the required bundles
>>>>> [ERROR] Error building bundle
>>>>> com.yourcompany:test-wsdl-first-osgi:bundle:1.0-SNAPSHOT : Cannot find
>>>>> a
>>>>> file or directory for Bundle-Classpath entry:
>>>>> /home/matteo/tmp/test-wsdl-first-osgi/lib
>>>>>
>>>>> Regards
>>>>> Matteo
>>>>>
>>>>>
>>>>> Jean-Baptiste Onofré wrote:
>>>>>> Matteo,
>>>>>>
>>>>>> another solution is to add required dependencies into the OSGi bundle
>>>>>> using:
>>>>>> Bundle-Classpath:
>>>>>> notation.
>>>>>>
>>>>>> Regards
>>>>>> JB
>>>>>>
>>>>>> Freeman Fang wrote:
>>>>>>> Hi Matteo,
>>>>>>> Which smx4 version are you using?
>>>>>>> I tried with both Apache Servicemix 4.0 release and FUSE ESB 4.1
>>>>>>> release 
>>>>>>> with
>>>>>>> osgi/install wrap:mvn:mysql/mysql-connector-java/5.0.8
>>>>>>> But bundle status is
>>>>>>> [ 158] [Resolved   ] [       ] [   60] 
>>>>>>> wrap_mvn_mysql_mysql-connector-java_5.0.8 (0)
>>>>>>> which means it's not started, but from your mail, you mention your 
>>>>>>> bundle can start like
>>>>>>> [ 272] [Active ] [ ] [ 60] mvn:mysql/mysql-connector-java/5.0.8
>>>>>>> I'm wondering how it could be.
>>>>>>> You can use wrap your normal jar as osgi bundle, but you will have
>>>>>>> to 
>>>>>>> have all dependent packages available as bundles in the container 
>>>>>>> already, I don't think all mysql needed package already available as 
>>>>>>> bundles.
>>>>>>> Could you please tell me exactly your process?
>>>>>>> Freeman
>>>>>>>
>>>>>>> Matteo Redaelli wrote:
>>>>>>>> I use linux debian. In any case. here is my project in zip file
>>>>>>>>
>>>>>>>> http://www.nabble.com/file/p23827756/test-wsdl-first-osgi.zip
>>>>>>>> test-wsdl-first-osgi.zip
>>>>>>>> Regards
>>>>>>>> Matteo
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Freeman Fang wrote:
>>>>>>>>  
>>>>>>>>> Hi,
>>>>>>>>> Somehow I can't extract the test-wsdl-first-osgi.tgz you append on
>>>>>>>>> my 
>>>>>>>>> linux box.
>>>>>>>>> I guess you are using Mac, right? Would you please append your 
>>>>>>>>> testcase as zip file?
>>>>>>>>> Freeman
>>>>>>>>>
>>>>>>>>> Matteo Redaelli wrote:
>>>>>>>>>    
>>>>>>>>>> Ciao
>>>>>>>>>>
>>>>>>>>>> Thanks for you suggestions: I'll look deeply at the links you
>>>>>>>>>> suggested
>>>>>>>>>>
>>>>>>>>>> But in any case I'd like to know howto create a service with
>>>>>>>>>> servicemix-osgi-cxf-wsdl-first-archetype that can get/put data in
>>>>>>>>>> a
>>>>>>>>>> database.
>>>>>>>>>>
>>>>>>>>>> what is wrong/missing in my package/smx4?
>>>>>>>>>>
>>>>>>>>>> Thanks in advance
>>>>>>>>>> Matteo
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Freeman Fang wrote:
>>>>>>>>>>        
>>>>>>>>>>> Hi,
>>>>>>>>>>> If you want to port cxf-wsdl-first(bc + se) example to osgi
>>>>>>>>>>> bundle 
>>>>>>>>>>> in smx4, then you shouldn't use 
>>>>>>>>>>> servicemix-osgi-cxf-wsdl-first-archetype, since this archetype 
>>>>>>>>>>> generate cxf endpoint deployed in smx4 using osgi http service 
>>>>>>>>>>> transport directly, which means in this case there's no cxf bc +
>>>>>>>>>>> se 
>>>>>>>>>>> get involved at all, it's a cxf endpoint deployed in smx4  which 
>>>>>>>>>>> can talk directly to outside client.
>>>>>>>>>>> To port smx3 cxf-wsdl-first example to osgi bundle in smx4, what 
>>>>>>>>>>> you need do is change the JBI package style(SA+SU) to spring dm 
>>>>>>>>>>> enabled osgi bundle package style, Gert already add a wiki[1] to 
>>>>>>>>>>> demostrate how to do it with servicemix-bean endpoint, and I'm 
>>>>>>>>>>> going to add an example for cxf-wsdl-frist using spring dm osgi 
>>>>>>>>>>> bundle package very soon, [2] track this issue
>>>>>>>>>>>
>>>>>>>>>>> [1]http://cwiki.apache.org/confluence/display/SMX4/Creating+an+OSGi+bundle+for+deploying+JBI+endpoints 
>>>>>>>>>>>
>>>>>>>>>>> [2]https://issues.apache.org/activemq/browse/SMX4-292
>>>>>>>>>>>
>>>>>>>>>>> Freeman
>>>>>>>>>>>
>>>>>>>>>>> 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
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>             
>>>>>>>>>>         
>>>>>>>>> -- 
>>>>>>>>> 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-tp23820077p23850708.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: sample cxf-wsdl-first-jdbc as OSGI package

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Matteo,

I think that you haven't yet seen my previous e-mail :)

No, you should remove com.mysql.jdbc from Import-Package definition.

Now, you have a ClassCastException. As you have add all maven 
dependencies in your bundle, maybe you have imported Xerces from your 
dependencies. Could you check that ?

In all case, it's better to add only your requirement into the bundle 
classpath (not all dependencies). So try defining only MySQL connector 
into the bundle classpath (not all maven dependencies).

Regards
JB

Matteo Redaelli wrote:
> Do I have to keep " com.mysql.jdbc" inside "<Import-Package>"?
> 
> If I remove it, my bundle become active but failed
> 
> [ 306] [Active     ] [Failed ] [   60] A CXF WSDL First OSGi Project
> (1.0.0.SNAPSHOT)
> 
> with the followin log/d
> 
> 
> 10:58:18,497 | ERROR | xtenderThread-80 | OsgiBundleXmlApplicationContext  |
> gatedExecutionApplicationContext  366 | Post refresh error
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'org.apache.cxf.wsdl.WSDLManager' defined in OSGi
> resource[classpath:META-INF/cxf/cxf.xml|bnd.id=306|bnd.sym=test-wsdl-first-osgi]:
> Instantiation of bean failed; nested exception is
> org.springframework.beans.BeanInstantiationException: Could not instantiate
> bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constructor threw
> exception; nested exception is java.lang.ClassCastException:
> com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
> 	at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883)
> 	at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839)
> 	at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
> 	at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
> 	at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
> 	at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
> 	at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
> 	at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
> 	at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
> 	at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
> 	at
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
> 	at
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:68)
> 	at
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:343)
> 	at
> org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
> 	at
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:308)
> 	at
> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:138)
> 	at java.lang.Thread.run(Thread.java:595)
> Caused by: org.springframework.beans.BeanInstantiationException: Could not
> instantiate bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constructor
> threw exception; nested exception is java.lang.ClassCastException:
> com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
> 	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:115)
> 	at
> org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61)
> 	at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:877)
> 	... 18 more
> Caused by: java.lang.ClassCastException:
> com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
> 	at
> javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:98)
> 	at java.util.XMLUtils.getLoadingDoc(XMLUtils.java:75)
> 	at java.util.XMLUtils.load(XMLUtils.java:57)
> 	at java.util.Properties.loadFromXML(Properties.java:701)
> 	at
> org.apache.cxf.common.util.PropertiesLoaderUtils.loadAllProperties(PropertiesLoaderUtils.java:71)
> 	at
> org.apache.cxf.wsdl11.WSDLManagerImpl.registerInitialExtensions(WSDLManagerImpl.java:224)
> 	at
> org.apache.cxf.wsdl11.WSDLManagerImpl.registerInitialExtensions(WSDLManagerImpl.java:219)
> 	at org.apache.cxf.wsdl11.WSDLManagerImpl.<init>(WSDLManagerImpl.java:109)
> 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> 	at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> 	at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> 	at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> 	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100)
> 	... 20 more
> 
> 
> 
> Matteo Redaelli wrote:
>> Many thanks for your usefull suggestions. I like very much the possibility
>> to use maven dependences (as in jbi packaging)
>>
>> BUT i doesn't work. can you do it starting from my zip sample?
>>
>> I changed my pom.xml adding (initially only one and finally all your
>> suggestions)
>> 		<dependency>
>> 			<groupId>mysql</groupId>
>> 			<artifactId>mysql-connector-java</artifactId>
>> 			<version>5.0.8</version>
>> 		</dependency>
>>                 ...
>>                     <instructions>
>>                        
>> <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
>>                         <Bundle-ClassPath>
>>                             .,{maven-dependencies}
>>                         </Bundle-ClassPath>
>>                        
>> <Include-Resource>{maven-resources}</Include-Resource> 
>>                        
>> <Embed-Dependency>mysql-connector-java:scope=runtime|compile</Embed-Dependency> 
>>                         <Import-Package>
>>                             javax.jws,
>>                             javax.wsdl,
>>                             javax.xml.bind,
>>                             javax.xml.bind.annotation,
>> 			                javax.xml.namespace,
>> 			                javax.xml.ws,
>> 			                META-INF.cxf,
>>                             META-INF.cxf.osgi,
>>                             org.apache.cxf.bus,
>>                             org.apache.cxf.bus.spring,
>>                             org.apache.cxf.bus.resource,
>>                             org.apache.cxf.configuration.spring,
>>                             org.apache.cxf.resource,
>>                             org.apache.cxf.jaxws,
>>                             org.apache.servicemix.cxf.transport.http_osgi,
>>                             org.springframework.beans.factory.config,
>>                             org.springframework.jdbc.datasource,
>>                             com.mysql.jdbc, *
>>
>> then
>>   mvn clean install
>>
>> But I get
>>  | Deploying:
>> /usr/local/apache-servicemix-4.0.0/deploy/test-wsdl-first-osgi-1.0-SNAPSHOT.jar
>> 10:39:46,788 | WARN  | Timer-1          | FileMonitor                     
>> | x.kernel.filemonitor.FileMonitor  552 | Failed to start bundle:
>> test-wsdl-first-osgi [305]. Reason: org.osgi.framework.BundleException:
>> Unresolved constraint in bundle 305: package; (package=com.mysql.jdbc)
>> org.osgi.framework.BundleException: Unresolved constraint in bundle 305:
>> package; (package=com.mysql.jdbc)
>> 	at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3059)
>> 	at org.apache.felix.framework.Felix.startBundle(Felix.java:1439)
>> 	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:770)
>> 	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:751)
>> 	at
>> org.apache.servicemix.kernel.filemonitor.FileMonitor.refreshPackagesAndStartOrUpdateBundles(FileMonitor.java:549)
>> 	at
>> org.apache.servicemix.kernel.filemonitor.FileMonitor.onFilesChanged(FileMonitor.java:299)
>> 	at
>> org.apache.servicemix.kernel.filemonitor.FileMonitor$1.filesChanged(FileMonitor.java:151)
>> 	at
>> org.apache.servicemix.kernel.filemonitor.Scanner.reportBulkChanges(Scanner.java:431)
>> 	at
>> org.apache.servicemix.kernel.filemonitor.Scanner.reportDifferences(Scanner.java:327)
>> 	at
>> org.apache.servicemix.kernel.filemonitor.Scanner.scan(Scanner.java:261)
>> 	at
>> org.apache.servicemix.kernel.filemonitor.Scanner$1.run(Scanner.java:221)
>> 	at java.util.TimerThread.mainLoop(Timer.java:512)
>> 	at java.util.TimerThread.run(Timer.java:462)
>>
>>
>> my osgi/list
>>
>> [ 259] [Active     ] [Started] [   60] Apache ServiceMix CXF Transport for
>> OSGi (4.0.0)
>> [ 272] [Active     ] [       ] [   60]
>> mvn:mysql/mysql-connector-java/5.0.8
>> [ 305] [Installed  ] [       ] [   60] A CXF WSDL First OSGi Project
>> (1.0.0.SNAPSHOT)
>>
>> what's wrong?
>>
>> Jean-Baptiste Onofré wrote:
>>> Hi Matteo,
>>>
>>> In your case, you want more to add several dependencies into your OSGi 
>>> bundle.
>>>
>>> Using the felix bnd maven plugin, you can use:
>>> - <Embed-Dependency/> notation. For example, you can use 
>>> <Embed-Dependency>mysql-connector:scope=runtime|compile</Embed-Dependency> 
>>> where mysql-connector is the artifactId.
>>> - for the <Bundle-Classpath/>, you can use directly the directory path 
>>> (for example <Bundle-Classpath>.,{maven-dependencies}</Bundle-Classpath>
>>> - you can use <Include-Resource/> notation too, like this 
>>> <Include-Resource>{maven-resources}</Include-Resource>
>>>
>>> All is explained here: 
>>> http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html
>>>
>>> Regards
>>> JB
>>>
>>> Matteo Redaelli wrote:
>>>> Can "Bundle-Classpath" be used to add a folder where I can add the jars
>>>> I
>>>> want to include?
>>>> Please can you show me how should I use it?
>>>>
>>>> I tried with 
>>>>                         <Bundle-ClassPath>
>>>>                             .,/home/matteo/tmp/test-wsdl-first-osgi/lib,
>>>>                         </Bundle-ClassPath>
>>>>
>>>> and in 
>>>>   /home/matteo/tmp/test-wsdl-first-osgi/lib
>>>> I have
>>>>   mysql-connector-java-5.0.8.jar
>>>>
>>>> but I get
>>>>
>>>> [WARNING] Warning building bundle
>>>> com.yourcompany:test-wsdl-first-osgi:bundle:1.0-SNAPSHOT : No sub JAR or
>>>> directory /home/matteo/tmp/test-wsdl-first-osgi/lib
>>>> [WARNING] Warning building bundle
>>>> com.yourcompany:test-wsdl-first-osgi:bundle:1.0-SNAPSHOT : Bundle uses
>>>> Require Bundle, this can generate false errors because then not enough
>>>> information is available without the required bundles
>>>> [ERROR] Error building bundle
>>>> com.yourcompany:test-wsdl-first-osgi:bundle:1.0-SNAPSHOT : Cannot find a
>>>> file or directory for Bundle-Classpath entry:
>>>> /home/matteo/tmp/test-wsdl-first-osgi/lib
>>>>
>>>> Regards
>>>> Matteo
>>>>
>>>>
>>>> Jean-Baptiste Onofré wrote:
>>>>> Matteo,
>>>>>
>>>>> another solution is to add required dependencies into the OSGi bundle
>>>>> using:
>>>>> Bundle-Classpath:
>>>>> notation.
>>>>>
>>>>> Regards
>>>>> JB
>>>>>
>>>>> Freeman Fang wrote:
>>>>>> Hi Matteo,
>>>>>> Which smx4 version are you using?
>>>>>> I tried with both Apache Servicemix 4.0 release and FUSE ESB 4.1
>>>>>> release 
>>>>>> with
>>>>>> osgi/install wrap:mvn:mysql/mysql-connector-java/5.0.8
>>>>>> But bundle status is
>>>>>> [ 158] [Resolved   ] [       ] [   60] 
>>>>>> wrap_mvn_mysql_mysql-connector-java_5.0.8 (0)
>>>>>> which means it's not started, but from your mail, you mention your 
>>>>>> bundle can start like
>>>>>> [ 272] [Active ] [ ] [ 60] mvn:mysql/mysql-connector-java/5.0.8
>>>>>> I'm wondering how it could be.
>>>>>> You can use wrap your normal jar as osgi bundle, but you will have to 
>>>>>> have all dependent packages available as bundles in the container 
>>>>>> already, I don't think all mysql needed package already available as 
>>>>>> bundles.
>>>>>> Could you please tell me exactly your process?
>>>>>> Freeman
>>>>>>
>>>>>> Matteo Redaelli wrote:
>>>>>>> I use linux debian. In any case. here is my project in zip file
>>>>>>>
>>>>>>> http://www.nabble.com/file/p23827756/test-wsdl-first-osgi.zip
>>>>>>> test-wsdl-first-osgi.zip
>>>>>>> Regards
>>>>>>> Matteo
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Freeman Fang wrote:
>>>>>>>  
>>>>>>>> Hi,
>>>>>>>> Somehow I can't extract the test-wsdl-first-osgi.tgz you append on
>>>>>>>> my 
>>>>>>>> linux box.
>>>>>>>> I guess you are using Mac, right? Would you please append your 
>>>>>>>> testcase as zip file?
>>>>>>>> Freeman
>>>>>>>>
>>>>>>>> Matteo Redaelli wrote:
>>>>>>>>    
>>>>>>>>> Ciao
>>>>>>>>>
>>>>>>>>> Thanks for you suggestions: I'll look deeply at the links you
>>>>>>>>> suggested
>>>>>>>>>
>>>>>>>>> But in any case I'd like to know howto create a service with
>>>>>>>>> servicemix-osgi-cxf-wsdl-first-archetype that can get/put data in a
>>>>>>>>> database.
>>>>>>>>>
>>>>>>>>> what is wrong/missing in my package/smx4?
>>>>>>>>>
>>>>>>>>> Thanks in advance
>>>>>>>>> Matteo
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Freeman Fang wrote:
>>>>>>>>>        
>>>>>>>>>> Hi,
>>>>>>>>>> If you want to port cxf-wsdl-first(bc + se) example to osgi bundle 
>>>>>>>>>> in smx4, then you shouldn't use 
>>>>>>>>>> servicemix-osgi-cxf-wsdl-first-archetype, since this archetype 
>>>>>>>>>> generate cxf endpoint deployed in smx4 using osgi http service 
>>>>>>>>>> transport directly, which means in this case there's no cxf bc +
>>>>>>>>>> se 
>>>>>>>>>> get involved at all, it's a cxf endpoint deployed in smx4  which 
>>>>>>>>>> can talk directly to outside client.
>>>>>>>>>> To port smx3 cxf-wsdl-first example to osgi bundle in smx4, what 
>>>>>>>>>> you need do is change the JBI package style(SA+SU) to spring dm 
>>>>>>>>>> enabled osgi bundle package style, Gert already add a wiki[1] to 
>>>>>>>>>> demostrate how to do it with servicemix-bean endpoint, and I'm 
>>>>>>>>>> going to add an example for cxf-wsdl-frist using spring dm osgi 
>>>>>>>>>> bundle package very soon, [2] track this issue
>>>>>>>>>>
>>>>>>>>>> [1]http://cwiki.apache.org/confluence/display/SMX4/Creating+an+OSGi+bundle+for+deploying+JBI+endpoints 
>>>>>>>>>>
>>>>>>>>>> [2]https://issues.apache.org/activemq/browse/SMX4-292
>>>>>>>>>>
>>>>>>>>>> Freeman
>>>>>>>>>>
>>>>>>>>>> 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
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>             
>>>>>>>>>         
>>>>>>>> -- 
>>>>>>>> Freeman Fang
>>>>>>>> ------------------------
>>>>>>>> Open Source SOA: http://fusesource.com
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>     
>>>>>>>   
>>>
>>
> 

Re: sample cxf-wsdl-first-jdbc as OSGI package

Posted by Matteo Redaelli <ma...@libero.it>.
Do I have to keep " com.mysql.jdbc" inside "<Import-Package>"?

If I remove it, my bundle become active but failed

[ 306] [Active     ] [Failed ] [   60] A CXF WSDL First OSGi Project
(1.0.0.SNAPSHOT)

with the followin log/d


10:58:18,497 | ERROR | xtenderThread-80 | OsgiBundleXmlApplicationContext  |
gatedExecutionApplicationContext  366 | Post refresh error
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'org.apache.cxf.wsdl.WSDLManager' defined in OSGi
resource[classpath:META-INF/cxf/cxf.xml|bnd.id=306|bnd.sym=test-wsdl-first-osgi]:
Instantiation of bean failed; nested exception is
org.springframework.beans.BeanInstantiationException: Could not instantiate
bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constructor threw
exception; nested exception is java.lang.ClassCastException:
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
	at java.security.AccessController.doPrivileged(Native Method)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
	at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
	at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
	at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
	at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
	at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:68)
	at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:343)
	at
org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
	at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:308)
	at
org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:138)
	at java.lang.Thread.run(Thread.java:595)
Caused by: org.springframework.beans.BeanInstantiationException: Could not
instantiate bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constructor
threw exception; nested exception is java.lang.ClassCastException:
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:115)
	at
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:877)
	... 18 more
Caused by: java.lang.ClassCastException:
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
	at
javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:98)
	at java.util.XMLUtils.getLoadingDoc(XMLUtils.java:75)
	at java.util.XMLUtils.load(XMLUtils.java:57)
	at java.util.Properties.loadFromXML(Properties.java:701)
	at
org.apache.cxf.common.util.PropertiesLoaderUtils.loadAllProperties(PropertiesLoaderUtils.java:71)
	at
org.apache.cxf.wsdl11.WSDLManagerImpl.registerInitialExtensions(WSDLManagerImpl.java:224)
	at
org.apache.cxf.wsdl11.WSDLManagerImpl.registerInitialExtensions(WSDLManagerImpl.java:219)
	at org.apache.cxf.wsdl11.WSDLManagerImpl.<init>(WSDLManagerImpl.java:109)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100)
	... 20 more



Matteo Redaelli wrote:
> 
> Many thanks for your usefull suggestions. I like very much the possibility
> to use maven dependences (as in jbi packaging)
> 
> BUT i doesn't work. can you do it starting from my zip sample?
> 
> I changed my pom.xml adding (initially only one and finally all your
> suggestions)
> 		<dependency>
> 			<groupId>mysql</groupId>
> 			<artifactId>mysql-connector-java</artifactId>
> 			<version>5.0.8</version>
> 		</dependency>
>                 ...
>                     <instructions>
>                        
> <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
>                         <Bundle-ClassPath>
>                             .,{maven-dependencies}
>                         </Bundle-ClassPath>
>                        
> <Include-Resource>{maven-resources}</Include-Resource> 
>                        
> <Embed-Dependency>mysql-connector-java:scope=runtime|compile</Embed-Dependency> 
>                         <Import-Package>
>                             javax.jws,
>                             javax.wsdl,
>                             javax.xml.bind,
>                             javax.xml.bind.annotation,
> 			                javax.xml.namespace,
> 			                javax.xml.ws,
> 			                META-INF.cxf,
>                             META-INF.cxf.osgi,
>                             org.apache.cxf.bus,
>                             org.apache.cxf.bus.spring,
>                             org.apache.cxf.bus.resource,
>                             org.apache.cxf.configuration.spring,
>                             org.apache.cxf.resource,
>                             org.apache.cxf.jaxws,
>                             org.apache.servicemix.cxf.transport.http_osgi,
>                             org.springframework.beans.factory.config,
>                             org.springframework.jdbc.datasource,
>                             com.mysql.jdbc, *
> 
> then
>   mvn clean install
> 
> But I get
>  | Deploying:
> /usr/local/apache-servicemix-4.0.0/deploy/test-wsdl-first-osgi-1.0-SNAPSHOT.jar
> 10:39:46,788 | WARN  | Timer-1          | FileMonitor                     
> | x.kernel.filemonitor.FileMonitor  552 | Failed to start bundle:
> test-wsdl-first-osgi [305]. Reason: org.osgi.framework.BundleException:
> Unresolved constraint in bundle 305: package; (package=com.mysql.jdbc)
> org.osgi.framework.BundleException: Unresolved constraint in bundle 305:
> package; (package=com.mysql.jdbc)
> 	at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3059)
> 	at org.apache.felix.framework.Felix.startBundle(Felix.java:1439)
> 	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:770)
> 	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:751)
> 	at
> org.apache.servicemix.kernel.filemonitor.FileMonitor.refreshPackagesAndStartOrUpdateBundles(FileMonitor.java:549)
> 	at
> org.apache.servicemix.kernel.filemonitor.FileMonitor.onFilesChanged(FileMonitor.java:299)
> 	at
> org.apache.servicemix.kernel.filemonitor.FileMonitor$1.filesChanged(FileMonitor.java:151)
> 	at
> org.apache.servicemix.kernel.filemonitor.Scanner.reportBulkChanges(Scanner.java:431)
> 	at
> org.apache.servicemix.kernel.filemonitor.Scanner.reportDifferences(Scanner.java:327)
> 	at
> org.apache.servicemix.kernel.filemonitor.Scanner.scan(Scanner.java:261)
> 	at
> org.apache.servicemix.kernel.filemonitor.Scanner$1.run(Scanner.java:221)
> 	at java.util.TimerThread.mainLoop(Timer.java:512)
> 	at java.util.TimerThread.run(Timer.java:462)
> 
> 
> my osgi/list
> 
> [ 259] [Active     ] [Started] [   60] Apache ServiceMix CXF Transport for
> OSGi (4.0.0)
> [ 272] [Active     ] [       ] [   60]
> mvn:mysql/mysql-connector-java/5.0.8
> [ 305] [Installed  ] [       ] [   60] A CXF WSDL First OSGi Project
> (1.0.0.SNAPSHOT)
> 
> what's wrong?
> 
> Jean-Baptiste Onofré wrote:
>> 
>> Hi Matteo,
>> 
>> In your case, you want more to add several dependencies into your OSGi 
>> bundle.
>> 
>> Using the felix bnd maven plugin, you can use:
>> - <Embed-Dependency/> notation. For example, you can use 
>> <Embed-Dependency>mysql-connector:scope=runtime|compile</Embed-Dependency> 
>> where mysql-connector is the artifactId.
>> - for the <Bundle-Classpath/>, you can use directly the directory path 
>> (for example <Bundle-Classpath>.,{maven-dependencies}</Bundle-Classpath>
>> - you can use <Include-Resource/> notation too, like this 
>> <Include-Resource>{maven-resources}</Include-Resource>
>> 
>> All is explained here: 
>> http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html
>> 
>> Regards
>> JB
>> 
>> Matteo Redaelli wrote:
>>> Can "Bundle-Classpath" be used to add a folder where I can add the jars
>>> I
>>> want to include?
>>> Please can you show me how should I use it?
>>> 
>>> I tried with 
>>>                         <Bundle-ClassPath>
>>>                             .,/home/matteo/tmp/test-wsdl-first-osgi/lib,
>>>                         </Bundle-ClassPath>
>>> 
>>> and in 
>>>   /home/matteo/tmp/test-wsdl-first-osgi/lib
>>> I have
>>>   mysql-connector-java-5.0.8.jar
>>> 
>>> but I get
>>> 
>>> [WARNING] Warning building bundle
>>> com.yourcompany:test-wsdl-first-osgi:bundle:1.0-SNAPSHOT : No sub JAR or
>>> directory /home/matteo/tmp/test-wsdl-first-osgi/lib
>>> [WARNING] Warning building bundle
>>> com.yourcompany:test-wsdl-first-osgi:bundle:1.0-SNAPSHOT : Bundle uses
>>> Require Bundle, this can generate false errors because then not enough
>>> information is available without the required bundles
>>> [ERROR] Error building bundle
>>> com.yourcompany:test-wsdl-first-osgi:bundle:1.0-SNAPSHOT : Cannot find a
>>> file or directory for Bundle-Classpath entry:
>>> /home/matteo/tmp/test-wsdl-first-osgi/lib
>>> 
>>> Regards
>>> Matteo
>>> 
>>> 
>>> Jean-Baptiste Onofré wrote:
>>>> Matteo,
>>>>
>>>> another solution is to add required dependencies into the OSGi bundle
>>>> using:
>>>> Bundle-Classpath:
>>>> notation.
>>>>
>>>> Regards
>>>> JB
>>>>
>>>> Freeman Fang wrote:
>>>>> Hi Matteo,
>>>>> Which smx4 version are you using?
>>>>> I tried with both Apache Servicemix 4.0 release and FUSE ESB 4.1
>>>>> release 
>>>>> with
>>>>> osgi/install wrap:mvn:mysql/mysql-connector-java/5.0.8
>>>>> But bundle status is
>>>>> [ 158] [Resolved   ] [       ] [   60] 
>>>>> wrap_mvn_mysql_mysql-connector-java_5.0.8 (0)
>>>>> which means it's not started, but from your mail, you mention your 
>>>>> bundle can start like
>>>>> [ 272] [Active ] [ ] [ 60] mvn:mysql/mysql-connector-java/5.0.8
>>>>> I'm wondering how it could be.
>>>>> You can use wrap your normal jar as osgi bundle, but you will have to 
>>>>> have all dependent packages available as bundles in the container 
>>>>> already, I don't think all mysql needed package already available as 
>>>>> bundles.
>>>>> Could you please tell me exactly your process?
>>>>> Freeman
>>>>>
>>>>> Matteo Redaelli wrote:
>>>>>> I use linux debian. In any case. here is my project in zip file
>>>>>>
>>>>>> http://www.nabble.com/file/p23827756/test-wsdl-first-osgi.zip
>>>>>> test-wsdl-first-osgi.zip
>>>>>> Regards
>>>>>> Matteo
>>>>>>
>>>>>>
>>>>>>
>>>>>> Freeman Fang wrote:
>>>>>>  
>>>>>>> Hi,
>>>>>>> Somehow I can't extract the test-wsdl-first-osgi.tgz you append on
>>>>>>> my 
>>>>>>> linux box.
>>>>>>> I guess you are using Mac, right? Would you please append your 
>>>>>>> testcase as zip file?
>>>>>>> Freeman
>>>>>>>
>>>>>>> Matteo Redaelli wrote:
>>>>>>>    
>>>>>>>> Ciao
>>>>>>>>
>>>>>>>> Thanks for you suggestions: I'll look deeply at the links you
>>>>>>>> suggested
>>>>>>>>
>>>>>>>> But in any case I'd like to know howto create a service with
>>>>>>>> servicemix-osgi-cxf-wsdl-first-archetype that can get/put data in a
>>>>>>>> database.
>>>>>>>>
>>>>>>>> what is wrong/missing in my package/smx4?
>>>>>>>>
>>>>>>>> Thanks in advance
>>>>>>>> Matteo
>>>>>>>>
>>>>>>>>
>>>>>>>> Freeman Fang wrote:
>>>>>>>>        
>>>>>>>>> Hi,
>>>>>>>>> If you want to port cxf-wsdl-first(bc + se) example to osgi bundle 
>>>>>>>>> in smx4, then you shouldn't use 
>>>>>>>>> servicemix-osgi-cxf-wsdl-first-archetype, since this archetype 
>>>>>>>>> generate cxf endpoint deployed in smx4 using osgi http service 
>>>>>>>>> transport directly, which means in this case there's no cxf bc +
>>>>>>>>> se 
>>>>>>>>> get involved at all, it's a cxf endpoint deployed in smx4  which 
>>>>>>>>> can talk directly to outside client.
>>>>>>>>> To port smx3 cxf-wsdl-first example to osgi bundle in smx4, what 
>>>>>>>>> you need do is change the JBI package style(SA+SU) to spring dm 
>>>>>>>>> enabled osgi bundle package style, Gert already add a wiki[1] to 
>>>>>>>>> demostrate how to do it with servicemix-bean endpoint, and I'm 
>>>>>>>>> going to add an example for cxf-wsdl-frist using spring dm osgi 
>>>>>>>>> bundle package very soon, [2] track this issue
>>>>>>>>>
>>>>>>>>> [1]http://cwiki.apache.org/confluence/display/SMX4/Creating+an+OSGi+bundle+for+deploying+JBI+endpoints 
>>>>>>>>>
>>>>>>>>> [2]https://issues.apache.org/activemq/browse/SMX4-292
>>>>>>>>>
>>>>>>>>> Freeman
>>>>>>>>>
>>>>>>>>> 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
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>             
>>>>>>>>         
>>>>>>> -- 
>>>>>>> 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-tp23820077p23848820.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: sample cxf-wsdl-first-jdbc as OSGI package

Posted by Matteo Redaelli <ma...@libero.it>.
Many thanks for your usefull suggestions. I like very much the possibility to
use maven dependences (as in jbi packaging)

BUT i doesn't work. can you do it starting from my zip sample?

I changed my pom.xml adding (initially only one and finally all your
suggestions)
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>5.0.8</version>
		</dependency>
                ...
                    <instructions>
                       
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
                        <Bundle-ClassPath>
                            .,{maven-dependencies}
                        </Bundle-ClassPath>
                       
<Include-Resource>{maven-resources}</Include-Resource> 
                       
<Embed-Dependency>mysql-connector-java:scope=runtime|compile</Embed-Dependency> 
                        <Import-Package>
                            javax.jws,
                            javax.wsdl,
                            javax.xml.bind,
                            javax.xml.bind.annotation,
			                javax.xml.namespace,
			                javax.xml.ws,
			                META-INF.cxf,
                            META-INF.cxf.osgi,
                            org.apache.cxf.bus,
                            org.apache.cxf.bus.spring,
                            org.apache.cxf.bus.resource,
                            org.apache.cxf.configuration.spring,
                            org.apache.cxf.resource,
                            org.apache.cxf.jaxws,
                            org.apache.servicemix.cxf.transport.http_osgi,
                            org.springframework.beans.factory.config,
                            org.springframework.jdbc.datasource,
                            com.mysql.jdbc, *

then
  mvn clean install

But I get
 | Deploying:
/usr/local/apache-servicemix-4.0.0/deploy/test-wsdl-first-osgi-1.0-SNAPSHOT.jar
10:39:46,788 | WARN  | Timer-1          | FileMonitor                      |
x.kernel.filemonitor.FileMonitor  552 | Failed to start bundle:
test-wsdl-first-osgi [305]. Reason: org.osgi.framework.BundleException:
Unresolved constraint in bundle 305: package; (package=com.mysql.jdbc)
org.osgi.framework.BundleException: Unresolved constraint in bundle 305:
package; (package=com.mysql.jdbc)
	at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3059)
	at org.apache.felix.framework.Felix.startBundle(Felix.java:1439)
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:770)
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:751)
	at
org.apache.servicemix.kernel.filemonitor.FileMonitor.refreshPackagesAndStartOrUpdateBundles(FileMonitor.java:549)
	at
org.apache.servicemix.kernel.filemonitor.FileMonitor.onFilesChanged(FileMonitor.java:299)
	at
org.apache.servicemix.kernel.filemonitor.FileMonitor$1.filesChanged(FileMonitor.java:151)
	at
org.apache.servicemix.kernel.filemonitor.Scanner.reportBulkChanges(Scanner.java:431)
	at
org.apache.servicemix.kernel.filemonitor.Scanner.reportDifferences(Scanner.java:327)
	at org.apache.servicemix.kernel.filemonitor.Scanner.scan(Scanner.java:261)
	at org.apache.servicemix.kernel.filemonitor.Scanner$1.run(Scanner.java:221)
	at java.util.TimerThread.mainLoop(Timer.java:512)
	at java.util.TimerThread.run(Timer.java:462)


my osgi/list

[ 259] [Active     ] [Started] [   60] Apache ServiceMix CXF Transport for
OSGi (4.0.0)
[ 272] [Active     ] [       ] [   60] mvn:mysql/mysql-connector-java/5.0.8
[ 305] [Installed  ] [       ] [   60] A CXF WSDL First OSGi Project
(1.0.0.SNAPSHOT)

what's wrong?

Jean-Baptiste Onofré wrote:
> 
> Hi Matteo,
> 
> In your case, you want more to add several dependencies into your OSGi 
> bundle.
> 
> Using the felix bnd maven plugin, you can use:
> - <Embed-Dependency/> notation. For example, you can use 
> <Embed-Dependency>mysql-connector:scope=runtime|compile</Embed-Dependency> 
> where mysql-connector is the artifactId.
> - for the <Bundle-Classpath/>, you can use directly the directory path 
> (for example <Bundle-Classpath>.,{maven-dependencies}</Bundle-Classpath>
> - you can use <Include-Resource/> notation too, like this 
> <Include-Resource>{maven-resources}</Include-Resource>
> 
> All is explained here: 
> http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html
> 
> Regards
> JB
> 
> Matteo Redaelli wrote:
>> Can "Bundle-Classpath" be used to add a folder where I can add the jars I
>> want to include?
>> Please can you show me how should I use it?
>> 
>> I tried with 
>>                         <Bundle-ClassPath>
>>                             .,/home/matteo/tmp/test-wsdl-first-osgi/lib,
>>                         </Bundle-ClassPath>
>> 
>> and in 
>>   /home/matteo/tmp/test-wsdl-first-osgi/lib
>> I have
>>   mysql-connector-java-5.0.8.jar
>> 
>> but I get
>> 
>> [WARNING] Warning building bundle
>> com.yourcompany:test-wsdl-first-osgi:bundle:1.0-SNAPSHOT : No sub JAR or
>> directory /home/matteo/tmp/test-wsdl-first-osgi/lib
>> [WARNING] Warning building bundle
>> com.yourcompany:test-wsdl-first-osgi:bundle:1.0-SNAPSHOT : Bundle uses
>> Require Bundle, this can generate false errors because then not enough
>> information is available without the required bundles
>> [ERROR] Error building bundle
>> com.yourcompany:test-wsdl-first-osgi:bundle:1.0-SNAPSHOT : Cannot find a
>> file or directory for Bundle-Classpath entry:
>> /home/matteo/tmp/test-wsdl-first-osgi/lib
>> 
>> Regards
>> Matteo
>> 
>> 
>> Jean-Baptiste Onofré wrote:
>>> Matteo,
>>>
>>> another solution is to add required dependencies into the OSGi bundle
>>> using:
>>> Bundle-Classpath:
>>> notation.
>>>
>>> Regards
>>> JB
>>>
>>> Freeman Fang wrote:
>>>> Hi Matteo,
>>>> Which smx4 version are you using?
>>>> I tried with both Apache Servicemix 4.0 release and FUSE ESB 4.1
>>>> release 
>>>> with
>>>> osgi/install wrap:mvn:mysql/mysql-connector-java/5.0.8
>>>> But bundle status is
>>>> [ 158] [Resolved   ] [       ] [   60] 
>>>> wrap_mvn_mysql_mysql-connector-java_5.0.8 (0)
>>>> which means it's not started, but from your mail, you mention your 
>>>> bundle can start like
>>>> [ 272] [Active ] [ ] [ 60] mvn:mysql/mysql-connector-java/5.0.8
>>>> I'm wondering how it could be.
>>>> You can use wrap your normal jar as osgi bundle, but you will have to 
>>>> have all dependent packages available as bundles in the container 
>>>> already, I don't think all mysql needed package already available as 
>>>> bundles.
>>>> Could you please tell me exactly your process?
>>>> Freeman
>>>>
>>>> Matteo Redaelli wrote:
>>>>> I use linux debian. In any case. here is my project in zip file
>>>>>
>>>>> http://www.nabble.com/file/p23827756/test-wsdl-first-osgi.zip
>>>>> test-wsdl-first-osgi.zip
>>>>> Regards
>>>>> Matteo
>>>>>
>>>>>
>>>>>
>>>>> Freeman Fang wrote:
>>>>>  
>>>>>> Hi,
>>>>>> Somehow I can't extract the test-wsdl-first-osgi.tgz you append on my 
>>>>>> linux box.
>>>>>> I guess you are using Mac, right? Would you please append your 
>>>>>> testcase as zip file?
>>>>>> Freeman
>>>>>>
>>>>>> Matteo Redaelli wrote:
>>>>>>    
>>>>>>> Ciao
>>>>>>>
>>>>>>> Thanks for you suggestions: I'll look deeply at the links you
>>>>>>> suggested
>>>>>>>
>>>>>>> But in any case I'd like to know howto create a service with
>>>>>>> servicemix-osgi-cxf-wsdl-first-archetype that can get/put data in a
>>>>>>> database.
>>>>>>>
>>>>>>> what is wrong/missing in my package/smx4?
>>>>>>>
>>>>>>> Thanks in advance
>>>>>>> Matteo
>>>>>>>
>>>>>>>
>>>>>>> Freeman Fang wrote:
>>>>>>>        
>>>>>>>> Hi,
>>>>>>>> If you want to port cxf-wsdl-first(bc + se) example to osgi bundle 
>>>>>>>> in smx4, then you shouldn't use 
>>>>>>>> servicemix-osgi-cxf-wsdl-first-archetype, since this archetype 
>>>>>>>> generate cxf endpoint deployed in smx4 using osgi http service 
>>>>>>>> transport directly, which means in this case there's no cxf bc + se 
>>>>>>>> get involved at all, it's a cxf endpoint deployed in smx4  which 
>>>>>>>> can talk directly to outside client.
>>>>>>>> To port smx3 cxf-wsdl-first example to osgi bundle in smx4, what 
>>>>>>>> you need do is change the JBI package style(SA+SU) to spring dm 
>>>>>>>> enabled osgi bundle package style, Gert already add a wiki[1] to 
>>>>>>>> demostrate how to do it with servicemix-bean endpoint, and I'm 
>>>>>>>> going to add an example for cxf-wsdl-frist using spring dm osgi 
>>>>>>>> bundle package very soon, [2] track this issue
>>>>>>>>
>>>>>>>> [1]http://cwiki.apache.org/confluence/display/SMX4/Creating+an+OSGi+bundle+for+deploying+JBI+endpoints 
>>>>>>>>
>>>>>>>> [2]https://issues.apache.org/activemq/browse/SMX4-292
>>>>>>>>
>>>>>>>> Freeman
>>>>>>>>
>>>>>>>> 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
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>             
>>>>>>>         
>>>>>> -- 
>>>>>> 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-tp23820077p23848580.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: sample cxf-wsdl-first-jdbc as OSGI package

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Matteo,

In your case, you want more to add several dependencies into your OSGi 
bundle.

Using the felix bnd maven plugin, you can use:
- <Embed-Dependency/> notation. For example, you can use 
<Embed-Dependency>mysql-connector:scope=runtime|compile</Embed-Dependency> 
where mysql-connector is the artifactId.
- for the <Bundle-Classpath/>, you can use directly the directory path 
(for example <Bundle-Classpath>.,{maven-dependencies}</Bundle-Classpath>
- you can use <Include-Resource/> notation too, like this 
<Include-Resource>{maven-resources}</Include-Resource>

All is explained here: 
http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html

Regards
JB

Matteo Redaelli wrote:
> Can "Bundle-Classpath" be used to add a folder where I can add the jars I
> want to include?
> Please can you show me how should I use it?
> 
> I tried with 
>                         <Bundle-ClassPath>
>                             .,/home/matteo/tmp/test-wsdl-first-osgi/lib,
>                         </Bundle-ClassPath>
> 
> and in 
>   /home/matteo/tmp/test-wsdl-first-osgi/lib
> I have
>   mysql-connector-java-5.0.8.jar
> 
> but I get
> 
> [WARNING] Warning building bundle
> com.yourcompany:test-wsdl-first-osgi:bundle:1.0-SNAPSHOT : No sub JAR or
> directory /home/matteo/tmp/test-wsdl-first-osgi/lib
> [WARNING] Warning building bundle
> com.yourcompany:test-wsdl-first-osgi:bundle:1.0-SNAPSHOT : Bundle uses
> Require Bundle, this can generate false errors because then not enough
> information is available without the required bundles
> [ERROR] Error building bundle
> com.yourcompany:test-wsdl-first-osgi:bundle:1.0-SNAPSHOT : Cannot find a
> file or directory for Bundle-Classpath entry:
> /home/matteo/tmp/test-wsdl-first-osgi/lib
> 
> Regards
> Matteo
> 
> 
> Jean-Baptiste Onofré wrote:
>> Matteo,
>>
>> another solution is to add required dependencies into the OSGi bundle
>> using:
>> Bundle-Classpath:
>> notation.
>>
>> Regards
>> JB
>>
>> Freeman Fang wrote:
>>> Hi Matteo,
>>> Which smx4 version are you using?
>>> I tried with both Apache Servicemix 4.0 release and FUSE ESB 4.1 release 
>>> with
>>> osgi/install wrap:mvn:mysql/mysql-connector-java/5.0.8
>>> But bundle status is
>>> [ 158] [Resolved   ] [       ] [   60] 
>>> wrap_mvn_mysql_mysql-connector-java_5.0.8 (0)
>>> which means it's not started, but from your mail, you mention your 
>>> bundle can start like
>>> [ 272] [Active ] [ ] [ 60] mvn:mysql/mysql-connector-java/5.0.8
>>> I'm wondering how it could be.
>>> You can use wrap your normal jar as osgi bundle, but you will have to 
>>> have all dependent packages available as bundles in the container 
>>> already, I don't think all mysql needed package already available as 
>>> bundles.
>>> Could you please tell me exactly your process?
>>> Freeman
>>>
>>> Matteo Redaelli wrote:
>>>> I use linux debian. In any case. here is my project in zip file
>>>>
>>>> http://www.nabble.com/file/p23827756/test-wsdl-first-osgi.zip
>>>> test-wsdl-first-osgi.zip
>>>> Regards
>>>> Matteo
>>>>
>>>>
>>>>
>>>> Freeman Fang wrote:
>>>>  
>>>>> Hi,
>>>>> Somehow I can't extract the test-wsdl-first-osgi.tgz you append on my 
>>>>> linux box.
>>>>> I guess you are using Mac, right? Would you please append your 
>>>>> testcase as zip file?
>>>>> Freeman
>>>>>
>>>>> Matteo Redaelli wrote:
>>>>>    
>>>>>> Ciao
>>>>>>
>>>>>> Thanks for you suggestions: I'll look deeply at the links you
>>>>>> suggested
>>>>>>
>>>>>> But in any case I'd like to know howto create a service with
>>>>>> servicemix-osgi-cxf-wsdl-first-archetype that can get/put data in a
>>>>>> database.
>>>>>>
>>>>>> what is wrong/missing in my package/smx4?
>>>>>>
>>>>>> Thanks in advance
>>>>>> Matteo
>>>>>>
>>>>>>
>>>>>> Freeman Fang wrote:
>>>>>>        
>>>>>>> Hi,
>>>>>>> If you want to port cxf-wsdl-first(bc + se) example to osgi bundle 
>>>>>>> in smx4, then you shouldn't use 
>>>>>>> servicemix-osgi-cxf-wsdl-first-archetype, since this archetype 
>>>>>>> generate cxf endpoint deployed in smx4 using osgi http service 
>>>>>>> transport directly, which means in this case there's no cxf bc + se 
>>>>>>> get involved at all, it's a cxf endpoint deployed in smx4  which 
>>>>>>> can talk directly to outside client.
>>>>>>> To port smx3 cxf-wsdl-first example to osgi bundle in smx4, what 
>>>>>>> you need do is change the JBI package style(SA+SU) to spring dm 
>>>>>>> enabled osgi bundle package style, Gert already add a wiki[1] to 
>>>>>>> demostrate how to do it with servicemix-bean endpoint, and I'm 
>>>>>>> going to add an example for cxf-wsdl-frist using spring dm osgi 
>>>>>>> bundle package very soon, [2] track this issue
>>>>>>>
>>>>>>> [1]http://cwiki.apache.org/confluence/display/SMX4/Creating+an+OSGi+bundle+for+deploying+JBI+endpoints 
>>>>>>>
>>>>>>> [2]https://issues.apache.org/activemq/browse/SMX4-292
>>>>>>>
>>>>>>> Freeman
>>>>>>>
>>>>>>> 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
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>             
>>>>>>         
>>>>> -- 
>>>>> Freeman Fang
>>>>> ------------------------
>>>>> Open Source SOA: http://fusesource.com
>>>>>
>>>>>
>>>>>
>>>>>     
>>>>   
>>>
>>
> 

Re: sample cxf-wsdl-first-jdbc as OSGI package

Posted by Matteo Redaelli <ma...@libero.it>.
Can "Bundle-Classpath" be used to add a folder where I can add the jars I
want to include?
Please can you show me how should I use it?

I tried with 
                        <Bundle-ClassPath>
                            .,/home/matteo/tmp/test-wsdl-first-osgi/lib,
                        </Bundle-ClassPath>

and in 
  /home/matteo/tmp/test-wsdl-first-osgi/lib
I have
  mysql-connector-java-5.0.8.jar

but I get

[WARNING] Warning building bundle
com.yourcompany:test-wsdl-first-osgi:bundle:1.0-SNAPSHOT : No sub JAR or
directory /home/matteo/tmp/test-wsdl-first-osgi/lib
[WARNING] Warning building bundle
com.yourcompany:test-wsdl-first-osgi:bundle:1.0-SNAPSHOT : Bundle uses
Require Bundle, this can generate false errors because then not enough
information is available without the required bundles
[ERROR] Error building bundle
com.yourcompany:test-wsdl-first-osgi:bundle:1.0-SNAPSHOT : Cannot find a
file or directory for Bundle-Classpath entry:
/home/matteo/tmp/test-wsdl-first-osgi/lib

Regards
Matteo


Jean-Baptiste Onofré wrote:
> 
> Matteo,
> 
> another solution is to add required dependencies into the OSGi bundle
> using:
> Bundle-Classpath:
> notation.
> 
> Regards
> JB
> 
> Freeman Fang wrote:
>> Hi Matteo,
>> Which smx4 version are you using?
>> I tried with both Apache Servicemix 4.0 release and FUSE ESB 4.1 release 
>> with
>> osgi/install wrap:mvn:mysql/mysql-connector-java/5.0.8
>> But bundle status is
>> [ 158] [Resolved   ] [       ] [   60] 
>> wrap_mvn_mysql_mysql-connector-java_5.0.8 (0)
>> which means it's not started, but from your mail, you mention your 
>> bundle can start like
>> [ 272] [Active ] [ ] [ 60] mvn:mysql/mysql-connector-java/5.0.8
>> I'm wondering how it could be.
>> You can use wrap your normal jar as osgi bundle, but you will have to 
>> have all dependent packages available as bundles in the container 
>> already, I don't think all mysql needed package already available as 
>> bundles.
>> Could you please tell me exactly your process?
>> Freeman
>> 
>> Matteo Redaelli wrote:
>>> I use linux debian. In any case. here is my project in zip file
>>>
>>> http://www.nabble.com/file/p23827756/test-wsdl-first-osgi.zip
>>> test-wsdl-first-osgi.zip
>>> Regards
>>> Matteo
>>>
>>>
>>>
>>> Freeman Fang wrote:
>>>  
>>>> Hi,
>>>> Somehow I can't extract the test-wsdl-first-osgi.tgz you append on my 
>>>> linux box.
>>>> I guess you are using Mac, right? Would you please append your 
>>>> testcase as zip file?
>>>> Freeman
>>>>
>>>> Matteo Redaelli wrote:
>>>>    
>>>>> Ciao
>>>>>
>>>>> Thanks for you suggestions: I'll look deeply at the links you
>>>>> suggested
>>>>>
>>>>> But in any case I'd like to know howto create a service with
>>>>> servicemix-osgi-cxf-wsdl-first-archetype that can get/put data in a
>>>>> database.
>>>>>
>>>>> what is wrong/missing in my package/smx4?
>>>>>
>>>>> Thanks in advance
>>>>> Matteo
>>>>>
>>>>>
>>>>> Freeman Fang wrote:
>>>>>        
>>>>>> Hi,
>>>>>> If you want to port cxf-wsdl-first(bc + se) example to osgi bundle 
>>>>>> in smx4, then you shouldn't use 
>>>>>> servicemix-osgi-cxf-wsdl-first-archetype, since this archetype 
>>>>>> generate cxf endpoint deployed in smx4 using osgi http service 
>>>>>> transport directly, which means in this case there's no cxf bc + se 
>>>>>> get involved at all, it's a cxf endpoint deployed in smx4  which 
>>>>>> can talk directly to outside client.
>>>>>> To port smx3 cxf-wsdl-first example to osgi bundle in smx4, what 
>>>>>> you need do is change the JBI package style(SA+SU) to spring dm 
>>>>>> enabled osgi bundle package style, Gert already add a wiki[1] to 
>>>>>> demostrate how to do it with servicemix-bean endpoint, and I'm 
>>>>>> going to add an example for cxf-wsdl-frist using spring dm osgi 
>>>>>> bundle package very soon, [2] track this issue
>>>>>>
>>>>>> [1]http://cwiki.apache.org/confluence/display/SMX4/Creating+an+OSGi+bundle+for+deploying+JBI+endpoints 
>>>>>>
>>>>>> [2]https://issues.apache.org/activemq/browse/SMX4-292
>>>>>>
>>>>>> Freeman
>>>>>>
>>>>>> 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
>>>>>>
>>>>>>
>>>>>>
>>>>>>             
>>>>>         
>>>> -- 
>>>> 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-tp23820077p23847019.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: sample cxf-wsdl-first-jdbc as OSGI package

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Matteo,

another solution is to add required dependencies into the OSGi bundle using:
Bundle-Classpath:
notation.

Regards
JB

Freeman Fang wrote:
> Hi Matteo,
> Which smx4 version are you using?
> I tried with both Apache Servicemix 4.0 release and FUSE ESB 4.1 release 
> with
> osgi/install wrap:mvn:mysql/mysql-connector-java/5.0.8
> But bundle status is
> [ 158] [Resolved   ] [       ] [   60] 
> wrap_mvn_mysql_mysql-connector-java_5.0.8 (0)
> which means it's not started, but from your mail, you mention your 
> bundle can start like
> [ 272] [Active ] [ ] [ 60] mvn:mysql/mysql-connector-java/5.0.8
> I'm wondering how it could be.
> You can use wrap your normal jar as osgi bundle, but you will have to 
> have all dependent packages available as bundles in the container 
> already, I don't think all mysql needed package already available as 
> bundles.
> Could you please tell me exactly your process?
> Freeman
> 
> Matteo Redaelli wrote:
>> I use linux debian. In any case. here is my project in zip file
>>
>> http://www.nabble.com/file/p23827756/test-wsdl-first-osgi.zip
>> test-wsdl-first-osgi.zip
>> Regards
>> Matteo
>>
>>
>>
>> Freeman Fang wrote:
>>  
>>> Hi,
>>> Somehow I can't extract the test-wsdl-first-osgi.tgz you append on my 
>>> linux box.
>>> I guess you are using Mac, right? Would you please append your 
>>> testcase as zip file?
>>> Freeman
>>>
>>> Matteo Redaelli wrote:
>>>    
>>>> Ciao
>>>>
>>>> Thanks for you suggestions: I'll look deeply at the links you suggested
>>>>
>>>> But in any case I'd like to know howto create a service with
>>>> servicemix-osgi-cxf-wsdl-first-archetype that can get/put data in a
>>>> database.
>>>>
>>>> what is wrong/missing in my package/smx4?
>>>>
>>>> Thanks in advance
>>>> Matteo
>>>>
>>>>
>>>> Freeman Fang wrote:
>>>>        
>>>>> Hi,
>>>>> If you want to port cxf-wsdl-first(bc + se) example to osgi bundle 
>>>>> in smx4, then you shouldn't use 
>>>>> servicemix-osgi-cxf-wsdl-first-archetype, since this archetype 
>>>>> generate cxf endpoint deployed in smx4 using osgi http service 
>>>>> transport directly, which means in this case there's no cxf bc + se 
>>>>> get involved at all, it's a cxf endpoint deployed in smx4  which 
>>>>> can talk directly to outside client.
>>>>> To port smx3 cxf-wsdl-first example to osgi bundle in smx4, what 
>>>>> you need do is change the JBI package style(SA+SU) to spring dm 
>>>>> enabled osgi bundle package style, Gert already add a wiki[1] to 
>>>>> demostrate how to do it with servicemix-bean endpoint, and I'm 
>>>>> going to add an example for cxf-wsdl-frist using spring dm osgi 
>>>>> bundle package very soon, [2] track this issue
>>>>>
>>>>> [1]http://cwiki.apache.org/confluence/display/SMX4/Creating+an+OSGi+bundle+for+deploying+JBI+endpoints 
>>>>>
>>>>> [2]https://issues.apache.org/activemq/browse/SMX4-292
>>>>>
>>>>> Freeman
>>>>>
>>>>> 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
>>>>>
>>>>>
>>>>>
>>>>>             
>>>>         
>>> -- 
>>> Freeman Fang
>>> ------------------------
>>> Open Source SOA: http://fusesource.com
>>>
>>>
>>>
>>>     
>>
>>   
> 
> 

Re: sample cxf-wsdl-first-jdbc as OSGI package

Posted by Freeman Fang <fr...@gmail.com>.
Hi Matteo,
Which smx4 version are you using?
I tried with both Apache Servicemix 4.0 release and FUSE ESB 4.1 release 
with
osgi/install wrap:mvn:mysql/mysql-connector-java/5.0.8
But bundle status is
[ 158] [Resolved   ] [       ] [   60] 
wrap_mvn_mysql_mysql-connector-java_5.0.8 (0)
which means it's not started, but from your mail, you mention your 
bundle can start like
[ 272] [Active ] [ ] [ 60] mvn:mysql/mysql-connector-java/5.0.8
I'm wondering how it could be.
You can use wrap your normal jar as osgi bundle, but you will have to 
have all dependent packages available as bundles in the container 
already, I don't think all mysql needed package already available as 
bundles.
Could you please tell me exactly your process?
Freeman

Matteo Redaelli wrote:
> I use linux debian. In any case. here is my project in zip file
>
> http://www.nabble.com/file/p23827756/test-wsdl-first-osgi.zip
> test-wsdl-first-osgi.zip 
>
> Regards
> Matteo
>
>
>
> Freeman Fang wrote:
>   
>> Hi,
>> Somehow I can't extract the test-wsdl-first-osgi.tgz you append on my 
>> linux box.
>> I guess you are using Mac, right? Would you please append your testcase 
>> as zip file?
>> Freeman
>>
>> Matteo Redaelli wrote:
>>     
>>> Ciao
>>>
>>> Thanks for you suggestions: I'll look deeply at the links you suggested
>>>
>>> But in any case I'd like to know howto create a service with
>>> servicemix-osgi-cxf-wsdl-first-archetype that can get/put data in a
>>> database.
>>>
>>> what is wrong/missing in my package/smx4?
>>>
>>> Thanks in advance
>>> Matteo
>>>
>>>
>>> Freeman Fang wrote:
>>>   
>>>       
>>>> Hi,
>>>> If you want to port cxf-wsdl-first(bc + se) example to osgi bundle in 
>>>> smx4, then you shouldn't use servicemix-osgi-cxf-wsdl-first-archetype, 
>>>> since this archetype generate cxf endpoint deployed in smx4 using osgi 
>>>> http service transport directly, which means in this case there's no cxf 
>>>> bc + se get involved at all, it's a cxf endpoint deployed in smx4  which 
>>>> can talk directly to outside client.
>>>> To port smx3 cxf-wsdl-first example to osgi bundle in smx4, what you 
>>>> need do is change the JBI package style(SA+SU) to spring dm enabled osgi 
>>>> bundle package style, Gert already add a wiki[1] to demostrate how to do 
>>>> it with servicemix-bean endpoint, and I'm going to add an example for 
>>>> cxf-wsdl-frist using spring dm osgi bundle package very soon, [2] track 
>>>> this issue
>>>>
>>>> [1]http://cwiki.apache.org/confluence/display/SMX4/Creating+an+OSGi+bundle+for+deploying+JBI+endpoints
>>>> [2]https://issues.apache.org/activemq/browse/SMX4-292
>>>>
>>>> Freeman
>>>>
>>>> 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
>>>>
>>>>
>>>>
>>>>     
>>>>         
>>>   
>>>       
>> -- 
>> Freeman Fang
>> ------------------------
>> Open Source SOA: http://fusesource.com
>>
>>
>>
>>     
>
>   


-- 
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com


Re: sample cxf-wsdl-first-jdbc as OSGI package

Posted by Matteo Redaelli <ma...@libero.it>.
I use linux debian. In any case. here is my project in zip file

http://www.nabble.com/file/p23827756/test-wsdl-first-osgi.zip
test-wsdl-first-osgi.zip 

Regards
Matteo



Freeman Fang wrote:
> 
> Hi,
> Somehow I can't extract the test-wsdl-first-osgi.tgz you append on my 
> linux box.
> I guess you are using Mac, right? Would you please append your testcase 
> as zip file?
> Freeman
> 
> Matteo Redaelli wrote:
>> Ciao
>>
>> Thanks for you suggestions: I'll look deeply at the links you suggested
>>
>> But in any case I'd like to know howto create a service with
>> servicemix-osgi-cxf-wsdl-first-archetype that can get/put data in a
>> database.
>>
>> what is wrong/missing in my package/smx4?
>>
>> Thanks in advance
>> Matteo
>>
>>
>> Freeman Fang wrote:
>>   
>>> Hi,
>>> If you want to port cxf-wsdl-first(bc + se) example to osgi bundle in 
>>> smx4, then you shouldn't use servicemix-osgi-cxf-wsdl-first-archetype, 
>>> since this archetype generate cxf endpoint deployed in smx4 using osgi 
>>> http service transport directly, which means in this case there's no cxf 
>>> bc + se get involved at all, it's a cxf endpoint deployed in smx4  which 
>>> can talk directly to outside client.
>>> To port smx3 cxf-wsdl-first example to osgi bundle in smx4, what you 
>>> need do is change the JBI package style(SA+SU) to spring dm enabled osgi 
>>> bundle package style, Gert already add a wiki[1] to demostrate how to do 
>>> it with servicemix-bean endpoint, and I'm going to add an example for 
>>> cxf-wsdl-frist using spring dm osgi bundle package very soon, [2] track 
>>> this issue
>>>
>>> [1]http://cwiki.apache.org/confluence/display/SMX4/Creating+an+OSGi+bundle+for+deploying+JBI+endpoints
>>> [2]https://issues.apache.org/activemq/browse/SMX4-292
>>>
>>> Freeman
>>>
>>> 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
>>>
>>>
>>>
>>>     
>>
>>   
> 
> 
> -- 
> 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-tp23820077p23827756.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


RE: sample cxf-wsdl-first-jdbc as OSGI package

Posted by Eric Johnson <EM...@progress.com>.
Look at:
[1] http://fusesource.com/docs/esb/4.1/migration/ESBMigrationFSF.html 
[2]
http://fusesource.com/docs/framework/2.2/deploy_guide/DeployJavaOSGiSamp
le.html

[1] migrates a CXF example from JBI to OSGi and [2] is a basic
discussion of what needs to be done to migrate a plain CXF sample to
OSGi (SMX4).

-----Original Message-----
From: Freeman Fang [mailto:freeman.fang@gmail.com] 
Sent: Tuesday, June 02, 2009 3:07 AM
To: users@servicemix.apache.org
Subject: Re: sample cxf-wsdl-first-jdbc as OSGI package

Hi,
Somehow I can't extract the test-wsdl-first-osgi.tgz you append on my
linux box.
I guess you are using Mac, right? Would you please append your testcase
as zip file?
Freeman

Matteo Redaelli wrote:
> Ciao
>
> Thanks for you suggestions: I'll look deeply at the links you 
> suggested
>
> But in any case I'd like to know howto create a service with 
> servicemix-osgi-cxf-wsdl-first-archetype that can get/put data in a 
> database.
>
> what is wrong/missing in my package/smx4?
>
> Thanks in advance
> Matteo
>
>
> Freeman Fang wrote:
>   
>> Hi,
>> If you want to port cxf-wsdl-first(bc + se) example to osgi bundle in

>> smx4, then you shouldn't use 
>> servicemix-osgi-cxf-wsdl-first-archetype,
>> since this archetype generate cxf endpoint deployed in smx4 using 
>> osgi http service transport directly, which means in this case 
>> there's no cxf bc + se get involved at all, it's a cxf endpoint 
>> deployed in smx4  which can talk directly to outside client.
>> To port smx3 cxf-wsdl-first example to osgi bundle in smx4, what you 
>> need do is change the JBI package style(SA+SU) to spring dm enabled 
>> osgi bundle package style, Gert already add a wiki[1] to demostrate 
>> how to do it with servicemix-bean endpoint, and I'm going to add an 
>> example for cxf-wsdl-frist using spring dm osgi bundle package very 
>> soon, [2] track this issue
>>
>> [1]http://cwiki.apache.org/confluence/display/SMX4/Creating+an+OSGi+b
>> undle+for+deploying+JBI+endpoints
>> [2]https://issues.apache.org/activemq/browse/SMX4-292
>>
>> Freeman
>>
>> 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-data
>>> base-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-repos
>>> itory/
>>>
>>> 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
>>
>>
>>
>>     
>
>   


--
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com


Re: sample cxf-wsdl-first-jdbc as OSGI package

Posted by Freeman Fang <fr...@gmail.com>.
Hi,
Somehow I can't extract the test-wsdl-first-osgi.tgz you append on my 
linux box.
I guess you are using Mac, right? Would you please append your testcase 
as zip file?
Freeman

Matteo Redaelli wrote:
> Ciao
>
> Thanks for you suggestions: I'll look deeply at the links you suggested
>
> But in any case I'd like to know howto create a service with
> servicemix-osgi-cxf-wsdl-first-archetype that can get/put data in a
> database.
>
> what is wrong/missing in my package/smx4?
>
> Thanks in advance
> Matteo
>
>
> Freeman Fang wrote:
>   
>> Hi,
>> If you want to port cxf-wsdl-first(bc + se) example to osgi bundle in 
>> smx4, then you shouldn't use servicemix-osgi-cxf-wsdl-first-archetype, 
>> since this archetype generate cxf endpoint deployed in smx4 using osgi 
>> http service transport directly, which means in this case there's no cxf 
>> bc + se get involved at all, it's a cxf endpoint deployed in smx4  which 
>> can talk directly to outside client.
>> To port smx3 cxf-wsdl-first example to osgi bundle in smx4, what you 
>> need do is change the JBI package style(SA+SU) to spring dm enabled osgi 
>> bundle package style, Gert already add a wiki[1] to demostrate how to do 
>> it with servicemix-bean endpoint, and I'm going to add an example for 
>> cxf-wsdl-frist using spring dm osgi bundle package very soon, [2] track 
>> this issue
>>
>> [1]http://cwiki.apache.org/confluence/display/SMX4/Creating+an+OSGi+bundle+for+deploying+JBI+endpoints
>> [2]https://issues.apache.org/activemq/browse/SMX4-292
>>
>> Freeman
>>
>> 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
>>
>>
>>
>>     
>
>   


-- 
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com


Re: sample cxf-wsdl-first-jdbc as OSGI package

Posted by Matteo Redaelli <ma...@libero.it>.
Ciao

Thanks for you suggestions: I'll look deeply at the links you suggested

But in any case I'd like to know howto create a service with
servicemix-osgi-cxf-wsdl-first-archetype that can get/put data in a
database.

what is wrong/missing in my package/smx4?

Thanks in advance
Matteo


Freeman Fang wrote:
> 
> Hi,
> If you want to port cxf-wsdl-first(bc + se) example to osgi bundle in 
> smx4, then you shouldn't use servicemix-osgi-cxf-wsdl-first-archetype, 
> since this archetype generate cxf endpoint deployed in smx4 using osgi 
> http service transport directly, which means in this case there's no cxf 
> bc + se get involved at all, it's a cxf endpoint deployed in smx4  which 
> can talk directly to outside client.
> To port smx3 cxf-wsdl-first example to osgi bundle in smx4, what you 
> need do is change the JBI package style(SA+SU) to spring dm enabled osgi 
> bundle package style, Gert already add a wiki[1] to demostrate how to do 
> it with servicemix-bean endpoint, and I'm going to add an example for 
> cxf-wsdl-frist using spring dm osgi bundle package very soon, [2] track 
> this issue
> 
> [1]http://cwiki.apache.org/confluence/display/SMX4/Creating+an+OSGi+bundle+for+deploying+JBI+endpoints
> [2]https://issues.apache.org/activemq/browse/SMX4-292
> 
> Freeman
> 
> 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-tp23820077p23827321.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: sample cxf-wsdl-first-jdbc as OSGI package

Posted by Freeman Fang <fr...@gmail.com>.
Hi,
If you want to port cxf-wsdl-first(bc + se) example to osgi bundle in 
smx4, then you shouldn't use servicemix-osgi-cxf-wsdl-first-archetype, 
since this archetype generate cxf endpoint deployed in smx4 using osgi 
http service transport directly, which means in this case there's no cxf 
bc + se get involved at all, it's a cxf endpoint deployed in smx4  which 
can talk directly to outside client.
To port smx3 cxf-wsdl-first example to osgi bundle in smx4, what you 
need do is change the JBI package style(SA+SU) to spring dm enabled osgi 
bundle package style, Gert already add a wiki[1] to demostrate how to do 
it with servicemix-bean endpoint, and I'm going to add an example for 
cxf-wsdl-frist using spring dm osgi bundle package very soon, [2] track 
this issue

[1]http://cwiki.apache.org/confluence/display/SMX4/Creating+an+OSGi+bundle+for+deploying+JBI+endpoints
[2]https://issues.apache.org/activemq/browse/SMX4-292

Freeman

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