You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Andrew Lamb <la...@yahoo.com> on 2010/06/25 18:47:01 UTC

ClientProxyFactoryBean with corba bindings results in NullPointerException

Hello,

I’m running into an issue using CXF with a legacy Corba application and am
looking for some advice.  

Currently I have a CXF 2.2.9  client up and communicating with a pure corba
server using java 1.6 with sun’s orbd and idlj.  In this setup, the wsdl
<corba:address> location is specified using a corbaname address and in the
client I’m instantiating the corba service and port objects directly.  This
is based directly upon the corba/hello_world example in the CXF samples
directory.  So far so good.

The change I’m trying to make is to remove the corba address from the wsdl
because I don’t want host and port values hard-coded there.  My intended
approach is to use a ClientProxyFactoryBean in the client (rather than
instantiating the corba service object directly) and specify the corbaname
address at runtime.  

So based upon the original hello_world example, my updated service looks
like:

  	<wsdl:service name="HelloWorldCORBAService">
    	  <wsdl:port name="HelloWorldCORBAPort"
binding="tns:HelloWorldCORBABinding">
      	    <corba:address location="IOR:" />
    	  </wsdl:port>
  	</wsdl:service> 

And my updated client looks like:

ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
factory.getInInterceptors().add(new LoggingInInterceptor());
factory.getOutInterceptors().add(new LoggingOutInterceptor());
factory.setServiceClass(HelloWorld.class);
factory.setAddress("corbaname::localhost:1050#HelloWorld");
      
HelloWorld client = (HelloWorld) factory.create(); 
String result = client.greetMe("Hello There");


Running this, I end up with a NullPointerException:

Exception in thread "main" java.lang.NullPointerException
        at
org.apache.cxf.binding.corba.TypeMapCache.get(TypeMapCache.java:40)
        at
org.apache.cxf.binding.corba.CorbaConduit.<init>(CorbaConduit.java:84)
        at
org.apache.cxf.binding.corba.CorbaBindingFactory.getConduit(CorbaBindingFactory.java:110)
        at
org.apache.cxf.binding.corba.CorbaBindingFactory.getConduit(CorbaBindingFactory.java:105)
        at
org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit(AbstractConduitSelector.java:78)
        at
org.apache.cxf.endpoint.UpfrontConduitSelector.prepare(UpfrontConduitSelector.java:61)
        at
org.apache.cxf.endpoint.ClientImpl.prepareConduitSelector(ClientImpl.java:743)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:481)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265)
        at
org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
        at org.apache.cxf.frontend.ClientProxy.invoke(ClientProxy.java:68)
        at $Proxy38.greetMe(Unknown Source)
        at cxf.client.Client.main(Client.java:47)

I’m seeing that DescriptionInfo never gets included as part of the
ServiceInfo when buildServiceFromClass() is called on
ReflectionServiceFactoryBean; whereas DescriptionInfo does eventually get
set if instead buildServiceFromWSDL(…) is called.  It’s the null
DescriptionInfo that eventually trips things up.

So in summary: Can someone help me get this running?  Or is there a better
way to go about pulling host and port values out of my wsdl?  Or is there
some documentation out there that I’m missing?  

Thanks,
Andrew


-- 
View this message in context: http://old.nabble.com/ClientProxyFactoryBean-with-corba-bindings-results-in-NullPointerException-tp28994310p28994310.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: ClientProxyFactoryBean with corba bindings results in NullPointerException

Posted by Andrew Lamb <la...@yahoo.com>.
Thanks Dan,

For anyone interested this is what I ended up with in my client (the wsdl
didn't require any further changes):

      QName SERVICE_NAME = new
QName("http://cxf.apache.org/schemas/cxf/idl/HelloWorld",
                                                        
"HelloWorldCORBAService");
 
      JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
      factory.getInInterceptors().add(new LoggingInInterceptor());
      factory.getOutInterceptors().add(new LoggingOutInterceptor());
      factory.setServiceClass( HelloWorld.class );
      factory.setWsdlLocation( "file:resources/HelloWorld-corba.wsdl" );
      factory.setAddress( "corbaname::localhost:1050#HelloWorld" );
      factory.setServiceName( SERVICE_NAME );
      HelloWorld client = (HelloWorld) factory.create(); 

So in addition to the setWsdlLocation(...) suggestion, I also needed to call
setServiceName(...).  And finally I was only able to get this to work using
a JaxWsProxyFactoryBean factory (rather than my earlier choice of
ClientProxyFactoryBean.)




dkulp wrote:
> 
> On Friday 25 June 2010 12:47:01 pm Andrew Lamb wrote:
>> Hello,
>> 
>> I’m running into an issue using CXF with a legacy Corba application and
>> am
>> looking for some advice.
> 
> Way cool.   I was actually wondering if someone outside of IONA/Progress's 
> customers were using the CORBA binding.    :-)
> 
> 
>  
>> ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
>> factory.getInInterceptors().add(new LoggingInInterceptor());
>> factory.getOutInterceptors().add(new LoggingOutInterceptor());
>> factory.setServiceClass(HelloWorld.class);
>> factory.setAddress("corbaname::localhost:1050#HelloWorld");
> 
> 
> I think you need to add the factory.setWsdlLocation(....) call in there to 
> give it the location of the WSDL that would have the type mapping and such
> in 
> it.      That alone may solve it.    Let me know how it works out.
> 
> Dan
> 
> 
>> 
>> HelloWorld client = (HelloWorld) factory.create();
>> String result = client.greetMe("Hello There");
>> 
>> 
>> Running this, I end up with a NullPointerException:
>> 
>> Exception in thread "main" java.lang.NullPointerException
>>         at
>> org.apache.cxf.binding.corba.TypeMapCache.get(TypeMapCache.java:40)
>>         at
>> org.apache.cxf.binding.corba.CorbaConduit.<init>(CorbaConduit.java:84)
>>         at
>> org.apache.cxf.binding.corba.CorbaBindingFactory.getConduit(CorbaBindingFac
>> tory.java:110) at
>> org.apache.cxf.binding.corba.CorbaBindingFactory.getConduit(CorbaBindingFac
>> tory.java:105) at
>> org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit(Abstract
>> ConduitSelector.java:78) at
>> org.apache.cxf.endpoint.UpfrontConduitSelector.prepare(UpfrontConduitSelect
>> or.java:61) at
>> org.apache.cxf.endpoint.ClientImpl.prepareConduitSelector(ClientImpl.java:7
>> 43) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:481) at
>> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313) at
>> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265) at
>> org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
>>         at
>> org.apache.cxf.frontend.ClientProxy.invoke(ClientProxy.java:68)
>>         at $Proxy38.greetMe(Unknown Source)
>>         at cxf.client.Client.main(Client.java:47)
>> 
>> I’m seeing that DescriptionInfo never gets included as part of the
>> ServiceInfo when buildServiceFromClass() is called on
>> ReflectionServiceFactoryBean; whereas DescriptionInfo does eventually get
>> set if instead buildServiceFromWSDL(…) is called.  It’s the null
>> DescriptionInfo that eventually trips things up.
>> 
>> So in summary: Can someone help me get this running?  Or is there a
>> better
>> way to go about pulling host and port values out of my wsdl?  Or is there
>> some documentation out there that I’m missing?
>> 
>> Thanks,
>> Andrew
> 
> -- 
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog
> 
> 

-- 
View this message in context: http://old.nabble.com/ClientProxyFactoryBean-with-corba-bindings-results-in-NullPointerException-tp28994310p28996240.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: ClientProxyFactoryBean with corba bindings results in NullPointerException

Posted by Daniel Kulp <dk...@apache.org>.
On Friday 25 June 2010 12:47:01 pm Andrew Lamb wrote:
> Hello,
> 
> I’m running into an issue using CXF with a legacy Corba application and am
> looking for some advice.

Way cool.   I was actually wondering if someone outside of IONA/Progress's 
customers were using the CORBA binding.    :-)


 
> ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
> factory.getInInterceptors().add(new LoggingInInterceptor());
> factory.getOutInterceptors().add(new LoggingOutInterceptor());
> factory.setServiceClass(HelloWorld.class);
> factory.setAddress("corbaname::localhost:1050#HelloWorld");


I think you need to add the factory.setWsdlLocation(....) call in there to 
give it the location of the WSDL that would have the type mapping and such in 
it.      That alone may solve it.    Let me know how it works out.

Dan


> 
> HelloWorld client = (HelloWorld) factory.create();
> String result = client.greetMe("Hello There");
> 
> 
> Running this, I end up with a NullPointerException:
> 
> Exception in thread "main" java.lang.NullPointerException
>         at
> org.apache.cxf.binding.corba.TypeMapCache.get(TypeMapCache.java:40)
>         at
> org.apache.cxf.binding.corba.CorbaConduit.<init>(CorbaConduit.java:84)
>         at
> org.apache.cxf.binding.corba.CorbaBindingFactory.getConduit(CorbaBindingFac
> tory.java:110) at
> org.apache.cxf.binding.corba.CorbaBindingFactory.getConduit(CorbaBindingFac
> tory.java:105) at
> org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit(Abstract
> ConduitSelector.java:78) at
> org.apache.cxf.endpoint.UpfrontConduitSelector.prepare(UpfrontConduitSelect
> or.java:61) at
> org.apache.cxf.endpoint.ClientImpl.prepareConduitSelector(ClientImpl.java:7
> 43) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:481) at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313) at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265) at
> org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
>         at org.apache.cxf.frontend.ClientProxy.invoke(ClientProxy.java:68)
>         at $Proxy38.greetMe(Unknown Source)
>         at cxf.client.Client.main(Client.java:47)
> 
> I’m seeing that DescriptionInfo never gets included as part of the
> ServiceInfo when buildServiceFromClass() is called on
> ReflectionServiceFactoryBean; whereas DescriptionInfo does eventually get
> set if instead buildServiceFromWSDL(…) is called.  It’s the null
> DescriptionInfo that eventually trips things up.
> 
> So in summary: Can someone help me get this running?  Or is there a better
> way to go about pulling host and port values out of my wsdl?  Or is there
> some documentation out there that I’m missing?
> 
> Thanks,
> Andrew

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