Hello,
I am using existing example apache-servicemix-5.4.0\examples\cxf\cxf-osgi to
create simple cxf web service.
I have modified above example and added my own custom service code in that
with all its dependencies installed in service mix using features.xml file.
I have modified org.apache.servicemix.examples.cxf.HelloWorldImpl as below
import com.teamcenter.clientx.Session;
import com.teamcenter.soa.client.model.ModelObject;
@WebService(endpointInterface =
"org.apache.servicemix.examples.cxf.HelloWorld")
public class HelloWorldImpl implements HelloWorld {
public String sayHi(String text) {
// Make connection with Teamcenter.
// If I remove below line web service works fine.
*Session s = new Session("http://localhost/tci030/");*
return "Hello buddy1 " + text;
}
Class "Session" make use of external dependencies jars API to make
connection with external application called Teamcenter.
Below is my pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.servicemix.examples</groupId>
<artifactId>cxf</artifactId>
<version>5.4.0</version>
</parent>
<artifactId>cxf-osgi</artifactId>
<packaging>bundle</packaging>
<name>Apache ServiceMix :: Examples :: CXF OSGi</name>
<description>CXF example using OSGi instead of JBI</description>
<dependencies>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-ws-metadata_2.0_spec</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-security</artifactId>
</dependency>
<dependency>
<groupId>com.teamcenter</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>com.teamcenter</groupId>
<artifactId>TcSoaClient_8000.3.0</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.teamcenter</groupId>
<artifactId>TcSoaCommon_8000.3.0</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.teamcenter</groupId>
<artifactId>xerces</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.teamcenter</groupId>
<artifactId>xercesImpl</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.teamcenter</groupId>
<artifactId>xml-apis</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Description>${project.description}</Bundle-Description>
<Import-Package>
javax.jws,
javax.wsdl,
javax.xml.namespace,
org.springframework.beans.factory.config,
*
</Import-Package>
<Export-Package>
org.apache.servicemix.examples.cxf
</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
Spring beans.xml
<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">
<jaxws:endpoint id="helloWorld"
implementor="org.apache.servicemix.examples.cxf.HelloWorldImpl"
address="/HelloWorld">
</jaxws:endpoint>
</beans>
I am installing this cxf-osgi example in servicemix using below command.
TThis command get executed successfully.
*features:install examples-cxf-osgi*
Then in browser I can see deployed web service
<http://servicemix.396122.n5.nabble.com/file/n5722703/cxf-osgi_webservice.png>
Then using soapUI I am accessing this web service wsdl, however in
servicemix log file I am getting below exception .
13:19:45,731 | WARN | /cxf/HelloWorld | PhaseInterceptorChain |
139 - org.apache.cxf.cxf-core - 3.0.2 | Application
{http://cxf.examples.servicemix.apache.org/}HelloWorldImplService#{http://cxf.examples.servicemix.apache.org/}sayHi
has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault:
javax/xml/datatype/DatatypeConfigurationException
at
org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:163)[139:org.apache.cxf.cxf-core:3.0.2]
at
org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:267)[151:org.apache.cxf.cxf-rt-frontend-jaxws:3.0.2]
at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:129)[139:org.apache.cxf.cxf-core:3.0.2]
at
org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.invoke(AbstractJAXWSMethodInvoker.java:232)[151:org.apache.cxf.cxf-rt-frontend-jaxws:3.0.2]
at
org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:69)[151:org.apache.cxf.cxf-rt-frontend-jaxws:3.0.2]
at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:75)[139:org.apache.cxf.cxf-core:3.0.2]
at
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)[139:org.apache.cxf.cxf-core:3.0.2]
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_79]
at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_79]
at
org.apache.cxf.interceptor.ServiceInvokerInterceptor$2.run(ServiceInvokerInterceptor.java:126)[139:org.apache.cxf.cxf-core:3.0.2]
at
org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)[139:org.apache.cxf.cxf-core:3.0.2]
at
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:131)[139:org.apache.cxf.cxf-core:3.0.2]
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)[139:org.apache.cxf.cxf-core:3.0.2]
at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)[139:org.apache.cxf.cxf-core:3.0.2]
at
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:243)[149:org.apache.cxf.cxf-rt-transports-http:3.0.2]
at
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223)[149:org.apache.cxf.cxf-rt-transports-http:3.0.2]
at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:197)[149:org.apache.cxf.cxf-rt-transports-http:3.0.2]
at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:149)[149:org.apache.cxf.cxf-rt-transports-http:3.0.2]
at
org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:171)[149:org.apache.cxf.cxf-rt-transports-http:3.0.2]
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:290)[149:org.apache.cxf.cxf-rt-transports-http:3.0.2]
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:209)[149:org.apache.cxf.cxf-rt-transports-http:3.0.2]
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:595)[58:org.apache.geronimo.specs.geronimo-servlet_3.0_spec:1.0.0]
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:265)[149:org.apache.cxf.cxf-rt-transports-http:3.0.2]
at
org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)[64:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503)[64:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at
org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:69)[73:org.ops4j.pax.web.pax-web-jetty:3.1.2]
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)[64:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)[64:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)[64:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)[64:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at
org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:240)[73:org.ops4j.pax.web.pax-web-jetty:3.1.2]
at
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)[64:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)[64:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)[64:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)[64:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at
org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:77)[73:org.ops4j.pax.web.pax-web-jetty:3.1.2]
at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)[64:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at
org.eclipse.jetty.server.Server.handle(Server.java:366)[64:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at
org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)[64:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at
org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982)[64:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at
org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043)[64:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at
org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)[64:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at
org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)[64:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at
org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)[64:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)[64:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)[64:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)[64:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)[64:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at java.lang.Thread.run(Thread.java:745)[:1.7.0_79]
Caused by: java.lang.NoClassDefFoundError:
javax/xml/datatype/DatatypeConfigurationException
at com.teamcenter.soa.internal.client.SessionManager.<init>(Unknown
Source)
at com.teamcenter.soa.client.Connection.<init>(Unknown
Source)[847:TcSoaClient:8000.3.0]
at
com.teamcenter.clientx.Session.<init>(Session.java:67)[917:cxf-osgi:5.4.0]
at
org.apache.servicemix.examples.cxf.HelloWorldImpl.sayHi(HelloWorldImpl.java:32)[917:cxf-osgi:5.4.0]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)[:1.7.0_79]
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_79]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_79]
at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_79]
at
org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:181)
at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:97)
... 46 more
Caused by: java.lang.ClassNotFoundException:
javax.xml.datatype.DatatypeConfigurationException not found by TcSoaClient
[847]
at
org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1556)
at
org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:77)
at
org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1993)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)[:1.7.0_79]
... 56 more
Thank you.
Regards,
Nagesh
--
View this message in context:
http://servicemix.396122.n5.nabble.com/Not-able-to-deploy-example-apache-servicemix-5-4-0-examples-cxf-cxf-osgi-example-after-adding-my-web0-tp5722703.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.