我们计划将我们的产品升级到 Web-logic 12.C 和 WebSphere 8 堆栈(之前是 WLC 10.3.5 和 WAS 7)。但是导致整个应用程序无法在 Web 逻辑中部署的 Web 服务组件之一的问题。它与 WebSphere 8 完美配合。
部署 EAR 时,应用程序服务器抛出 'Exception [EclipseLink-59] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DescriptorException' 。经过更多分析,我在导致问题的 WebServce 依赖类之一中发现了以下代码,
@ExcludeAttribute
public Map getOperations(){
Map map = new HashMap();
//some operation
return map;
}
@ExcludeAttribute 描述 Runtime 保留策略,定义如下所示
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ExcludeAttribute {
}
getOperations方法返回 java.util.Map ,它不适用于 RunTime 保留注释,但适用于任何其他数据类型,例如 (Integer, Customer etc) 。我已更改为 java.uitl.HashMap 并没有工作。
我能够通过使用以下注释来解决这个问题(我宁愿打电话解决),
@XmlTransient
我没有其他线索为什么它不能与 java.uitl.Map 一起使用。任何想法都会真的竖起大拇指!我已经发布到 Oracle 支持,即使他们还没有回来。java.util.Map/Collection 类与 WEblogic12c/Annotations 的组合是否存在任何已知问题。
[编辑 - 1]
要回答 Doughan 的问题,返回非集合数据类型的方法不会抛出任何异常,例如:
@ExcludeAttribute
public Integer getOperations(){
return 1;
}
其中@ExcludeAttribute 是自定义注释定义'@Retention(RetentionPolicy.RUNTIME)',我不需要定义@XmlTransient 来忽略。
我对保留运行时注释的使用有点困惑,并且不确定我是否需要保留它或应该使用 XMLTransient 注释。
[编辑 2,基于@Doughan 的回答]
我知道如果不从 Weblogic 12C 映射 getter 方法(如 @XMLTransient),我们需要显式注释它们,这与 RuntTime Retention 注释无关。因此,如果有未映射的公共 getter 方法,任何升级到 12C 的堆栈都应该使用此注释更新代码库。我认为这几乎可以回答我的担忧。
如果我错了,请纠正我。
现有的代码库已经使用运行时注释进行了注释,我认为这是导致问题的一个原因。
详细的堆栈跟踪如下
weblogic.application.ModuleException:[HTTP:101216]Servlet:“com.chordiant.component.cxradecisions.decision.impl.internal.AssessmentDecisionInterfaceWebServiceWrapper”无法在 Web 应用程序启动时预加载:“/ra”。
com.sun.xml.ws.spi.db.DatabindingException:描述符异常:
异常 [EclipseLink-59] (Eclipse Persistence Services - 2.3.2.v20111125-r10461):org.eclipse.persistence.exceptions.DescriptorException 异常描述:实例变量 [responseButtons] 未在域类 [com.chordiant. dm.ra.bean.Assessment],否则无法访问。内部异常:java.lang.NoSuchFieldException:responseButtons 映射:org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping[responseButtons] 描述符:XMLDescriptor(com.chordiant.dm.ra.bean.Assessment --> [])
运行时异常:
at com.sun.xml.ws.db.toplink.JAXBContextFactory.newContext(JAXBContextFactory.java:185) at com.sun.xml.ws.spi.db.BindingContextFactory.create(BindingContextFactory.java:179) at com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:211) at com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:185)
我在评估类中定义了一个方法 getResponseButtons()
@ExcludeAttribute
public Map getResponseButtons() {
Map map = new HashMap();