JAXBException创建JAXB上下文 [英] JAXBException on creating JAXB Context

查看:469
本文介绍了JAXBException创建JAXB上下文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行应用程序作为独立的Java程序,它工作得很好。当我运行它作为一个小程序,它会抛出JAXBException与以下堆栈跟踪。

When I run application as standalone Java program, it works well. When I run it as an applet, it throws JAXBException with following stacktrace.

javax.xml.bind.JAXBException: jaxb.properties in package com/test/package does not contain the javax.xml.bind.context.factory property.
    at javax.xml.bind.ContextFinder.find(Unknown Source)
    at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
    at javax.xml.bind.JAXBContext.newInstance(Unknown Source)

当我添加一个jaxb.properties,我得到下面的错误 -

When I add a jaxb.properties, i get the below error -

javax.xml.bind.JAXBException
 - with linked exception:
[java.lang.NoSuchMethodException: com.sun.xml.internal.ws.developer.JAXBContextFactory.createContext([Ljava.lang.Class;, java.util.Map)]
    at javax.xml.bind.ContextFinder.newInstance(Unknown Source)
    at javax.xml.bind.ContextFinder.newInstance(Unknown Source)
    at javax.xml.bind.ContextFinder.find(Unknown Source)
    at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
    at javax.xml.bind.JAXBContext.newInstance(Unknown Source)

我添加下面的罐子到类路径 -

I added following jars to classpath -


  • JAXWS-RT-2.2.1

  • JS​​R311的API-1.1.1

  • 球衣核-1.2

  • 球衣的客户端-1.2

什么原因导致这个错误。我缺少的依赖。

What causes this error. Am I missing any dependencies.

编辑:
我使用的浏览器都与开发环境的Java 7û59。

I am using Java 7 u 59 on both browser and development environment.

推荐答案

第二个例外:
检查入门级从罐子提到并更换有createjaxbcontext方法正确的jar文件。

Second Exception: Check the class getting referred from which jar and replace the proper jar file which has createjaxbcontext method.

使用罐子的正确版本在classpath(JAXWS-RT)。

Use the proper version of jar in the classpath(jaxws-rt).

这篇关于JAXBException创建JAXB上下文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆