关于JAX-WS的Unable to create JAXBContext错误

参考: http://53873039oycg.iteye.com/blog/1979421

今天学了下Jax-Ws的一个简单的例子,刚开始发布时遇到如下错误:

Java代码

com.sun.xml.internal.ws.model.RuntimeModelerException: runtime modeler error: Wrapper class com.test.service.jaxws.add is not found. Have you run APT to generate them?
SOAPBinding  

网上查了下资料,说是要指定

Java代码

  原因:

1 SOAPBinding的style默认为SOAPBinding.Style.DOCUMENT,要修改为RPC
2 Jdk1.6版本低,换个高点的版本就可以了

于是在接口上指定绑定的类型

Java代码

@SOAPBinding(style = SOAPBinding.Style.RPC)  

中午时候,想着以后每次都要写这么一行,麻烦,就把电脑上的jdk1.6.0.10换成了jdk1.6.0.32。

下午试着返回List<User>类型,以前用过CXF,记得CXF的Jax-Ws返回List<JavaBean>这种类型是不需要配置的,结果刚发布就报错,错误信息如下:

Java代码

  1. 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.huse.ws.basic.chap.server.test.MyServer.main(MyServer.java:13)
    Caused by: java.security.PrivilegedActionException: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
    java.util.List is an interface, and JAXB can‘t handle interfaces.
        this problem is related to the following location:
            at java.util.List
    java.util.List does not have a no-arg default constructor.
        this problem is related to the following location:
            at java.util.List  
    
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:140)
        ... 11 more

    遇到错误自己又不会于是谷歌了下,没找到我要的,又百度了下,网上说加上

Java代码

  1. @SOAPBinding(style = SOAPBinding.Style.RPC)
    @WebMethod 

就OK了,RPC我有,就在实现类上加了@WebMethod,一发布还是报错,在又百度几次无果后,一次偶然的机会我把

Java代码

  @SOAPBinding(style = SOAPBinding.Style.RPC)

这一行删了,再次发布,结果如下:

Java代码

  1. 2013-11-22 14:38:08 com.sun.xml.internal.ws.model.RuntimeModeler getRequestWrapperClass
    信息: Dynamically creating request wrapper Class com.huse.ws.basic.chap.server.inter.jaxws.Plus
    2013-11-22 14:38:08 com.sun.xml.internal.ws.model.RuntimeModeler getResponseWrapperClass
    信息: Dynamically creating response wrapper bean Class com.huse.ws.basic.chap.server.inter.jaxws.PlusResponse
    2013-11-22 14:38:08 com.sun.xml.internal.ws.model.RuntimeModeler getRequestWrapperClass
    信息: Dynamically creating request wrapper Class com.huse.ws.basic.chap.server.inter.jaxws.Minus
    2013-11-22 14:38:08 com.sun.xml.internal.ws.model.RuntimeModeler getResponseWrapperClass
    信息: Dynamically creating response wrapper bean Class com.huse.ws.basic.chap.server.inter.jaxws.MinusResponse
    2013-11-22 14:38:08 com.sun.xml.internal.ws.model.RuntimeModeler getRequestWrapperClass
    信息: Dynamically creating request wrapper Class com.huse.ws.basic.chap.server.inter.jaxws.AddUser
    2013-11-22 14:38:08 com.sun.xml.internal.ws.model.RuntimeModeler getResponseWrapperClass
    信息: Dynamically creating response wrapper bean Class com.huse.ws.basic.chap.server.inter.jaxws.AddUserResponse
    2013-11-22 14:38:08 com.sun.xml.internal.ws.model.RuntimeModeler getRequestWrapperClass
    信息: Dynamically creating request wrapper Class com.huse.ws.basic.chap.server.inter.jaxws.GetUser
    2013-11-22 14:38:08 com.sun.xml.internal.ws.model.RuntimeModeler getResponseWrapperClass
    信息: Dynamically creating response wrapper bean Class com.huse.ws.basic.chap.server.inter.jaxws.GetUserResponse
    2013-11-22 14:38:08 com.sun.xml.internal.ws.model.RuntimeModeler getRequestWrapperClass
    信息: Dynamically creating request wrapper Class com.huse.ws.basic.chap.server.inter.jaxws.ListUser
    2013-11-22 14:38:08 com.sun.xml.internal.ws.model.RuntimeModeler getResponseWrapperClass
    信息: Dynamically creating response wrapper bean Class com.huse.ws.basic.chap.server.inter.jaxws.ListUserResponse
    2013-11-22 14:38:08 com.sun.xml.internal.ws.model.RuntimeModeler getRequestWrapperClass
    信息: Dynamically creating request wrapper Class com.huse.ws.basic.chap.server.inter.jaxws.Login
    2013-11-22 14:38:08 com.sun.xml.internal.ws.model.RuntimeModeler getResponseWrapperClass
    信息: Dynamically creating response wrapper bean Class com.huse.ws.basic.chap.server.inter.jaxws.LoginResponse
    2013-11-22 14:38:08 com.sun.xml.internal.ws.model.RuntimeModeler getExceptionBeanClass
    信息: Dynamically creating exception bean Class com.huse.ws.basic.chap.server.inter.jaxws.UserExceptionBean  

OK了。

再次说明,本次Jdk版本是jdk.1.6.0.32,Jdk1.6.0.10上面我没测试过。

时间: 2024-10-09 23:25:33

关于JAX-WS的Unable to create JAXBContext错误的相关文章

An internal error occurred during: &quot;Generating JAX-WS Web Services&quot;.Unable to create JAXBContext

使用myeclipse10 创建webservice时,提示错误: An internal error occurred during: "Generating JAX-WS Web Services".Unable to create JAXBContext 需要引入相关jar包 我这边只引用最新版的1.2两个就OK了.

python pip fatal error in launcher unable to create process using

用pip安装一个包,不知道为啥,就报了这个错误:python pip fatal error in launcher unable to create process using “” 百度了一下,用下面的命令可以解决,搞定 python2 -m pip install XXX  另外,Python3 的pip我用python3 -m pip install --upgrade pip 搞定

File upload error - unable to create a temporary file

php上传图片的时候会报错: File upload error - unable to create a temporary file 文件上传错误 - 无法创建一个临时文件 你只需要打开你的php.ini文件,设置upload_tmp_dir="f:\temp"  然后重启环境就可以了,如果还不行就去看看文件夹的权限是否有权限,赋予写入权限就好了

python3.6执行pip3时 Unable to create process using &#39;&quot;&#39;

背景: 由于在windows操作系统中已经安装了python2.7,之前安装过python3.4,现已卸载, 将python3.6安装在C:\Python36目录下 然后进入C:\Python36目录下执行pip -V能正常使用 但是为了同时使用python2和python3,于是将python.exe改名为python3.exe,重新执行pip -V 发现错误 C:\Python36>pip3 Fatal error in launcher: Unable to create process

配置ssh框架启动tomcat服务器报异常Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]

在Spring中配置jdbc时,引用的是dbcp.jar包,在db.properties配置文件中,使用了之前的properties配置文件的用户名username(MySql用户名) 然后在启动服务器报了如下几个异常: 1.org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [a

002-Fatal error in launcher: Unable to create process using &#39;&quot;&quot;

这个问题出在先安装Python3之后再安装python2, 使用pip安装的时候出现的故障 原因是python3的环境变量写入在了用户的环境变量上 但是一旦安装python2之后, Python会把信息写到系统环境变量上 此时使用pip就会出现Fatal error in launcher: Unable to create process using '"" 解决办法: 将python3的信息加入到系统环境变量中   002-Fatal error in launcher: Unab

AndroidStudio——Unable to create Debug Bridge

1.错误描述:Unable to create Debug Bridge:Unable to start adb server: error: cannot parse version string: kg01 2.出错原因:有应用程序占用端口,eg:酷我音乐 3.解决方案:打开任务管理器结束该进程,eg:kadb

Error: The VPN client agent was unable to create the interprocess communication depot.

当安装Cisco AnyConnect VPN Client出现The VPN client agent was unable to create the interprocess communication depot.时,请先在你的本地网络或无线网络中,设置如下: 注意其中的Checkbox并没有被选中!!!!!!

【python】win10中python3.5.2输入pip出现Fatal error in launcher: Unable to create process using &#39;&quot;&#39;

系统:windows 10 python版本:3.5.2 出现的错误如下: C:\Users\zhuxy>pip list Fatal error in launcher: Unable to create process using '"' 尝试的解决办法: C:\Users\zhuxy>python -m pip install package Collecting package Downloading package-0.1.1.tar.gz Complete output