Hello everyone,

I am trying to expose a service using http/json via cxf.
However, I issue a stacktrace at the startup of the webapp :

   14:49:44,648 | {main} | [WARN ] |
   [org.springframework.beans.GenericTypeAwarePropertyDescriptor] :
   Invalid JavaBean property 'serviceBeans' being accessed! Ambiguous
   write methods found next to actually used [public void
   org.apache.cxf.jaxrs.JAXRSServerFactoryBean.setServiceBeans(java.util.List)]:
   [public void
   
org.apache.cxf.jaxrs.JAXRSServerFactoryBean.setServiceBeans(java.lang.Object[])]
   14:49:44,695 | {main} | [INFO ] |
   [org.springframework.beans.factory.support.DefaultListableBeanFactory]
   : Destroying singletons in
   org.springframework.beans.factory.support.defaultlistablebeanfact...@1861086:
   defining beans
   
[cxf,org.apache.cxf.bus.spring.BusApplicationListener,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org.apache.cxf.configuration.Configurer,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogManager,org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf
   
.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,org.apache.cxf.transport.servlet.ServletTransportFactory,org.apache.camel.component.cxf.transport.CamelTransportFactory#0,org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder,org.apache.cxf.transport.http.policy.HTTPServerAssertionBuilder,org.apache.cxf.transport.http.policy.NoOpPolicyInterceptorProvider,org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory,jms-customerService-ConnectionFactory,jms-customerService-PooledConnectionFactory,jms-customerService-Config,pojo-customerService,rest-customerService,http-customerService,jms-customerService,direct-customerService,template,consumerTemplate,camelContext-server:beanPostProcessor,camelContext-server,org.apache.camel.component.cxf.transport.CamelTransportFactory#1];
   root of factory hierarchy
   14:49:44,695 | {main} | [ERROR] |
   [org.springframework.web.context.ContextLoader] : Context
   initialization failed
   org.springframework.beans.factory.BeanCreationException: Error
   creating bean with name 'rest-customerService': Invocation of init
   method failed; nested exception is
   org.apache.cxf.service.factory.ServiceConstructionException
        at
   
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1412)
        at
   
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at
   
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at
   
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
        at
   
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at
   
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
        at
   
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
        at
   
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:574)
        at
   
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
        at
   
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
        at
   
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
        at
   
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
        at
   
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
        at
   
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
        at
   org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
        at
   
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
        at
   org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
        at
   org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
        at
   org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:830)
        at
   org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:719)
        at
   org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
        at
   org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
        at
   org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
        at
   
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
        at
   org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
        at
   org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
        at
   org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        at
   org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
        at
   org.apache.catalina.core.StandardService.start(StandardService.java:516)
        at
   org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
        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:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
   Caused by: org.apache.cxf.service.factory.ServiceConstructionException
        at
   
org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:125)
        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:597)
        at
   
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1536)
        at
   
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
        at
   
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
        ... 36 more
   Caused by: javax.ws.rs.WebApplicationException
        at
   
org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.checkResources(AbstractJAXRSFactoryBean.java:262)
        at
   
org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:85)
        ... 43 more

The error message gave me no hints. Can someone helps or encountered similar stack ?

I am using cxf 2.2.9 (try also with 2.2.10). For information soap over http and soap over jms were working before the test with json. Other spring files are not copy/paste (mainly related to soap over jms integration)

the spring configuration is

   <beans xmlns="http://www.springframework.org/schema/beans";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xmlns:cxf="http://cxf.apache.org/core";
        xmlns:jaxws="http://cxf.apache.org/jaxws";
   xmlns:jaxrs="http://cxf.apache.org/jaxrs";
        xsi:schemaLocation="
   http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans.xsd
   http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
   http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
   http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
   http://camel.apache.org/schema/spring
   http://camel.apache.org/schema/spring/camel-spring-2.3.0.xsd";>

   <bean id="pojo-customerService"
   class="com.karavel.tutorial.backend.impl.ComponentImpl" />

   <!-- for incoming http/json -->
   <jaxrs:server id="rest-customerService" address="/rest/">
   <jaxrs:serviceBeans>
   <list>
   <ref bean="pojo-customerService" />
   </list>
   </jaxrs:serviceBeans>
   <jaxrs:extensionMappings>
   <!--  entry key="feed" value="application/atom+xml"/-->
   <entry key="json" value="application/json" />
   <!--entry key="xml" value="application/xml"/-->
   <!--entry key="html" value="text/html"/-->
   </jaxrs:extensionMappings>
   </jaxrs:server>

   <!-- for incoming http/soap -->
   <jaxws:endpoint id="http-customerService"
   implementor="#pojo-customerService"
            address="/service" />

   <!-- for incoming jms/soap -->
   <!-- http://camel.apache.org/jms.html -->
   <!-- http://camel.apache.org/activemq.html -->
   <bean id="jms-customerService"
   class="org.apache.activemq.camel.component.ActiveMQComponent">
   <property name="configuration" ref="jms-customerService-Config" />
   <property name="useMessageIDAsCorrelationID" value="true" />
   <property name="requestTimeout" value="20000" /> <!-- ms, time
   between post and consumption in the queue -->
   <property name="receiveTimeout" value="5000" /> <!-- ms -->
   </bean>
   <jaxws:endpoint id="direct-customerService"
   implementor="#pojo-customerService"
            address="camel://direct:customerService">
   <jaxws:features>
   <!-- Enables logging of SOAP messages. -->
   <logging xmlns="http://cxf.apache.org/core"; />
   </jaxws:features>
   </jaxws:endpoint>

   </beans>


The java interface is

   @WebService
   @Path("/json")
   public interface ICustomerFacadeService extends ICustomerService {

        @GET
        @Path("/fake_echo")
        public String fake_echo();


        @WebResult(name = "echo")
        @WebMethod
        public String echo(@WebParam(name = "string") String string,
   @WebParam(name = "time-to-sleep-in-ms") long timeToSleepInMs);


        @WebResult(name = "getCustomerByName1Out")
        @WebMethod
        public CustomerSyntheseVO getCustomerByName1(
            @WebParam(name = "name") String name ) throws
   NoSuchCustomerException;


        @WebResult(name = "getCustomersByName1Out")
        @WebMethod
        public CustomerSyntheseVO[] getCustomersByName1(
            @WebParam(name = "name") String name ) throws
   NoSuchCustomerException;

        @WebResult(name = "getCustomersByName2Out")
        @WebMethod
        public CustomerSyntheseVO[] getCustomersByName2(
                @WebParam(name = "name") String name );

        @WebResult(name = "new_methodOut")
        @WebMethod
        public NewOutVO new_method(@WebParam(name = "in")  NewInVO in);

       @WebMethod
       @Oneway
       public void insertWithoutException(@WebParam(name = "in") String
   name);
   }

Thanks for your help.


Reply via email to