簡體   English   中英

遷移到WebLogic 12后,出現“缺少必需屬性” JiBX錯誤

[英]Getting 'Missing Required Attribute' JiBX error after migrating to WebLogic 12

早上好,

我一直在從事以下項目:

  1. 將應用程序從JRockit 1.6升級到Java 7
  2. 升級應用程序以在WebLogic 10.3.5環境中運行以在WebLogic 12環境中運行

我確定這無濟於事,但我是Java / Spring / WebLogic領域的新手。

我能夠從JRockit 1.6升級到Java 7,但是當涉及到WebLogic部分時,我在啟動應用程序時遇到了問題。

每次這樣做,都會出現以下錯誤

org.jibx.runtime.JiBXException: Missing required attribute "a" (line 1, col 71)
at org.jibx.runtime.impl.UnmarshallingContext.attributeText(UnmarshallingContext.java:975)
at com.mydomain.JiBX_rule_def_bindingMungeAdapter.JiBX_rule_def_binding_unmarshalAttr_1_0()
at com.mydomain.JiBX_rule_def_bindingMutableRuleDefinition_access.unmarshal()
at org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2757)
at org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:2900)

並且已經嘗試調試了一段時間。 真正奇怪的是,當我從Spring / WebLogic環境中取出代碼並執行時,它可以正常工作(即,將數據解組)。

當它在帶有JRockit 1.6和JiBX 1.2.1 jar的WebLogic 10.3.5環境中時,我的問題是零。

這是我嘗試過的

  • 將JiBX jar從1.2.1升級到1.2.5
  • 將xpp3 jar升級到1.1.3.4.O
  • 將Spring jar從2.5.5升級到3.2.11
  • 嘗試包括一個weblogic.xml文件(以前沒有一個文件),並嘗試使用

      <preferred-web-inf>true</preferred-web-inf> 

但沒有運氣

  • 嘗試包括一個weblogic-application.xml文件和一個APP-INF文件夾(以前沒有一個文件夾),並嘗試使用JiBX作為我的首選類進行編組

以下是有關我正在工作的環境的更多信息

  • 非Maven環境(必須手動升級.jars)
  • 使用Java 1.7.0.45和.71
  • WebLogic 1.2.1.2
  • 春天3.2.11
  • JiBX 1.2.5
  • 使用MyEclipse版本:2014內部版本號:12.0.0-20131202
  • 沒有xsd文件,只有.xml綁定文件

     <binding> <mapping name="rule" class="com.mydomain.MutableRuleDefinition"> <value name="a" field="a" style="attribute" /> <value name="b" field="b" style="attribute" /> <collection field="ruleElements"> <structure name="ruleElement" type="com.mydomain.MutableRuleElement"> <value name="c" field="c" style="attribute" /> <value name="d" field="d" style="attribute" /> <collection field="values" item-type="java.lang.String" usage="optional"> <value name="value" /> </collection> </structure> </collection> </mapping> </binding> 

這是解組代碼:

private MutableRuleDefinition unmarshalXMLRuleDef(String _xmlRuleDef) {
MutableRuleDefinition mruleDef = null;
try {
  IBindingFactory bfact = BindingDirectory
      .getFactory(MutableRuleDefinition.class);

  IUnmarshallingContext uctx = bfact.createUnmarshallingContext();

  mruleDef = (MutableRuleDefinition) uctx.unmarshalDocument(
      new ByteArrayInputStream(_xmlRuleDef.getBytes()), null);

} catch (JiBXException e) {
  logger.error("Could not un-marshalling the XML rule definition:["
      + _xmlRuleDef + "]", e);
}

顯然,這是JiBX 1.2.1中的一個問題,但在1.2.2中已解決:

https://www.mail-archive.com/jibx-users@lists.sourceforge.net/msg04200.html

任何幫助表示贊賞。 如果您需要更多信息,請告訴我...

更新#1

我努力了

<value name="a" field="a" style="attribute" usage=optional />

在所有屬性標志上都可以進行解組,但是,這些字段不是可選的,因此我不能將其用作解決方法。

更新#2

首先,這是一個未經編組的示例

<rule a="dataForA" b="dataForB">
    <ruleElement c="dataForC1" d="dataForD1" />
    <ruleElement c="dataForC2" d="dataForD2" />
    <ruleElement c="dataForC3" d="dataForD3" />
    <ruleElement c="dataForC4" d="dataForD3" />
</rule>

R漢娜,

我建議您查看JiBX依賴項,並確保所有Jars與JiBX使用的版本完全相同。 我們使用一些經常與Web服務器jar沖突的Eclipse庫。

另外,請記住,JiBX是開源的。 您可能需要單步執行代碼,然后查看導致JiBX失敗的原因。

還有一件事。 我看不到您的架構定義,但是奇怪的是該錯誤似乎表明您缺少屬性。 您確定不需要'source'屬性。

祝好運!

Don Corley JiBX貢獻者

R漢娜,

我在使用1.2.5版本的jibx之后為我解決了這個問題,但是我確保所有相關的jar也都更新到了1.2.5,並確保在我的戰爭中不存在由以前的jar創建的過時的類文件。對我來說這招希望它可以幫助您。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM