启动webservice时候抛出异常:java.security.PrivilegedActionException

Exception in thread "main" javax.xml.ws.WebServiceException: Unable to create JAXBContext
	at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:153)
	at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:83)
	at com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:244)
	at com.sun.xml.internal.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:312)
	at com.sun.xml.internal.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:178)
	at com.sun.xml.internal.ws.api.server.WSEndpoint.create(WSEndpoint.java:456)
	at com.sun.xml.internal.ws.api.server.WSEndpoint.create(WSEndpoint.java:475)
	at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.createEndpoint(EndpointImpl.java:213)
	at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(EndpointImpl.java:143)
	at com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:102)
	at javax.xml.ws.Endpoint.publish(Endpoint.java:170)
	at com.webservice.WsPublisher.main(WsPublisher.java:20)
Caused by: java.security.PrivilegedActionException: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
java.util.Map is an interface, and JAXB can't handle interfaces.
	this problem is related to the following location:
		at java.util.Map
		at public java.util.Map com.webservice.jaxws.SayHelloWorld2Response._return
		at com.webservice.jaxws.SayHelloWorld2Response
java.util.Map does not have a no-arg default constructor.
	this problem is related to the following location:
		at java.util.Map
		at public java.util.Map com.webservice.jaxws.SayHelloWorld2Response._return
		at com.webservice.jaxws.SayHelloWorld2Response

	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:140)
	... 11 more

 

当运行时抛出异常 java.security.PrivilegedActionException时候,查看异常说是没办法处理接口,但是当我换成HashMap的时候,是可以处理的;不过有个问题,就是生成客户端的时候,Jax-Ms会帮你生成一个HashMap类,这个类里面是空的,客户端服务不是调用java.util包下的HashMap,而是调用webservice生成的HashMap,所以并不能实现需求。

 

解决方案:使用数组或者json数据传输,就不会出现这样的问题。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值