`
happy_tao_cool
  • 浏览: 17742 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

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

    博客分类:
  • java
阅读更多
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数据传输,就不会出现这样的问题。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics