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 ”  ,错误堆栈如下:

  1. 十一月 16, 2015 1:01:32 下午 org.apache.catalina.core.ApplicationContext log
  2. 信息: Initializing Spring root WebApplicationContext
  3. 十一月 16, 2015 1:01:35 下午 org.apache.catalina.core.StandardContext filterStart
  4. 严重: Exception starting filter ssoFilter
  5. javax.xml.ws.WebServiceException: Unable to create JAXBContext
  6. at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:156)
  7. at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:84)
  8. at com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:234)
  9. at com.sun.xml.internal.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:328)
  10. at com.sun.xml.internal.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:190)
  11. at com.sun.xml.internal.ws.api.server.WSEndpoint.create(WSEndpoint.java:498)
  12. at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.createEndpoint(EndpointImpl.java:246)
  13. at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(EndpointImpl.java:170)
  14. at com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:118)
  15. at javax.xml.ws.Endpoint.publish(Endpoint.java:240)
  16. at com.pcitc.sso.client.SSOFilter.init(SSOFilter.java:42)
  17. at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
  18. at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
  19. at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
  20. at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4038)
  21. at org.apache.catalina.core.StandardContext.start(StandardContext.java:4692)
  22. at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
  23. at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
  24. at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
  25. at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041)
  26. at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964)
  27. at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
  28. at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
  29. at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
  30. at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
  31. at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)
  32. at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
  33. at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
  34. at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
  35. at org.apache.catalina.core.StandardService.start(StandardService.java:525)
  36. at org.apache.catalina.core.StandardServer.start(StandardServer.java:701)
  37. at org.apache.catalina.startup.Catalina.start(Catalina.java:585)
  38. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  39. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  40. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  41. at java.lang.reflect.Method.invoke(Method.java:606)
  42. at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
  43. at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
  44. Caused by: java.security.PrivilegedActionException: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
  45. javax.servlet.http.HttpServletRequest is an interface, and JAXB can't handle interfaces.
  46. this problem is related to the following location:
  47. at javax.servlet.http.HttpServletRequest
  48. at public javax.servlet.http.HttpServletRequest com.pcitc.sso.client.webservice.jaxws.GetLoginUser.arg0
  49. at com.pcitc.sso.client.webservice.jaxws.GetLoginUser
  50. javax.servlet.http.HttpServletResponse is an interface, and JAXB can't handle interfaces.
  51. this problem is related to the following location:
  52. at javax.servlet.http.HttpServletResponse
  53. at public javax.servlet.http.HttpServletResponse com.pcitc.sso.client.webservice.jaxws.GetLoginUser.arg1
  54. at com.pcitc.sso.client.webservice.jaxws.GetLoginUser
  55.  
  56. at java.security.AccessController.doPrivileged(Native Method)
  57. at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:143)
  58. ... 37 more
  59. Caused by: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
  60. javax.servlet.http.HttpServletRequest is an interface, and JAXB can't handle interfaces.
  61. this problem is related to the following location:
  62. at javax.servlet.http.HttpServletRequest
  63. at public javax.servlet.http.HttpServletRequest com.pcitc.sso.client.webservice.jaxws.GetLoginUser.arg0
  64. at com.pcitc.sso.client.webservice.jaxws.GetLoginUser
  65. javax.servlet.http.HttpServletResponse is an interface, and JAXB can't handle interfaces.
  66. this problem is related to the following location:
  67. at javax.servlet.http.HttpServletResponse
  68. at public javax.servlet.http.HttpServletResponse com.pcitc.sso.client.webservice.jaxws.GetLoginUser.arg1
  69. at com.pcitc.sso.client.webservice.jaxws.GetLoginUser
  70.  
  71. at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:91)
  72. at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:442)
  73. at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:274)
  74. at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:125)
  75. at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1127)
  76. at com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:173)
  77. at com.sun.xml.internal.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:95)
  78. at com.sun.xml.internal.ws.developer.JAXBContextFactory$1.createJAXBContext(JAXBContextFactory.java:98)
  79. at com.sun.xml.internal.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:151)
  80. at com.sun.xml.internal.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:143)
  81. ... 39 more
  82.  
  83. 十一月 16, 2015 1:01:35 下午 org.apache.catalina.core.ApplicationContext log
  84. 信息: 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. 关于Modelsim仿真速度的优化

    如果在不需要波形,只需要快速知道结果的情况下,可以用优化选项.这适用于做大量case的仿真阶段.因为这一阶段多数case都是通过的,只需要快速确认即可,然后把没通过的case拿出来做全波形的仿真调试. ...

  2. 在网页中添加分享到微信、QQ、微博

    参考地址:http://www.bshare.cn/help/installAction 在上面的地址中: 1.可选择分享到的位置,如QQ.微信.微博等 2.按钮的样式.悬浮或者以横幅的方式自己找位置 ...

  3. 万网免费主机wordpress快速建站教程-域名申请

    在上一篇文章中,小伙伴们已经申请好了万网的免费主机,接下来教大家如何申请域名. 由于万网免费主机要绑定在阿里备案的域名,现在以万网的域名注册为例子. 首先进入万网域名注册页面(http://www.n ...

  4. Sql触发器脚本

    ALTER Trigger [dbo].[test] --新建触发器 On [dbo].[test1] --在test1表中创建触发器 for insert --触发条件 As --事件触发后所要做的 ...

  5. 高吞吐高并发Java NIO服务的架构(NIO架构及应用之一)

    高吞吐高并发Java NIO服务的架构(NIO架构及应用之一) http://maoyidao.iteye.com/blog/1149015   Java NIO成功的应用在了各种分布式.即时通信和中 ...

  6. 学习笔记_Java_day12_Cookie

    Cookie 1 Cookie概述 1.1 什么叫Cookie Cookie翻译成中文是小甜点,小饼干的意思.在HTTP中它表示服务器送给客户端浏览器的小甜点.其实Cookie就是一个键和一个值构成的 ...

  7. CSS边框属性一---border-radius

    1.CSS outline 属性 outline (轮廓)是绘制于元素周围的一条线,位于边框边缘的外围,可起到突出元素的作用. p { outline:#00FF00 dotted thick; } ...

  8. JavaScript学习笔记 -- ES6学习(二) let 和const

    ES6 中新增了两个命令: let 和const. let命令: let 用于声明变量,和var 类似,但是所声明的变量只在代码块中有效,不存在变量提升,有暂时性死区. 1.只在代码块中有效 和var ...

  9. java新手笔记17 参数

    package com.yfs.javase; public class ParamDemo { public static void main(String[] args) { int a = 3, ...

  10. linux下shell编程示例-获取进程id

    今天初步学习了一下linux下的shell编程,简单记录一下测试用例 1.编辑shell脚本文件如下: #!/bin/bashecho "hello bash linux"echo ...