Skip to content
 

Don’t try to use a web service from the Java source

A quick one to remember, more to save myself some pain when I forget what the problem was, but if anyone is helped out by this post then that would be a great thing too.

Never try to invoke a method on a Java web service using the source of the web service, e.g:

@WebServiceRef(wsdlLocation=”http://localhost:8080/blah/blah?wsdll”)
private static BlahService blahService;
blahService.myBlahMethod();
This will compile and build but bad things will happen when you try to deploy it, Glassfish gave a particularly unhelpful error (included in the stack trace was a very generic JavaEEDeployer exception, drilling down to a null pointer in ConcurrentHashMap).
Needless to say this is a stupid mistake to make, easily rectified by compiling the stubs for the web service you are trying to use and using the above code with the stubs allowing you to access the .getPort() method which in turn allows you to use the web service. Or in my case simply commenting out the code as it was shortly to be removed anyway.
Several hours were lost in the making of this cautionary tale!

Leave a Reply