在JDK6u18中JAXB的NamespacePrefixMapper发生了什么 [英] What happened to JAXB's NamespacePrefixMapper in JDK6u18

查看:80
本文介绍了在JDK6u18中JAXB的NamespacePrefixMapper发生了什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的项目中一直使用 com.sun.xml.bind.marshaller.NamespacePrefixMapper ,我在JDK 6u17中没有遇到任何问题。现在我刚刚更新到6u18,我看到它已被替换为 com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper 。但是,如果我导入这个类并尝试编译我的类,我会收到错误:

 
package com.sun.xml.internal.bind .marshaller不存在
import com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper;

我可以通过NetBeans代码完成功能访问此软件包,NetBeans不会突出显示错误代码。



任何帮助都将不胜感激!

解决方案

我不认为该课程 com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper 替换 com.sun.xml.bind.marshaller.NamespacePrefixMapper ,前者已经存在了很长时间,并且并不意味着你可以全部使用(因此内部包装)。 / p>

这里的问题是JavaSE 6没有JAXB RI(它有JAXB实现但没有JAXB RI)所以如果你想依赖RI特定的功能,您应该在应用程序中捆绑JAXB RI(这样可以保护您免受Java SE中的JAXB更改)。


I've been using com.sun.xml.bind.marshaller.NamespacePrefixMapper in my project, and i had no problem with it in JDK 6u17. Now I just updated to 6u18, and I saw that it has been replaced to com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper. However if I import this class and try to compile my classes, I get the error:

package com.sun.xml.internal.bind.marshaller does not exist
import com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper;

I can access this package through the NetBeans code completion feature, and NetBeans does not highlight the code for errors.

Any help would be appreciated!

解决方案

I don't think that the class com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper is a replacement of com.sun.xml.bind.marshaller.NamespacePrefixMapper, the former is there for a long time and it NOT MEANT TO BE USED BY YOU AT ALL (hence the internal packaging).

The problem here is that JavaSE 6 doesn't have the JAXB RI (it has a JAXB implemenation but not JAXB RI) so if you want to rely on RI specific feature, you should bundle JAXB RI in your application (and that would protect you from JAXB changes in Java SE).

这篇关于在JDK6u18中JAXB的NamespacePrefixMapper发生了什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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