Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to create JAXBContext in Java Web service

I used NetBeans to create a Metro Web service and to be deployed on GlassFish. I get an error when I try to build but only if one of the operations in the web service returns an Object instead of a primitive type or String.

The error:

Deploying application in domain failed; Deployment Error -- Exception occured in the wsgen process javax.xml.ws.WebServiceException: Unable to create JAXBContext
build-impl.xml:569: The module has not been deployed.
BUILD FAILED (total time: 2 seconds)

The containing code:

<target if="netbeans.home" name="-run-deploy-nb">
    <nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/>
</target>

Any help is appreciated!

like image 403
Sulaiman Avatar asked Jul 22 '26 19:07

Sulaiman


1 Answers

This thread is also a good illustration of your problem:

The problem is that the custom class has public access for the properties and also it has getter/setter methods.
I discover because you can use Netbeans to generate the WSDL files for the Webservice to inspect them. Doing so it returned the detailed error.
If you want to use it, write your Web Service, then go to "Web Services" node, select your Web Service, right click it and select "Generate and Copy WSDL".

You can find some practical advices here on the definition of your object.

And of course you still have the Java Web Service Tutorial exposing the Requirements of a JAX-WS Endpoint.

like image 142
VonC Avatar answered Jul 24 '26 10:07

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!