cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tam, William" <W...@iona.com>
Subject RE: NPE in JaxWsServiceFactoryBean [was Re: svn commit: r469066 ...]
Date Mon, 30 Oct 2006 23:30:55 GMT
My problem was the WSDL that I set to (sf.setWsdlURL(wsdlUrl)) was not
compatible with the service class (sf.setServiceClass(myClass)).
Perhaps, it would be nice to throw ServiceConstructionException in this
case.  Thanks for your help.

-----Original Message-----
From: Dan Diephouse [mailto:dan@envoisolutions.com] 
Sent: Monday, October 30, 2006 5:14 PM
To: cxf-dev@incubator.apache.org
Subject: NPE in JaxWsServiceFactoryBean [was Re: svn commit: r469066
...]

I just took a Greeter implementation and tried this, but it worked 
swimmingly. It looks like:

@WebService(serviceName = "SOAPService",
            portName = "SoapPort",
            endpointInterface =
"org.apache.hello_world_doc_lit.Greeter",
            targetNamespace = "http://apache.org/hello_world_doc_lit")
public class GreeterImplDoc implements Greeter { ... }

And my code was:

 JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
sf.setBus(getBus());
sf.setServiceClass(GreeterImplDoc.class);
sf.setStart(false);
       
Server server = sf.create();

Could you maybe attach a little more code from your end?

- Dan

Tam, William wrote:
> Yes, it is from test-utils.  
>
> Thanks,
> William
>
> -----Original Message-----
> From: Dan Diephouse [mailto:dan@envoisolutions.com] 
> Sent: Monday, October 30, 2006 3:55 PM
> To: cxf-dev@incubator.apache.org
> Cc: cxf-commits@incubator.apache.org
> Subject: Re: svn commit: r469066 [1/3] - in /incubator/cxf/trunk:
> api/src/main/java/org/apache/cxf/databinding/
> api/src/main/java/org/apache/cxf/service/model/
> common/common/src/main/java/org/apache/cxf/configuration/spring/
> common/common/src/test/java/org/apache/
>
> Hola,
> Is this from the doc/lit/bare Greeter in test-utils? If so I will try
it
>
> out myself...
> - Dan
>
> Tam, William wrote:
>
>   
>> Dan,
>>
>> Thanks for you reply.  I am now getting a NPE in
>> JaxWsServiceFactoryBean.initializeParameter().  
>>
>> Regards,
>> William
>>
>> Caused by: java.lang.NullPointerException
>>        at
>>
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeParamete
>>     
> r
>   
>> (JaxWsServiceFactoryBean.java:248)
>>        at
>>
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeParamete
>>     
> r
>   
>> (JaxWsServiceFactoryBean.java:230)
>>        at
>>
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initalizeClassInfo
>>     
> (
>   
>> JaxWsServiceFactoryBean.java:213)
>>        at
>>
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeWSDLOper
>>     
> a
>   
>> tion(JaxWsServiceFactoryBean.java:122)
>>        at
>>
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeW
>>     
> S
>   
>> DLOperations(ReflectionServiceFactoryBean.java:237)
>>        at
>>
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeS
>>     
> e
>   
>> rviceModel(ReflectionServiceFactoryBean.java:177)
>>        at
>>
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(Refl
>>     
> e
>   
>> ctionServiceFactoryBean.java:115)
>>        at
>>
org.mule.providers.wsdl.cxf.CxfMessageReceiver.init(CxfMessageReceiver.
>>     
> j
>   
>> ava:55)
>>        ... 29 more
>>
>> -----Original Message-----
>> From: Dan Diephouse [mailto:dan@envoisolutions.com] 
>> Sent: Monday, October 30, 2006 12:01 PM
>> To: cxf-dev@incubator.apache.org
>> Cc: cxf-commits@incubator.apache.org
>> Subject: Re: svn commit: r469066 [1/3] - in /incubator/cxf/trunk:
>> api/src/main/java/org/apache/cxf/databinding/
>> api/src/main/java/org/apache/cxf/service/model/
>> common/common/src/main/java/org/apache/cxf/configuration/spring/
>> common/common/src/test/java/org/apache/
>>
>> Hi William,
>> As I noted in the commit message, the JAXB databinding works
>>     
> differently
>   
>> now. The ServiceFactory is now responsible for traversing your
service 
>> class and setting the classes on the service model. This removes the 
>> coupling the JAXB databinding had on JAX-WS and also on the notion
that
>>     
>
>   
>> there is always one service class per service (there could be
more...).
>>
>> Then in JAXBDataBinding.initialize(ServiceInfo) we look at the
classes 
>> and add them to the context. Calling new JAXBDatabinding(class) will
>>     
> add
>   
>> that class directly to the context. I would suggest using the 
>> JaxWsServiceFactory to build up your service.
>> Cheers,
>> - Dan
>>
>> Tam, William wrote:
>>  
>>
>>     
>>> Hi Dan,
>>>
>>> Prior to this change, I was able to create a "new
>>> JAXBDataBinding(myClazz)" where myClazz is an interface.  It looks
>>>    
>>>
>>>       
>> like
>>  
>>
>>     
>>> I can no longer construct a JAXBDataBinding object with an
interface.
>>> The following is the stack trace.  It is important for me to be able
>>>    
>>>
>>>       
>> to
>>  
>>
>>     
>>> pass an interface as opposed to an impl class.  Do you have any
>>> suggestions? 
>>>
>>> Regards,
>>> William
>>>
>>> Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException:
1
>>> counts of IllegalAnnotationExceptions
>>> org.apache.hello_world_doc_lit.Greeter is an interface, and JAXB
can't
>>> handle interfaces.
>>>        this problem is related to the following location:
>>>                at org.apache.hello_world_doc_lit.Greeter
>>>
>>>        at
>>>
>>>    
>>>
>>>       
>>
com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(I
>>     
> l
>   
>>  
>>
>>     
>>> legalAnnotationsException.java:66)
>>>        at
>>>
>>>    
>>>
>>>       
>>
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextI
>>     
> m
>   
>>  
>>
>>     
>>> pl.java:361)
>>>        at
>>>
>>>    
>>>
>>>       
>>
com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java
>>     
> :
>   
>>  
>>
>>     
>>> 217)
>>>        at
>>>
>>>    
>>>
>>>       
>>
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:76
>>     
> )
>   
>>  
>>
>>     
>>>        at
>>>
>>>    
>>>
>>>       
>>
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:55
>>     
> )
>   
>>  
>>
>>     
>>>        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
>>> javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:210)
>>>        at javax.xml.bind.ContextFinder.find(ContextFinder.java:368)
>>>        at
>>>    
>>>
>>>       
>> javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
>>  
>>
>>     
>>>        at
>>>    
>>>
>>>       
>> javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
>>  
>>
>>     
>>>        at
>>>
>>>    
>>>
>>>       
>>
org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContext(JAXBDataBinding.j
>>     
> a
>   
>>  
>>
>>     
>>> va:257)
>>>        at
>>> org.apache.cxf.jaxb.JAXBDataBinding.<init>(JAXBDataBinding.java:90)
>>>        at
>>>
>>>    
>>>
>>>       
>>
org.mule.providers.wsdl.cxf.CxfMessageReceiver.createCxfServiceFactory(
>>     
> C
>   
>>  
>>
>>     
>>> xfMessageReceiver.java:146)
>>>        ... 30 more
>>>
>>>  
>>>    
>>>
>>>       
>>  
>>
>>     
>
>
>   


-- 
Dan Diephouse
Envoi Solutions
http://envoisolutions.com
http://netzooid.com/blog


Mime
View raw message