cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: NPE in JaxWsProxyFactoryBean...
Date Thu, 21 Aug 2008 15:31:18 GMT

Do you know what classloader the class is in?  

Looking at the code, I could see an NPE if the class is in the bootstrap 
classsloader, but that's kind of a bizarre case.    I'll add some checks for 
that.  

Dan

On Wednesday 20 August 2008 2:46:22 am tedzo wrote:
> Hello,
> I have a HelloWorld client and server working great with WS-Security
> enabled. I am using cxf-2.1, tomcat6. I am now trying to convert an
> existing class within my webapp into a service and test it using a
> standalone cxf client. I seem to be having trouble getting the client up
> and running although it is identical to the HelloWorld client.
> JaxWsProxyFactoryBean is not finding some class. It can't be the client
> interface because that class is there on the classpath for sure... OR does
> cxf expect the client interface to exist in a specific location? The wsdl
> is available when I access it via the browser. Any pointers are greatly
> appreciated.
> Thanks.
> My client is-
> main() {
> ClassPathXmlApplicationContext context  = new
> ClassPathXmlApplicationContext(new String[]
> {"client/demo/spring/client/clientAppContext.xml"}); ---->> BLOWS UP RIGHT
> HERE
>
>   IXXAdmin_WS client = (IXXAdmin_WS) context.getBean("client");
>   Client proxy = ClientProxy.getClient( client );
>    Endpoint cxfEndpoint = proxy.getEndpoint();
>    Map<String,Object> outProps = new HashMap<String,Object>();
>    WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
>    outProps.put(WSHandlerConstants.ACTION, "UsernameToken Timestamp");
>    outProps.put(WSHandlerConstants.USER, "ws-client");
>    outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
>    outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS,
> demo.spring.client.ClientPasswordCallbackHandler.class.getName());
> cxfEndpoint.getOutInterceptors().add(wssOut);
>      System.out.println("Server says: " + client.getSuperUserName());
> }
> The clientAppContext.xml is-
> <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.0.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schema/jaxws.xsd">
>
>     <bean id="client"
> class="com.bling.sms.admin.stug.server.manager.IStugAdmin_WS"
> factory-bean="clientFactory" factory-method="create"/>
>    
>     <bean id="clientFactory"
> class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean"> <property
> name="serviceClass"
> value="com.bling.sms.admin.stug.server.manager.IStugAdmin_WS"/> <property
> name="address" value="http://localhost:8080/sms/Stug"/> <property
> name="outInterceptors">
>             <list>
>               <bean
> class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor" /> <ref
> bean="wss4jOutConfiguration" />
>             </list>
>           </property>
>       </bean>
>
>     <bean id="wss4jOutConfiguration"
> class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor"> <property
> name="properties">
>           <map>
>             <entry key="action" value="UsernameToken Timestamp"/>
>             <entry key="user" value="ws-client" />
>             <entry key="passwordType" value="PasswordText" />
>             <entry>
>               <key>
>                 <value>passwordCallbackRef</value>
>               </key>
>               <ref bean="passwordCallback"/>
>             </entry>
>    </map>
>  </property>
>     </bean>
>     <bean id="passwordCallback"
> class="demo.spring.client.ClientPasswordCallbackHandler" /> </beans>
> Stack trace-
> Aug 19, 2008 11:15:49 PM
> org.apache.cxf.service.factory.ReflectionServiceFactory Bean
> buildServiceFromClass
> INFO: Creating Service {http://manager.server.stug.admin.sms.bling.com/}
> IStugAdmin_WSService from class com.bling.sms.admin.stug.server.manager.I
> StugAdmin_WS
> Aug 19, 2008 11:15:49 PM
> org.springframework.beans.factory.support.DefaultSingle tonBeanRegistry
> destroySingletons
> INFO: Destroying singletons in
> org.springframework.beans.factory.support.Default
> ListableBeanFactory@53fb57: defining beans
> [client,clientFactory,wss4jOutConfigu ration,passwordCallback]; root of
> factory hierarchy
> Exception in thread "main"
> org.springframework.beans.factory.BeanCreationExcepti on: Error creating
> bean with name 'client' defined in class path resource [clien
> t/demo/spring/client/clientAppContext.xml]: Instantiation of bean failed;
> nested exception is
> org.springframework.beans.factory.BeanDefinitionStoreException: Fa ctory
> method [public java.lang.Object org.apache.cxf.jaxws.JaxWsProxyFactoryBean
> .create()] threw exception; nested exception is
> java.lang.NullPointerException Caused by:
> org.springframework.beans.factory.BeanDefinitionStoreException: Facto ry
> method [public java.lang.Object
> org.apache.cxf.jaxws.JaxWsProxyFactoryBean.cr eate()] threw exception;
> nested exception is java.lang.NullPointerException Caused by:
> java.lang.NullPointerException
>         at
> org.apache.cxf.common.classloader.ClassLoaderUtils.loadClass2(ClassLo
> aderUtils.java:139)
>         at
> org.apache.cxf.common.classloader.ClassLoaderUtils.loadClass(ClassLoa
> derUtils.java:127)
>         at
> org.apache.cxf.jaxws.support.JaxWsServiceConfiguration.getRequestWrap
> per(JaxWsServiceConfiguration.java:614)
>         at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.getReques
> tWrapper(ReflectionServiceFactoryBean.java:1941)
>         at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.createInp
> utWrappedMessageParts(ReflectionServiceFactoryBean.java:1384)
>         at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.createOpe
> ration(ReflectionServiceFactoryBean.java:765)
>         at
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.createOperation(
> JaxWsServiceFactoryBean.java:473)
>         at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.createInt
> erface(ReflectionServiceFactoryBean.java:739)
>         at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFro
>mClass(ReflectionServiceFactoryBean.java:335) at
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFrom
> Class(JaxWsServiceFactoryBean.java:513)
>         at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializ
> eServiceModel(ReflectionServiceFactoryBean.java:396)
>         at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(Re
> flectionServiceFactoryBean.java:181)
>         at
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServ
> iceFactoryBean.java:163)
>         at
> org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoi
> nt(AbstractWSDLBasedEndpointFactory.java:79)
>         at
> org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.ja
> va:51)
>         at
> org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFact
> oryBean.java:97)
>         at
> org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBe
> an.java:93)
>         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.springframework.beans.factory.support.SimpleInstantiationStrategy
> .instantiate(SimpleInstantiationStrategy.java:118)
>         at
> org.springframework.beans.factory.support.ConstructorResolver.instant
> iateUsingFactoryMethod(ConstructorResolver.java:344)
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBean
> Factory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.ja
>va:78 3)
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBean
> Factory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:710) at
> org.springframework.beans.factory.support.AbstractAutowireCapableBean
> Factory.createBean(AbstractAutowireCapableBeanFactory.java:386)
>         at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
> ject(AbstractBeanFactory.java:249)
>         at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
> y.getSingleton(DefaultSingletonBeanRegistry.java:155)
>         at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean
> (AbstractBeanFactory.java:246)
>         at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean
> (AbstractBeanFactory.java:160)
>         at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.
> preInstantiateSingletons(DefaultListableBeanFactory.java:291)
>         at
> org.springframework.context.support.AbstractApplicationContext.refres
> h(AbstractApplicationContext.java:352)
>         at
> org.springframework.context.support.ClassPathXmlApplicationContext.<i
> nit>(ClassPathXmlApplicationContext.java:122)
>         at
> org.springframework.context.support.ClassPathXmlApplicationContext.<i
> nit>(ClassPathXmlApplicationContext.java:76)
>         at demo.spring.client.ConfigClient.main(ConfigClient.java:40)



-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Mime
View raw message