users@jax-ws.java.net

Re: NullPointerException when running client

From: Daniel Robinson <nelkahn_at_gmail.com>
Date: Fri, 30 Jun 2006 14:50:02 +0200

I have got round this by disabling assertions. I am not sure what the
assertion is, but it does not seem to be very usefull as the code function
without it. Which confirms what I suspected in that the source code from the
stable jax-ws package does not match the binaries distributed though the
jwsdp2.0 project.

I need to work with assertions however so this can only be a temporary work
around for me.

The problem seems to be for me to put together a complete set of libraries
to work with. I am currently using the jwsdp2.0 jars files. These are
clearly outdated. The question is how to go about replacing them with an up
to date and coherent set. How could I go about putting together such a
package (if possible with source code so I can analyse the problems a bit
more myself) ?

Thanks for the help

Daniel


On 29/06/06, Daniel Robinson <nelkahn_at_gmail.com> wrote:
>
>
> I have generated the needed classes using wsimport. That has worked and I
> now seem to get a little bit further along using this mechanism.
>
> However I am now blocked by an assertion error :
>
> Exception in thread "Thread-8" java.lang.AssertionError
> at com.sun.xml.ws.wsdl.parser.WSDLDocument.finalizeBinding(
> WSDLDocument.java:194)
> at com.sun.xml.ws.wsdl.parser.Binding.finalizeBinding(Binding.java:92)
> at com.sun.xml.ws.model.RuntimeModel.applyParameterBinding (
> RuntimeModel.java:346)
> at com.sun.xml.ws.client.WSServiceDelegate.buildEndpointIFProxy(
> WSServiceDelegate.java:362)
> at com.sun.xml.ws.client.WSServiceDelegate.createEndpointIFBaseProxy(
> WSServiceDelegate.java :284)
> at com.sun.xml.ws.client.WSServiceDelegate.getPort(
> WSServiceDelegate.java:171)
> at javax.xml.ws.Service.getPort(Service.java:95)
> at be.inveo.wsdl.add.ImplementorService.getImplementorServicePort(
> ImplementorService.java:54)
> at be.inveo.jet.test.webservices.WebServiceTestNut$1.run(
> WebServiceTestNut.java:107)
> at be.inveo.jet.test.webservices.WebServiceTestNut$1.run(
> WebServiceTestNut.java:1)
>
> at java.security.AccessController.doPrivileged (Native Method)
> at be.inveo.jet.test.webservices.WebServiceTestNut.run(
> WebServiceTestNut.java:103)
>
> at java.lang.Thread.run(Thread.java:595)
>
>
> As you suggested I moved back to the jaxws 2.0 release.
>
> This has got me a bit stuck as it is not clear what the error may be now.
>
> Daniel
>
>
>
>
> On 28/06/06, kathy walsh < Kathleen.Walsh_at_sun.com> wrote:
> >
> > Daniel- Please see below-
> >
> > Daniel Robinson wrote:
> >
> > >
> > > Kathy,
> > >
> > > Thanks for the quick reply.
> > >
> > > The server side in running in Java 6_beta2_b84 (and therefore the
> > > integrated jaxws).
> >
> > yes
> >
> > >
> > >
> > > The client side is running on Java 5 with version
> > > JAXWS2.0.1ea_2006-06-23_11-00-18.jar that I downloaded from the
> > > nightly build web site : https://jax-ws.dev.java.net/ri-download.html.
> >
> > Ok beware that JAXWS 2.0.1ea nightly builds can be very unstable. If you
> > need stability of the bits use JAXWS 2.0 FCS.
> >
> > >
> > >
> > > I am not quite certain what you mean by your HelloService example.
> > > What service class do you want me to instantiate? I do not have a
> > > service implementation on the client side. All I have is a java
> > > interface that matches the WSDL signature.
> >
> > Where did you get the java interface?
> >
> > >
> > >
> > > Is this the part that I went wrong? Should I have generated something
> > > on the client side based on the WSDL?
> >
> > Yes. Typically, the JAXWS client side programming model with java 5 is
> > to generate needed classes from the WSDL.
> > Included in these generated classes would be the service class and the
> > java sei reflecting the wsdl to java
> > mapping, along with any javabean classes. The service class would be
> > instantiated and the getPort() method
> > invoked on the service.
> >
> > Generating needed classes is done using the wsimport tools. Please read
> >
> > the Users guide that comes with jaxws 2.0
> > regarding tool use.
> >
> > After you read this info on wsimport let us know if you have any
> > questions-
> >
> > Thanks,
> > Kathy
> >
> >
> > >
> > >
> > >
> > > Daniel
> > >
> > >
> > >
> > > On 28/06/06, * kathy walsh* <Kathleen.Walsh_at_sun.com
> > > <mailto:Kathleen.Walsh_at_sun.com>> wrote:
> > >
> > >
> > > Daniel,
> > >
> > > What version of jaxws are you using with your program and where
> > > did you
> > > get it from?
> > >
> > > I suspect that there is a difference in the runtime you are using
> > of
> > > jaxws that comes with java 6
> > > versus what you are using with java 5.
> > >
> > > In your program try creating the service by instantiating the
> > > service class.
> > >
> > > HelloService helloService = new HelloService();
> > >
> > > HelloPort hello = helloService.getHelloPort();
> > >
> > >
> > > Please let us know if you have more problems-
> > >
> > > Thanks,
> > > Kathy
> > >
> > >
> > >
> > >
> > >
> > > Daniel Robinson wrote:
> > >
> > > >
> > > > Hello all,
> > > >
> > > > I have got a simple WebService running. I have successfully
> > > called it
> > > > from Perl.
> > > >
> > > > I have also sucessfully called it using a java client running in
> > > Java 6.
> > > >
> > > > However I now need to get this working in Java 5. I am starting
> > > by the
> > > > client side of things. This is where I get the
> > > NullPointerException. I
> > > > have had a look through the source code and am unsur how this
> > > could work.
> > > >
> > > > This is the trace I get :
> > > >
> > > > java.lang.NullPointerException
> > > > at
> > > >
> > > com.sun.xml.ws.client.WSServiceDelegate.createEndpointIFBaseProxy(
> > WSServiceDelegate.java:352)
> > > > at com.sun.xml.ws.client.WSServiceDelegate.getPort
> > > > (WSServiceDelegate.java:242)
> > > > at javax.xml.ws.Service.getPort(Service.java:94)
> > > > at
> > > >
> > >
> > jet.container.managers.webservicesclient.WebServicesClientManager$1.run
> > > (WebServicesClientManager.java:101)
> > > > at java.security.AccessController.doPrivileged (Native
> > Method)
> > > > at
> > > >
> > >
> > jet.container.managers.webservicesclient.WebServicesClientManager.getWebServiceInstance
> > > (WebServicesClientManager.java:96)
> > > > at
> > > >
> > >
> > jet.container.managers.webservicesclient.WebServicesClientManager.invoke
> > > > (WebServicesClientManager.java:77)
> > > > at
> > > > jet.container.exchange.AbstractContext.invoke
> > > (AbstractContext.java:300)
> > > > at
> > > >
> > >
> > jet.container.managers.webservicesclient.WebServicesClientManagerContextImpl.getWebServiceInstance
> > > > (WebServicesClientManagerContextImpl.java :28)
> > > > at
> > > >
> > > be.inveo.jet.test.webservices.WebServiceTestNut.run(
> > WebServiceTestNut.java:92)
> > > > at java.lang.Thread.run(Thread.java:595)
> > > >
> > > >
> > > > AS you can see the problem starts in the getPort method. This is
> > > how
> > > > things are called in the client :
> > > >
> > > >
> > > > private Object getWebServiceInstance(final Class sei, final
> > URL
> > > > wsdlLocation, final String namespaceURI, final String
> > serviceName,
> > > > final String portName) throws ConnectException {
> > > > final QName serviceQName = new QName(namespaceURI,
> > > serviceName);
> > > >
> > > > Object obj = null;
> > > > try {
> > > > obj = AccessController.doPrivileged(new
> > > > PrivilegedExceptionAction<Object>() {
> > > > public Object run() throws Exception {
> > > > Service service = Service.create
> > (wsdlLocation,
> > > > serviceQName);
> > > >
> > > > QName portQName = new QName(namespaceURI,
> > > portName);
> > > > Object proxy = service.getPort(portQName,
> > sei);
> > > > BindingProvider bp = (BindingProvider)
> > proxy;
> > > >
> > > > Map<String, Object> context =
> > > bp.getRequestContext();
> > > >
> > > > context.put(BindingProvider.SESSION_MAINTAIN_PROPERTY,
> > > Boolean.TRUE);
> > > >
> > > > return proxy;
> > > > }
> > > > });
> > > > } catch (PrivilegedActionException pae) {
> > > > Throwable t = pae.getCause();
> > > > if (t instanceof WebServiceException) {
> > > > WebServiceException wse = (WebServiceException)
> > t;
> > > > throw wse;
> > > > }
> > > > if (t instanceof ConnectException) {
> > > > ConnectException ce = (ConnectException) t;
> > > > throw ce;
> > > > }
> > > > }
> > > >
> > > >
> > > > return obj;
> > > > }
> > > >
> > > >
> > > >
> > > > When I run this through the debugger I can see that the problem
> > is
> > > > that the seiContext in the WSServiceDelegate is empty. This is
> > the
> > > > case as the addSEI() method is not called in the constructor as
> > the
> > > > serviceClass == Service.class.
> > > >
> > > > It is not clear where I have gone wrong (though I am certain I
> > have
> > > > gone wrong somewhere). The NullPointerException is not much help
> > > however.
> > > >
> > > > Does anybody with a better understanding of the inner workings
> > of
> > > > JAX-WS know what is going on here?
> > > >
> > > > Thank you in advance for any help.
> > > >
> > > > Daniel
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe_at_jax-ws.dev.java.net
> > > <mailto:users-unsubscribe_at_jax-ws.dev.java.net>
> > > For additional commands, e-mail: users-help_at_jax-ws.dev.java.net
> > > <mailto:users-help_at_jax-ws.dev.java.net>
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe_at_jax-ws.dev.java.net
> > For additional commands, e-mail: users-help_at_jax-ws.dev.java.net
> >
> >
>