Exception when starting java_first_jaxws example

Highlighted
One Star

Exception when starting java_first_jaxws example

Hi,
I'm trying to deploy and test the "Code first development" example as described in the Development Guide 5.0_b (chapter 3. Web Services). I've successfully installed the bundle but when I try to start it, I'm getting the following error:
org.apache.cxf.service.factory.ServiceConstructionException
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.createDefaultDataBinding(ReflectionServiceFactory
Bean.java:232)
at org.apache.cxf.service.factory.AbstractServiceFactoryBean.getDataBinding(AbstractServiceFactoryBean.java:109)
at org.apache.cxf.service.factory.AbstractServiceFactoryBean.getDataBinding(AbstractServiceFactoryBean.java:105)
at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.j
ava:83)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBea
n.java:474)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBe
an.java:536)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:248)
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java
:101)
at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:159)
at demo.hw.server.Activator.start(Activator.java:18)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:783)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:774)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:370)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:284)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:276)
at org.apache.karaf.shell.osgi.StartBundle.doExecute(StartBundle.java:30)
at org.apache.karaf.shell.osgi.BundlesCommand.doExecute(BundlesCommand.java:37)
at org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:38)
at org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)
at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)
at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)
at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)
at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)
at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)
at org.apache.karaf.shell.console.jline.Console.run(Console.java:166)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.ClassNotFoundException: org.apache.cxf.jaxb.JAXBDataBinding
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.apache.cxf.common.classloader.ClassLoaderUtils.loadClass2(ClassLoaderUtils.java:271)
at org.apache.cxf.common.classloader.ClassLoaderUtils.loadClass(ClassLoaderUtils.java:258)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.createDefaultDataBinding(ReflectionServiceFactory
Bean.java:220)
... 29 more
org.osgi.framework.BundleException: Exception in demo.hw.server.Activator.start() of bundle com.talend.cxf.samples.java_
first_jaxws.
Do you have an idea how to fix this?
Kind regards
Martin Swientek

Employee zbe
Employee

Re: Exception when starting java_first_jaxws example

Martin,
your issue seems to be pretty similar to Export demo to deploy folder of container,karaf generated errors!. Which jave jre/jdk are you exactly using?
Regards,
Zsolt
Employee zbe
Employee

Re: Exception when starting java_first_jaxws example

Hi Martin,
I had a second look on your issue. Just forget my first posting, it is not related to the JRE / JDK version you used. I could reproduce the problem when using TESB 5.1.0 (With 5.0.2 it works fine). With CXF-2.6.0, the version we integrate with 5.1.0, the one big bundle used before was split into several smaller bundles. This seems to cause problems in our sample. Unfortunately I don't have a solution or workaround yet, but I will keep you updated.
Regards,
Zsolt
Employee

Re: Exception when starting java_first_jaxws example

The java_first_jaxws archetype wasn't updated for CXF 2.6.0 (oversight on our part) -- it was updated last week and should be fine for the upcoming CXF 2.6.1 (not yet released though Smiley Sad ) This guide will also probably need updates (I'm checking it now.)
In the meantime, this tutorial can teach you Java-first development: http://www.jroller.com/gmazza/entry/java_first_web_service (although we'd always rather everyone start learning with WSDL-first Smiley Happy
Employee zbe
Employee

Re: Exception when starting java_first_jaxws example

Martin,
a possible workaround is to use JAX-WS as frontend in the Activator class instead of the Simple frontent as documented in the guide. The activator class would then look like this:
package demo.hw.server;
import javax.xml.ws.Endpoint;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
public class Activator implements BundleActivator {
private Server server;
public void start(BundleContext arg0) throws Exception {
try {
HelloWorldImpl implementor = new HelloWorldImpl();
String address = "http://localhost:9000/helloWorld";
Endpoint.publish(address, implementor);
System.out.println("Server is started...");
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
public void stop(BundleContext arg0) throws Exception {
try {
server.stop();
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
}

We should change the example to use JAX-WS ayway.
BTW, I logged your issue in TESB and in CXF
One Star

Re: Exception when starting java_first_jaxws example

Hi all,
thank you very much for your fast and comprehensive help! I've successfully deployed the examples from Glen's blog (java-first and wsdl-first ;-)) as well as the original example from the developer guide using the JAX-WS frontend in the Activator class as suggested by Zsolt.
Kind regards
Martin
One Star

Re: Exception when starting java_first_jaxws example

ooG5JD swvapxgyfwns, xagvkktkykti, gxppztvhqrjb,

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

An API-First Approach to Modernizing Applications

Learn how to use an API-First Approach to Modernize your Applications

Watch Now

Talend API Designer – Technical Overview

Take a look at this technical overview video of Talend API Designer

Watch Now

Getting Started with APIs

Find out how to get started with APIs

Read

APIs for Dummies

View this on-demand webinar about APIs....

Watch Now