2009-10-20 4 views
1

이상한 것 ...JiBXException : 클래스에 대해 정의 된 다중 바인딩

바인딩 정의 user-wrapper.xml이 있습니다.

<binding> 
    <include path="core-wrapper.xml" /> 
    <include path="user-composite-entity.xml" /> 

    <mapping name="users" class="UserWrapper" extends="CoreWrapper"> 
     <structure map-as="CoreWrapper" usage="optional" /> 
     <collection field="users" usage="optional" item-type="UserCompositeEntity"> 

     </collection> 
    </mapping> 
</binding> 

다음은이 바인딩 정의 user-composite-entity.xml (상위 파일에 포함)입니다.

<binding> 
    <include path="core-composite-entity.xml" /> 
    <include path="user-entity.xml" /> 

    <mapping name="user" class="UserCompositeEntity" extends="CoreCompositeEntity"> 
     <structure map-as="CoreCompositeEntity" /> 
     <structure field="userEntity" usage="optional" /> 
     <structure field="meta" marshaller="UserMetaHashMapper" unmarshaller="UserMetaHashMapper" usage="optional" />  
    </mapping> 
</binding> 

이제 바인딩 user-wrapper.xml을 사용하는 REST를 호출하면 매핑이 성공적으로 완료됩니다. 바인딩 user-composite-entity.xml을 사용하는 REST를 호출하면 다음 오류가 발생합니다.

org.jibx.runtime.JiBXException: Multiple bindings defined for class UserCompositeEntity 

이제는 이상한 점이 있습니다. user-wrapper.xml에서 제거하면 <include path="user-composite-entity.xml" />은 다음과 같이됩니다. - user-composite-entity.xml을 사용한 호출은 succes, - user-wrapper.xml과 함께 호출됩니다.

org.jibx.runtime.JiBXException: No marshaller defined for class UserCompositeEntity 

답변

0

어떻게 지금 작동 : 더 이상 사용자 wrapper.xml가없는 사용자 복합 entity.xml은 다음과 같습니다

<binding> 
<include path="core-wrapper.xml" /> 
<include path="core-composite-entity.xml" /> 
<include path="user-entity.xml" /> 

<mapping name="users" class="UserWrapper" extends="CoreWrapper"> 
    <structure map-as="CoreWrapper" usage="optional" /> 
    <collection field="users" usage="optional" > 
    </collection> 
</mapping> 

<mapping name="user" class="UserCompositeEntity" extends="CoreCompositeEntity"> 
    <structure map-as="CoreCompositeEntity" /> 
    <structure field="userEntity" usage="optional" /> 
    <structure field="meta" marshaller="UserMetaHashMapper" unmarshaller="UserMetaHashMapper" usage="optional" /> 
</mapping> 
</binding> 

문제 때문에 사용자 래퍼에서 전에이었다 .xml에는 user-composite-entity.xml이 포함되어 있으며 JiBX는이를 다시 컴파일했습니다 (user-wrapper.xml 용). 그렇기 때문에 여러 바인딩 정의가 있습니다. ...

0

This email thread 정보가있는 것 같습니다.

+0

Google을 사용하는 방법을 알고 있습니다.) JiBX는 각 바인딩의 모든 클래스를 컴파일하므로 여러 바인딩에서 동일한 클래스가있는 경우 JiBX가 모두이를 컴파일합니다. 방금 user-wrapper.xml에서 user-composite-entity.xml로 모든 것을 옮길 필요가있었습니다. – Trick

+1

일부 세부 정보로 대답하고 대답으로 선택하면 StackOverflow에서 참조 될 수 있습니다. – elhoim

관련 문제