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

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

问题描述

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

<前>包 com.sun.xml.internal.bind.marshaller 不存在导入 com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper;

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

任何帮助将不胜感激!

解决方案

我不认为 com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper 类可以替代 com.sun.xml.bind.marshaller.NamespacePrefixMapper,前者已经存在很长时间了,并且根本不打算被您使用(因此 内部包装).

这里的问题是 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天全站免登陆