无法在Java Web服务中创建JAXBContext

无法在Java Web服务中创建JAXBContext,java,web-services,jakarta-ee,glassfish,Java,Web Services,Jakarta Ee,Glassfish,我使用NetBeans创建Metro Web服务并部署到GlassFish上。 当我尝试构建时,但仅当web服务中的一个操作返回对象而不是基元类型或字符串时,才会出现错误 错误: Deploying application in domain failed; Deployment Error -- Exception occured in the wsgen process javax.xml.ws.WebServiceException: Unable to create JAXBContex

我使用NetBeans创建Metro Web服务并部署到GlassFish上。 当我尝试构建时,但仅当web服务中的一个操作返回对象而不是基元类型或字符串时,才会出现错误

错误:

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)
包含代码:

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

感谢您的帮助

我找到了解决办法

我返回的类也有一个公共值,set和get,因此删除它们并正常工作也很好地说明了您的问题:

问题在于自定义类对属性具有公共访问权限,并且它还具有getter/setter方法。
我发现这一点是因为您可以使用Netbeans为
Webservice
生成
WSDL
文件来检查它们。这样做会返回详细错误。
如果要使用它,请编写Web服务,然后转到“
Web服务
”节点,选择您的Web服务,右键单击它并选择“生成并复制
WSDL

你可以在网上找到一些实用的建议


当然,你仍然有曝光的机会。

以上步骤对我不起作用。我们所做的是在返回的对象的MyClass中添加一个空构造函数,即ArrayList

(NB6.9.1,GF2.X,Windows XP x64)