3 Replies Latest reply on Mar 17, 2015 10:06 AM by Grzegorz Grzybek

    Deploy a WebService CXF packaged in WAR

    Rafael Soares (Tuelho) Novice

      Hi!

       

      I tried to deploy a simple Apache CXF WebService packaged as WAR file inside JBoss Fuse 6.1 with no success. I followed the steps described in JBoss Fuse Documentation: WAR Deployment Model (sounds like that part of docs is incomplete or vague)

       

      I used two Apache CXF Quickstart sample projects:

      1. CXF code first jaxws
      2. CXF code first with spring support

       

      I managed to deploy and test both in Tomcat 7.

       

      But no success in JBoss Fuse 6.1.

       

      JBossFuse:karaf@root> osgi:install war:mvn:br.net.rafaeltuelho/cxf-code-first-jaxws/0.0.1-SNAPSHOT/war?Web-ContextPath=ws1
      JBossFuse:karaf@root> osgi:install war:mvn:br.net.rafaeltuelho/cxf-code-first-spring/0.0.1-SNAPSHOT/war?Web-ContextPath=ws2
      

       

      The first one was installed and started without errors in fuse log, but the CXF does not bootstrap. The webcontext (/ws1) was not started.

       

      [ 274] [Active     ] [            ] [       ] [   60] mvn_br.net.rafaeltuelho_wicket-web-app_0.0.1-SNAPSHOT_war (0)
      [ 286] [Active     ] [            ] [       ] [   60] mvn_br.net.rafaeltuelho_cxf-code-first-jaxws_0.0.1-SNAPSHOT_war (0)
      
      

       

      The second one give me a lot of class loading errors:

       

      15:30:15,737 | INFO  | pool-10-thread-1 | DefaultListableBeanFactory       | 287 - mvn_br.net.rafaeltuelho_cxf-code-first-spring_0.0.1-SNAPSHOT_war - 0.0.0 | Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@408aef18: defining beans [cxf,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,helloWorld]; root of factory hierarchy
      15:30:15,737 | ERROR | pool-10-thread-1 | ContextLoader                    | 287 - mvn_br.net.rafaeltuelho_cxf-code-first-spring_0.0.1-SNAPSHOT_war - 0.0.0 | Context initialization failed
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cxf' defined in class path resource [META-INF/cxf/cxf.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.cxf.bus.spring.SpringBus]: Constructor threw exception; nested exception is org.apache.cxf.bus.extension.ExtensionException: Could not load extension class org.apache.cxf.wsdl11.WSDLServiceFactoryImpl.
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1037)[287:mvn_br.net.rafaeltuelho_cxf-code-first-spring_0.0.1-SNAPSHOT_war:0]
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:983)[287:mvn_br.net.rafaeltuelho_cxf-code-first-spring_0.0.1-SNAPSHOT_war:0]
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:487)[287:mvn_br.net.rafaeltuelho_cxf-code-first-spring_0.0.1-SNAPSHOT_war:0]
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)[287:mvn_br.net.rafaeltuelho_cxf-code-first-spring_0.0.1-SNAPSHOT_war:0]
              at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)[287:mvn_br.net.rafaeltuelho_cxf-code-first-spring_0.0.1-SNAPSHOT_war:0]
              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)[287:mvn_br.net.rafaeltuelho_cxf-code-first-spring_0.0.1-SNAPSHOT_war:0]
      ...
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_75]
              at java.lang.Thread.run(Thread.java:745)[:1.7.0_75]
      Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.cxf.bus.spring.SpringBus]: Constructor threw exception; nested exception is org.apache.cxf.bus.extension.ExtensionException: Could not load extension class org.apache.cxf.wsdl11.WSDLServiceFactoryImpl.
              at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163)[287:mvn_br.net.rafaeltuelho_cxf-code-first-spring_0.0.1-SNAPSHOT_war:0]
              at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87)[287:mvn_br.net.rafaeltuelho_cxf-code-first-spring_0.0.1-SNAPSHOT_war:0]
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1030)[287:mvn_br.net.rafaeltuelho_cxf-code-first-spring_0.0.1-SNAPSHOT_war:0]
              ... 46 more
      Caused by: org.apache.cxf.bus.extension.ExtensionException: Could not load extension class org.apache.cxf.wsdl11.WSDLServiceFactoryImpl.
              at org.apache.cxf.bus.extension.Extension.tryClass(Extension.java:183)[287:mvn_br.net.rafaeltuelho_cxf-code-first-spring_0.0.1-SNAPSHOT_war:0]
              at org.apache.cxf.bus.extension.Extension.getClassObject(Extension.java:199)[287:mvn_br.net.rafaeltuelho_cxf-code-first-spring_0.0.1-SNAPSHOT_war:0]
              at org.apache.cxf.bus.extension.ExtensionManagerImpl.activateAllByType(ExtensionManagerImpl.java:144)[287:mvn_br.net.rafaeltuelho_cxf-code-first-spring_0.0.1-SNAPSHOT_war:0]
              at org.apache.cxf.bus.extension.ExtensionManagerBus.<init>(ExtensionManagerBus.java:180)[287:mvn_br.net.rafaeltuelho_cxf-code-first-spring_0.0.1-SNAPSHOT_war:0]
              at org.apache.cxf.bus.extension.ExtensionManagerBus.<init>(ExtensionManagerBus.java:192)[287:mvn_br.net.rafaeltuelho_cxf-code-first-spring_0.0.1-SNAPSHOT_war:0]
              at org.apache.cxf.bus.spring.SpringBus.<init>(SpringBus.java:45)[287:mvn_br.net.rafaeltuelho_cxf-code-first-spring_0.0.1-SNAPSHOT_war:0]
              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)[:1.7.0_75]
              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)[:1.7.0_75]
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[:1.7.0_75]
              at java.lang.reflect.Constructor.newInstance(Constructor.java:526)[:1.7.0_75]
              at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148)[287:mvn_br.net.rafaeltuelho_cxf-code-first-spring_0.0.1-SNAPSHOT_war:0]
              ... 48 more
      Caused by: java.lang.ClassNotFoundException: org.apache.cxf.wsdl11.WSDLServiceFactoryImpl not found by mvn_br.net.rafaeltuelho_cxf-code-first-spring_0.0.1-SNAPSHOT_war [287]
              at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532)
              at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
              at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:358)[:1.7.0_75]
              at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1870)
              at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:937)
      
      

       

      See the bundle headers for each WAR bundle:

      • CXF jaxws
      JBossFuse:karaf@root> osgi:headers 274
      
      
      mvn_br.net.rafaeltuelho_wicket-web-app_0.0.1-SNAPSHOT_war (274)
      ---------------------------------------------------------------
      Manifest-Version = 1
      Bnd-LastModified = 1425069541546
      Archiver-Version = Plexus Archiver
      Tool = Bnd-1.43.0
      Originally-Created-By = Apache Maven 3.2.1
      WAR-URL = mvn:br.net.rafaeltuelho/wicket-web-app/0.0.1-SNAPSHOT/war
      Built-By = rsoares
      Web-ContextPath = wicket
      Generated-By-Ops4j-Pax-From = mvn:br.net.rafaeltuelho/wicket-web-app/0.0.1-SNAPSHOT/war
      Build-Jdk = 1.7.0_75
      Created-By = 1.7.0_75 (Oracle Corporation)
      
      
      Bundle-Name = mvn_br.net.rafaeltuelho_wicket-web-app_0.0.1-SNAPSHOT_war
      Bundle-SymbolicName = mvn_br.net.rafaeltuelho_wicket-web-app_0.0.1-SNAPSHOT_war
      Bundle-Version = 0
      Bundle-ManifestVersion = 2
      Bundle-ClassPath = WEB-INF/classes,WEB-INF/lib/slf4j-api-1.6.4.jar,WEB-INF/lib/wicket-core-6.19.0.jar,WEB-INF/lib/slf4j-log4j12-1.6.4.jar,WEB-INF/lib/wicket-util-6.19.0.jar,WEB-INF/lib/wicket-request-6.19.0.jar,WEB-INF/lib/log4j-1.2.16.jar
      
      
      Import-Package =
              javax.crypto;resolution:=optional,
              javax.crypto.spec;resolution:=optional,
              javax.imageio;resolution:=optional,
              javax.jmdns;resolution:=optional,
              javax.jms;resolution:=optional,
              javax.mail;resolution:=optional,
              javax.mail.internet;resolution:=optional,
              javax.management;resolution:=optional,
              javax.naming;resolution:=optional,
              javax.servlet,
              javax.servlet.http,
              javax.servlet.jsp;resolution:=optional,
              javax.servlet.jsp.el;resolution:=optional,
              javax.swing;resolution:=optional,
              javax.swing.border;resolution:=optional,
              javax.swing.event;resolution:=optional,
              javax.swing.table;resolution:=optional,
              javax.swing.text;resolution:=optional,
              javax.swing.tree;resolution:=optional,
              javax.xml.parsers;resolution:=optional,
              javax.xml.transform;resolution:=optional,
              javax.xml.transform.stream;resolution:=optional,
              org.apache.commons.logging;resolution:=optional;provider=paxlogging,
              org.apache.commons.logging.impl;resolution:=optional;provider=paxlogging,
              org.apache.log4j;resolution:=optional;provider=paxlogging,
              org.apache.log4j.spi;resolution:=optional;provider=paxlogging,
              org.apache.log4j.xml;resolution:=optional;provider=paxlogging,
              org.apache.wicket.protocol.http;resolution:=optional,
              org.slf4j;resolution:=optional;provider=paxlogging,
              org.slf4j.helpers;resolution:=optional;provider=paxlogging,
              org.slf4j.spi;resolution:=optional;provider=paxlogging,
              org.w3c.dom;resolution:=optional,
              org.xml.sax;resolution:=optional,
              org.xml.sax.helpers;resolution:=optional
      
      


       

      • CXF with spring support
      JBossFuse:karaf@root> osgi:headers 286
      
      mvn_br.net.rafaeltuelho_cxf-code-first-jaxws_0.0.1-SNAPSHOT_war (286)
      ---------------------------------------------------------------------
      Manifest-Version = 1
      Bnd-LastModified = 1425129100636
      Archiver-Version = Plexus Archiver
      Tool = Bnd-1.43.0
      Originally-Created-By = Apache Maven
      WAR-URL = mvn:br.net.rafaeltuelho/cxf-code-first-jaxws/0.0.1-SNAPSHOT/war
      Built-By = rsoares
      Web-ContextPath = ws
      Generated-By-Ops4j-Pax-From = mvn:br.net.rafaeltuelho/cxf-code-first-jaxws/0.0.1-SNAPSHOT/war
      Build-Jdk = 1.7.0_75
      Created-By = 1.7.0_75 (Oracle Corporation)
      
      
      Bundle-Name = mvn_br.net.rafaeltuelho_cxf-code-first-jaxws_0.0.1-SNAPSHOT_war
      Bundle-SymbolicName = mvn_br.net.rafaeltuelho_cxf-code-first-jaxws_0.0.1-SNAPSHOT_war
      Bundle-Version = 0
      Bundle-ManifestVersion = 2
      Bundle-ClassPath = WEB-INF/classes,WEB-INF/lib/cxf-rt-ws-addr-2.7.0.redhat-610379.jar,WEB-INF/lib/spring-aop-3.2.8.RELEASE.jar,WEB-INF/lib/cxf-rt-core-2.7.0.redhat-610379.jar,WEB-INF/lib/jaxb-impl-2.2.6.jar,WEB-INF/lib/commons-logging-1.1.3.jar,WEB-INF/lib/xml-resolver-1.2.jar,WEB-INF/lib/cxf-rt-frontend-simple-2.7.0.redhat-610379.jar,WEB-INF/lib/spring-core-3.2.8.RELEASE.jar,WEB-INF/lib/woodstox-core-asl-4.2.0.jar,WEB-INF/lib/cxf-rt-databinding-jaxb-2.7.0.redhat-610379.jar,WEB-INF/lib/cxf-api-2.7.0.redhat-610379.jar,WEB-INF/lib/wsdl4j-1.6.3.jar,WEB-INF/lib/aopalliance-1.0.jar,WEB-INF/lib/geronimo-javamail_1.4_spec-1.7.1.jar,WEB-INF/lib/cxf-rt-frontend-jaxws-2.7.0.redhat-610379.jar,WEB-INF/lib/spring-context-3.2.8.RELEASE.jar,WEB-INF/lib/stax2-api-3.1.1.jar,WEB-INF/lib/org.osgi.compendium-4.2.0.jar,WEB-INF/lib/neethi-3.0.3.jar,WEB-INF/lib/xmlschema-core-2.1.0.jar,WEB-INF/lib/asm-3.3.1.jar,WEB-INF/lib/spring-beans-3.2.8.RELEASE.jar,WEB-INF/lib/cxf-rt-bindings-soap-2.7.0.redhat-610379.jar,WEB-INF/lib/spring-expression-3.2.8.RELEASE.jar,WEB-INF/lib/cxf-rt-bindings-xml-2.7.0.redhat-610379.jar,WEB-INF/lib/cxf-rt-ws-policy-2.7.0.redhat-610379.jar,WEB-INF/lib/spring-web-3.2.8.RELEASE.jar,WEB-INF/lib/cxf-rt-transports-http-2.7.0.redhat-610379.jar
      
      
      Import-Package =
              javax.activation;resolution:=optional,
              javax.annotation;resolution:=optional,
              javax.crypto;resolution:=optional,
              javax.crypto.spec;resolution:=optional,
              javax.ejb;resolution:=optional,
              javax.el;resolution:=optional,
              javax.faces.application;resolution:=optional,
              javax.faces.component;resolution:=optional,
              javax.faces.context;resolution:=optional,
              javax.faces.el;resolution:=optional,
              javax.faces.event;resolution:=optional,
              javax.imageio;resolution:=optional,
              javax.imageio.metadata;resolution:=optional,
              javax.imageio.stream;resolution:=optional,
              javax.inject;resolution:=optional,
              javax.interceptor;resolution:=optional,
              javax.jms;resolution:=optional,
              javax.jws;resolution:=optional,
              javax.jws.soap;resolution:=optional,
              javax.management;resolution:=optional,
              javax.management.modelmbean;resolution:=optional,
              javax.management.openmbean;resolution:=optional,
              javax.management.remote;resolution:=optional,
              javax.microedition.io;resolution:=optional,
              javax.naming;resolution:=optional,
              javax.net.ssl;resolution:=optional,
              javax.persistence.spi;resolution:=optional,
              javax.portlet;resolution:=optional,
              javax.rmi;resolution:=optional,
              javax.security.auth;resolution:=optional,
              javax.security.auth.callback;resolution:=optional,
              javax.security.auth.login;resolution:=optional,
              javax.security.auth.x500;resolution:=optional,
              javax.servlet,
              javax.servlet.annotation;resolution:=optional,
              javax.servlet.http,
              javax.servlet.jsp;resolution:=optional,
              javax.servlet.jsp.el;resolution:=optional,
              javax.servlet.jsp.tagext;resolution:=optional,
              javax.tools;resolution:=optional,
              javax.validation;resolution:=optional,
              javax.validation.bootstrap;resolution:=optional,
              javax.validation.constraints;resolution:=optional,
              javax.validation.metadata;resolution:=optional,
              javax.xml.bind;resolution:=optional,
              javax.xml.bind.annotation;resolution:=optional,
              javax.xml.bind.annotation.adapters;resolution:=optional,
              javax.xml.bind.attachment;resolution:=optional,
              javax.xml.bind.helpers;resolution:=optional,
              javax.xml.datatype;resolution:=optional,
              javax.xml.namespace;resolution:=optional,
              javax.xml.parsers;resolution:=optional,
              javax.xml.rpc;resolution:=optional,
              javax.xml.rpc.server;resolution:=optional,
              javax.xml.rpc.soap;resolution:=optional,
              javax.xml.soap;resolution:=optional,
              javax.xml.stream;resolution:=optional,
              javax.xml.stream.events;resolution:=optional,
              javax.xml.stream.util;resolution:=optional,
              javax.xml.transform;resolution:=optional,
              javax.xml.transform.dom;resolution:=optional,
              javax.xml.transform.sax;resolution:=optional,
              javax.xml.transform.stax;resolution:=optional,
              javax.xml.transform.stream;resolution:=optional,
              javax.xml.validation;resolution:=optional,
              javax.xml.ws;resolution:=optional,
              javax.xml.ws.handler;resolution:=optional,
              javax.xml.ws.handler.soap;resolution:=optional,
              javax.xml.ws.http;resolution:=optional,
              javax.xml.ws.soap;resolution:=optional,
              javax.xml.ws.spi;resolution:=optional,
              javax.xml.ws.spi.http;resolution:=optional,
              javax.xml.ws.wsaddressing;resolution:=optional,
              javax.xml.xpath;resolution:=optional,
              org.apache.commons.logging;resolution:=optional;provider=paxlogging,
              org.apache.commons.logging.impl;resolution:=optional;provider=paxlogging,
              org.apache.cxf.transport.servlet;resolution:=optional,
              org.apache.log4j;resolution:=optional;provider=paxlogging,
              org.apache.log4j.spi;resolution:=optional;provider=paxlogging,
              org.apache.log4j.xml;resolution:=optional;provider=paxlogging,
              org.slf4j;resolution:=optional;provider=paxlogging,
              org.slf4j.helpers;resolution:=optional;provider=paxlogging,
              org.slf4j.spi;resolution:=optional;provider=paxlogging,
              org.w3c.dom;resolution:=optional,
              org.w3c.dom.bootstrap;resolution:=optional,
              org.w3c.dom.ls;resolution:=optional,
              org.xml.sax;resolution:=optional,
              org.xml.sax.ext;resolution:=optional,
              org.xml.sax.helpers;resolution:=optional
      
      

       

      Is there any project example to deploy an Apache CXF service packaged as WAR file inside JBoss Fuse/Apache Karaf Container?

       

      Kind regards.