geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jarek Gawor <jga...@gmail.com>
Subject Re: Problem when deploy CXF WebService (Service resource injection failed)
Date Mon, 06 Jul 2009 16:46:01 GMT
Westhveg,

Let's back up a little. You have two options for deploying your web service:

1) Deploy your web application WITH all cxf and spring jars but you
MUST: a) start the server with
-Dorg.apache.geronimo.jaxws.builder.useSimpleFinder=true AND b)
specify a bunch of filters in geronimo-web.xml.

or

2) Deploy your web application WITHOUT any cxf AND spring jars and
without CXFServlet in the web.xml. In this case your web application
should only contain the web service class and any other jars/classes
that the web service needs. The war file should be much smaller. Don't
set org.apache.geronimo.jaxws.builder.useSimpleFinder property or any
filters in geronimo-web.xml.

With option 2) you are relying on the app server to deploy your web
service. The app server will use its own web service engine to deploy
and manage your web service. That's why you don't need all these
spring or cxf jars or the cxf servlet or cxf configuration files. With
option 1) you are not relying on the app server to deploy and manage
your web service. The web application you are deploying has it own web
services engine which will deploy and manage the web service. And to
prevent conflicts between the web app web service engine and the app
server web service engine you need to set those filters and that
property.

Jarek

On Mon, Jul 6, 2009 at 5:13 AM, Westhveg<westhstudios@gmail.com> wrote:
>
> Can anyone help me, please?
>
>
> Thanks,
>
> Westhveg
>
>
> Westhveg wrote:
>>
>> And if I try to test the webservice developing this spring client:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <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-2.5.xsd
>>                            http://cxf.apache.org/jaxws
>>                            http://cxf.apache.org/schemas/jaxws.xsd">
>>  <!--
>> If I uncomment this, I get the same exception. But if I leave it
>> commented, I must import FastInfoset.jar library.
>>
>>     <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-servlet.xml" />
>> -->
>>       <jaxws:client id="helloWordClient"
>>                     serviceClass="com.test.HelloWorld"
>>                     address="http://localhost:8080/helloWorld" />
>> </beans>
>>
>>
>>
>> 30-jun-2009 23:52:33 org.apache.cxf.bus.spring.BusApplicationContext
>> getConfigResources
>> INFO: No cxf.xml configuration file detected, relying on defaults.
>> 30-jun-2009 23:52:34
>> org.apache.cxf.service.factory.ReflectionServiceFactoryBean
>> buildServiceFromClass
>> INFO: Creating Service {http://test.com/}HelloWorldService from class
>> com.test.HelloWorld
>> 30-jun-2009 23:52:34 org.apache.cxf.phase.PhaseInterceptorChain
>> doIntercept
>> INFO: Interceptor has thrown exception, unwinding now
>> org.apache.cxf.interceptor.Fault: Could not send Message.
>>       at
>> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
>>       at
>> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
>>       at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:471)
>>       at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:301)
>>       at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:253)
>>       at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
>>       at
>> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:121)
>>       at $Proxy44.postMessage(Unknown Source)
>>       at com.test.TestWsClient.main(TestWsClient.java:15)
>> Caused by: java.io.IOException: Not Found
>>       at
>> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2064)
>>       at
>> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2015)
>>       at
>> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1940)
>>       at
>> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
>>       at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:627)
>>       at
>> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
>>       ... 8 more
>> Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Could not
>> send Message.
>>       at
>> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:141)
>>       at $Proxy44.postMessage(Unknown Source)
>>       at com.test.TestWsClient.main(TestWsClient.java:15)
>> Caused by: java.io.IOException: Not Found
>>       at
>> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2064)
>>       at
>> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2015)
>>       at
>> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1940)
>>       at
>> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
>>       at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:627)
>>       at
>> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
>>       at
>> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
>>       at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:471)
>>       at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:301)
>>       at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:253)
>>       at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
>>       at
>> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:121)
>>       ... 2 more
>>
>>
>>
>>
>> Westhveg wrote:
>>>
>>> Jarek,
>>>
>>> Now the exception is:
>>>
>>> Distribution of module failed.  See log for details.
>>>   AbstractWebModuleBuilder: Could not load listener class:
>>> org.springframework.web.context.ContextLoaderListener
>>>   org.apache.geronimo.common.DeploymentException:
>>> AbstractWebModuleBuilder: Could not load listener class:
>>> org.springframework.web.context.ContextLoaderListener
>>>      at
>>> org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.createWebAppClassFinder(AbstractWebModuleBuilder.java:791)
>>>      at
>>> org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.createWebAppClassFinder(AbstractWebModuleBuilder.java:759)
>>>      at
>>> org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.configureBasicWebModuleAttributes(AbstractWebModuleBuilder.java:836)
>>>      at
>>> org.apache.geronimo.jetty6.deployment.JettyModuleBuilder.addGBeans(JettyModuleBuilder.java:365)
>>>      at
>>> org.apache.geronimo.j2ee.deployment.SwitchingModuleBuilder.addGBeans(SwitchingModuleBuilder.java:165)
>>>      at
>>> org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration(EARConfigBuilder.java:647)
>>>      at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:255)
>>>      at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:134)
>>>      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>>      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>>      at java.lang.reflect.Method.invoke(Unknown Source)
>>>      at
>>> org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
>>>      at
>>> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124)
>>>      at
>>> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:867)
>>>      at
>>> org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
>>>      at org.apache.geronimo.kernel.KernelGBean.invoke(KernelGBean.java:342)
>>>      at sun.reflect.GeneratedMethodAccessor100.invoke(Unknown Source)
>>>      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>>      at java.lang.reflect.Method.invoke(Unknown Source)
>>>      at
>>> org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
>>>      at
>>> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124)
>>>      at
>>> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:867)
>>>      at
>>> org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
>>>      at
>>> org.apache.geronimo.system.jmx.MBeanGBeanBridge.invoke(MBeanGBeanBridge.java:172)
>>>      at
>>> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(Unknown
>>> Source)
>>>      at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(Unknown Source)
>>>      at javax.management.remote.rmi.RMIConnectionImpl.doOperation(Unknown
>>> Source)
>>>      at javax.management.remote.rmi.RMIConnectionImpl.access$200(Unknown
>>> Source)
>>>      at
>>> javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(Unknown
>>> Source)
>>>      at java.security.AccessController.doPrivileged(Native Method)
>>>      at
>>> javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(Unknown
>>> Source)
>>>      at javax.management.remote.rmi.RMIConnectionImpl.invoke(Unknown
>>> Source)
>>>      at sun.reflect.GeneratedMethodAccessor87.invoke(Unknown Source)
>>>      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>>      at java.lang.reflect.Method.invoke(Unknown Source)
>>>      at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
>>>      at sun.rmi.transport.Transport$1.run(Unknown Source)
>>>      at java.security.AccessController.doPrivileged(Native Method)
>>>      at sun.rmi.transport.Transport.serviceCall(Unknown Source)
>>>      at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
>>>      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown
>>> Source)
>>>      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown
>>> Source)
>>>      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
>>> Source)
>>>      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
>>>      at java.lang.Thread.run(Unknown Source)
>>>   Caused by: java.lang.ClassNotFoundException:
>>> org.springframework.web.context.ContextLoaderListener in classloader
>>> default/TestCXF/1.0/car
>>>      at
>>> org.apache.geronimo.kernel.config.MultiParentClassLoader.loadOptimizedClass(MultiParentClassLoader.java:438)
>>>      at
>>> org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:280)
>>>      at java.lang.ClassLoader.loadClass(Unknown Source)
>>>      at
>>> org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.createWebAppClassFinder(AbstractWebModuleBuilder.java:789)
>>>      ... 45 more
>>>
>>>
>>> But if I add spring.jar, then the WAR is published without errors, the
>>> CXF webservice is also published and WSDL file is generated correctly.
>>> Now my question is, why I can't use cxf servlet? Is this a best practice?
>>> In other words... if I want to publish a web service in my production
>>> environmnet.. do you recommend me this way?
>>>
>>>
>>> Thanks a lot Jarek :)
>>>
>>>
>>> Westhveg
>>>
>>>
>>> P.D: Remember that for this test I don't neither set the system property
>>> GERONIMO_OPTS="-Dorg.apache.geronimo.jaxws.builder.useSimpleFinder=true"
>>> nor add hidden-classes/filters to geronimo-web.xml file.
>>>
>>>
>>>
>>> Jarek Gawor-2 wrote:
>>>>
>>>> Ok, making progress on this front... Remove the CXFServlet from
>>>> web.xml file and add a servlet (and servlet-mapping) for the class
>>>> that is your web service implementation.
>>>>
>>>> Jarek
>>>>
>>>> On Tue, Jun 30, 2009 at 2:18 PM, Westhveg<westhstudios@gmail.com> wrote:
>>>>>
>>>>> Hi Jarek,
>>>>>
>>>>> Removing both jars, the exception is:
>>>>>
>>>>> Distribution of module failed.  See log for details.
>>>>>  Failed to load servlet class
>>>>> org.apache.cxf.transport.servlet.CXFServlet
>>>>>  org.apache.geronimo.common.DeploymentException: Failed to load servlet
>>>>> class org.apache.cxf.transport.servlet.CXFServlet
>>>>>        at
>>>>> org.apache.geronimo.jaxws.builder.AdvancedWARWebServiceFinder.getPortInfo(AdvancedWARWebServiceFinder.java:148)
>>>>>        at
>>>>> org.apache.geronimo.jaxws.builder.AdvancedWARWebServiceFinder.discoverPOJOWebServices(AdvancedWARWebServiceFinder.java:125)
>>>>>        at
>>>>> org.apache.geronimo.jaxws.builder.AdvancedWARWebServiceFinder.discoverWebServices(AdvancedWARWebServiceFinder.java:45)
>>>>>        at
>>>>> org.apache.geronimo.jaxws.builder.WARWebServiceFinder.discoverWebServices(WARWebServiceFinder.java:70)
>>>>>        at
>>>>> org.apache.geronimo.jaxws.builder.JAXWSServiceBuilder.discoverWebServices(JAXWSServiceBuilder.java:97)
>>>>>        at
>>>>> org.apache.geronimo.jaxws.builder.JAXWSServiceBuilder.findWebServices(JAXWSServiceBuilder.java:80)
>>>>>        at
>>>>> org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.basicInitContext(AbstractWebModuleBuilder.java:364)
>>>>>        at
>>>>> org.apache.geronimo.jetty6.deployment.JettyModuleBuilder.initContext(JettyModuleBuilder.java:350)
>>>>>        at
>>>>> org.apache.geronimo.j2ee.deployment.SwitchingModuleBuilder.initContext(SwitchingModuleBuilder.java:159)
>>>>>        at
>>>>> org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration(EARConfigBuilder.java:595)
>>>>>        at
>>>>> org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:255)
>>>>>        at
>>>>> org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:134)
>>>>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>>>>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
>>>>> Source)
>>>>>        at java.lang.reflect.Method.invoke(Unknown Source)
>>>>>        at
>>>>> org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
>>>>>        at
>>>>> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124)
>>>>>        at
>>>>> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:867)
>>>>>        at
>>>>> org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
>>>>>        at
>>>>> org.apache.geronimo.kernel.KernelGBean.invoke(KernelGBean.java:342)
>>>>>        at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
>>>>>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
>>>>> Source)
>>>>>        at java.lang.reflect.Method.invoke(Unknown Source)
>>>>>        at
>>>>> org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
>>>>>        at
>>>>> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124)
>>>>>        at
>>>>> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:867)
>>>>>        at
>>>>> org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
>>>>>        at
>>>>> org.apache.geronimo.system.jmx.MBeanGBeanBridge.invoke(MBeanGBeanBridge.java:172)
>>>>>        at
>>>>> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(Unknown
>>>>> Source)
>>>>>        at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(Unknown Source)
>>>>>        at
>>>>> javax.management.remote.rmi.RMIConnectionImpl.doOperation(Unknown
>>>>> Source)
>>>>>        at
>>>>> javax.management.remote.rmi.RMIConnectionImpl.access$200(Unknown
>>>>> Source)
>>>>>        at
>>>>> javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(Unknown
>>>>> Source)
>>>>>        at java.security.AccessController.doPrivileged(Native Method)
>>>>>        at
>>>>> javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(Unknown
>>>>> Source)
>>>>>        at javax.management.remote.rmi.RMIConnectionImpl.invoke(Unknown
>>>>> Source)
>>>>>        at sun.reflect.GeneratedMethodAccessor76.invoke(Unknown Source)
>>>>>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
>>>>> Source)
>>>>>        at java.lang.reflect.Method.invoke(Unknown Source)
>>>>>        at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
>>>>>        at sun.rmi.transport.Transport$1.run(Unknown Source)
>>>>>        at java.security.AccessController.doPrivileged(Native Method)
>>>>>        at sun.rmi.transport.Transport.serviceCall(Unknown Source)
>>>>>        at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown
>>>>> Source)
>>>>>        at
>>>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown
>>>>> Source)
>>>>>        at
>>>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown
>>>>> Source)
>>>>>        at
>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
>>>>>        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
>>>>> Source)
>>>>>        at java.lang.Thread.run(Unknown Source)
>>>>>  Caused by: java.lang.ClassNotFoundException:
>>>>> org.apache.cxf.transport.servlet.CXFServlet in classloader
>>>>> default/ViewControllerWS/1.0/car
>>>>>        at
>>>>> org.apache.geronimo.kernel.config.MultiParentClassLoader.loadOptimizedClass(MultiParentClassLoader.java:438)
>>>>>        at
>>>>> org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:280)
>>>>>        at java.lang.ClassLoader.loadClass(Unknown Source)
>>>>>        at
>>>>> org.apache.geronimo.jaxws.builder.AdvancedWARWebServiceFinder.getPortInfo(AdvancedWARWebServiceFinder.java:142)
>>>>>        ... 49 more
>>>>>
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Westhveg
>>>>>
>>>>>
>>>>>
>>>>> Jarek Gawor-2 wrote:
>>>>>>
>>>>>> You have to remove both, CXF and Spring. And please include a full
>>>>>> stack trace to see what's loading that
>>>>>> org.springframework.context.ApplicationListener class.
>>>>>>
>>>>>> Jarek
>>>>>>
>>>>>> On Mon, Jun 29, 2009 at 3:56 PM, Westhveg<westhstudios@gmail.com>
>>>>>> wrote:
>>>>>>>
>>>>>>> And if I remove the spring or cfx jar files from WAR, I get a
>>>>>>> ClassNotFoundException. For example, if I remove spring jar file:
>>>>>>>
>>>>>>> Caused by: java.lang.ClassNotFoundException:
>>>>>>> org.springframework.context.ApplicationListener in classloader
>>>>>>> default/ViewControllerWS/1.0/car
>>>>>>>        at
>>>>>>> org.apache.geronimo.kernel.config.MultiParentClassLoader.loadOptimizedClass(MultiParentClassLoader.java:438)
>>>>>>>        at
>>>>>>> org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:280)
>>>>>>>        at java.lang.ClassLoader.loadClass(Unknown Source)
>>>>>>>        at java.lang.ClassLoader.loadClassInternal(Unknown
Source)
>>>>>>>        ... 60 more
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Could you help me, please?
>>>>>>>
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>> Westhveg
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/Problem-when-deploy-CXF-WebService-%28Service-resource-injection-failed%29-tp24245804s134p24276970.html
>>>>> Sent from the Apache Geronimo - Dev mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Problem-when-deploy-CXF-WebService-%28Service-resource-injection-failed%29-tp24245804s134p24352089.html
> Sent from the Apache Geronimo - Dev mailing list archive at Nabble.com.
>
>

Mime
View raw message