webservice,作为web开发人员来说必须掌握的一门技术,它的好处这里就不多说了,eclipse中自带了一种生成webservice的 方法,使用JAX-WS,如果我没有弄错的话,它需要javaEE5.0、JDK1.5以上,了解完这些就开始写接口方法。各种随心所欲。不料在用 eclipse生成webservice时出现错误了,生成不了,错误信息如下“ An internal error occurred during: "Generating JAX-WS Web Services". Unable to create JAXBContext ”  ,错误堆栈如下:

十一月 16, 2015 1:01:32 下午 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
十一月 16, 2015 1:01:35 下午 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter ssoFilter
javax.xml.ws.WebServiceException: Unable to create JAXBContext
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:156)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:84)
at com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:234)
at com.sun.xml.internal.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:328)
at com.sun.xml.internal.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:190)
at com.sun.xml.internal.ws.api.server.WSEndpoint.create(WSEndpoint.java:498)
at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.createEndpoint(EndpointImpl.java:246)
at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(EndpointImpl.java:170)
at com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:118)
at javax.xml.ws.Endpoint.publish(Endpoint.java:240)
at com.pcitc.sso.client.SSOFilter.init(SSOFilter.java:42)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4038)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4692)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:701)
at org.apache.catalina.startup.Catalina.start(Catalina.java:585)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.security.PrivilegedActionException: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
javax.servlet.http.HttpServletRequest is an interface, and JAXB can't handle interfaces.
this problem is related to the following location:
at javax.servlet.http.HttpServletRequest
at public javax.servlet.http.HttpServletRequest com.pcitc.sso.client.webservice.jaxws.GetLoginUser.arg0
at com.pcitc.sso.client.webservice.jaxws.GetLoginUser
javax.servlet.http.HttpServletResponse is an interface, and JAXB can't handle interfaces.
this problem is related to the following location:
at javax.servlet.http.HttpServletResponse
at public javax.servlet.http.HttpServletResponse com.pcitc.sso.client.webservice.jaxws.GetLoginUser.arg1
at com.pcitc.sso.client.webservice.jaxws.GetLoginUser at java.security.AccessController.doPrivileged(Native Method)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:143)
... 37 more
Caused by: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
javax.servlet.http.HttpServletRequest is an interface, and JAXB can't handle interfaces.
this problem is related to the following location:
at javax.servlet.http.HttpServletRequest
at public javax.servlet.http.HttpServletRequest com.pcitc.sso.client.webservice.jaxws.GetLoginUser.arg0
at com.pcitc.sso.client.webservice.jaxws.GetLoginUser
javax.servlet.http.HttpServletResponse is an interface, and JAXB can't handle interfaces.
this problem is related to the following location:
at javax.servlet.http.HttpServletResponse
at public javax.servlet.http.HttpServletResponse com.pcitc.sso.client.webservice.jaxws.GetLoginUser.arg1
at com.pcitc.sso.client.webservice.jaxws.GetLoginUser at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:91)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:442)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:274)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:125)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1127)
at com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:173)
at com.sun.xml.internal.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:95)
at com.sun.xml.internal.ws.developer.JAXBContextFactory$1.createJAXBContext(JAXBContextFactory.java:98)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:151)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:143)
... 39 more 十一月 16, 2015 1:01:35 下午 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext

真心让人郁闷,尤其是刚开始搞webservice的时候。其实仔细阅读一下堆栈信息就会发现,说 HttpServletRequest ,HttpServletResponse 是一个接口,而JAXB不能处理接口。记得网上有人说 JAX-WS只支持基本数据类型,int、String等,其实不是的,JAX支持的数据类型很多,List、HashMap、自定义对象等等都没问题, 只是不能处理接口,那就在方法的参数和返回值上不要有接口就好了。

Java使用JAX-WS来写webservice时 Unable to create JAXBContext的更多相关文章

  1. JDK 1.6 写Webservice时,runtime modeler error: Wrapper class com.ws.jaxws.DoSomething is not found问题的解决办法

    转自:http://blog.csdn.net/forandever/article/details/5276038 1.问题如下: Exception in thread "main&qu ...

  2. python3.6执行pip3时 Unable to create process using '"'

    问题需求 由于在windows操作系统中已经安装了python2.7,要在安装python3的时候 将python3.6安装在C:\Python36目录下 然后进入C:\Python36目录下执行pi ...

  3. java写webservice接口

    有一个需求:要求根据设备mac和终端设备类型来查询设备库存状态. 接口协议是采用webservice协议,信息交互方式为xml格式信息 输入参数存放到XML各个节点下,并转为一个String,作为接口 ...

  4. java写文件时,输出不完整的原因以及解决方法

    在java的IO体系中,写文件通常会用到下面语句 BufferedWriter bo=new BufferedWriter(new FileWriter("sql语句.txt")) ...

  5. java写文件时,输出不完整的原因以及解决方法close()或flush()

    在java的IO体系中,写文件通常会用到下面语句 BufferedWriter bw=new BufferedWriter(new FileWriter("sql语句.txt")) ...

  6. 使用 Java 程序写文件时,记得要 flush()

    使用 Java 程序往磁盘写文件时碰到了这样的问题:文件写不全. 假如内容(StringBuffer/StringBuilder)有 100W 个字符,但是通过 Java 程序写到文件里的却不到 10 ...

  7. jdk写webservice

    jdk写webservice 1.定义一个需要发布的类,使用@WebService注解. 2.需要发布的方法可以不用@WebMethod注解,如果需要改变访问方法名,可用@WebMethod修改. 3 ...

  8. 动态调用webservice时 ServiceDescriptionImporter类在vs2010无法引用的解决方法

    [导读]ServiceDescriptionImporter是创建Web Service 时使用的类,它是引用继承System.Web.Services 当我将VS2005里写的一段代码放在VS201 ...

  9. java代码,用continue写出偶数

    总结:不满足条件时,输出当前==== package com.b; import java.util.Scanner; //用continue写出偶数的代码是: public class twe { ...

随机推荐

  1. Ubuntu server搭建vsftpd小记

    Ubuntu server中搭建vsftpd小记 <h1> 在Ubuntu server中安装vsftpd</h1> sudo apt-get install vsftpd & ...

  2. zzzzw_在线考试系统③完结篇

    昨天填完原本打算写有关“学生考试部门”的总结,但是因为时间来不及,所以推迟到今天来写. 至于最后的:“老师登录”部门就没什么好说的了,只要会了“管理员部分”和“学生考试部分”的书写,剩下就只是耐心的一 ...

  3. java ssm框架入门(一)面向接口编程

    因为工作上用到spring + strtus2 + mybatis ,所以开始学习下这个框架. 这里用到的是MySQL数据库 首先从web.xml 开始 <?xml version=" ...

  4. 错误编码 = 10022 错误消息 = SDK 组件 Qupaisdk 启动出错,错误消息为 [Qupaisdk], the android stack error message is Fail to start the plugin, which is caused by No implem

     so没有load到.几个可能,1.缺少so--在群共享下载拷贝到armeabi-v7a 2.so没有打入apk--检查打出来的apk.解压打开看下libs下面有没有so. 3.abi平台问题.检查平 ...

  5. JS调用PHP 和 PHP调用JS的方法举例

    http://my.oschina.net/jiangchike/blog/220988 1.JS方式调用PHP文件并取得PHP中的值举一个简单的例子来说明:如在页面test_json1中用下面这句调 ...

  6. DLL使用总结

    最近项目中使用到了DLL,因此就把最近一段时间的学习总结一下,以备不时之需. 一.相关概念 1.动态链接库 自从微软推出第一个版本的Windows操作系统以来,动态链接库(DLL)一直是Windows ...

  7. HDU 1176 免费馅饼(数字三角形)

    免费馅饼 Problem Description 都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼.说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉 ...

  8. HDU 2809 God of War(DP + 状态压缩)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2809 题目大意:给出战神吕布的初始攻击力ATI.防御力DEF.生命值HP.每升一级增加的攻击力In_A ...

  9. 使用Idea编写javaweb以及maven的综合(一)

    今天总结的第一点是在windows下使用idea编写jsp并且使用tomcat部署:第二点是新建maven项目,之前一直是听说也没有自己实践过,今天就大概说一下. 0x01 IDEA 全称 Intel ...

  10. Matlab网格划分

    之前转载了一篇博客http://blog.sina.com.cn/s/blog_6163bdeb0102dvay.html,讲Matlab网格划分程序Distmesh,看了看程序,感觉程序写得有很多值 ...