I got different results when using Smooks 1.1 with or witout
hughhuang Mar 2, 2009 2:41 PMHi All,
I have been using Smooks 1.1 doing java-to-java transformation. I currently encountered a strange problem. When I was using my transformation tester, which is off JBoss ESB, I got the exact transformation results I expected. However, when I deployed the same code to ESB which uses the same Smooks version, I got a very different result. I have used the exactly same source data, Smooks config file, and exactly same Smooks library (I even replaced the default ESB/Smooks library with the library shipped with Smooks).
I am new with Smooks, and also having difficulties finding any info on web related to this problem. Please help.
I am posting below my sample Smooks config file:
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.1.xsd">
SAX
<jb:bindings beanId="producer" class="com.b.entity.Producer" createOnElement="com.b.Agency">
<jb:value property="name" data="name" />
<jb:wiring property="contacts" beanIdRef="contacts" />
</jb:bindings>
<resource-config selector="com.a.Agency">
com.a.ProducerVisitor
TC_check
TRUE
TC_gold
</resource-config>
<jb:bindings beanId="contacts" class="com.b.ProducerContact[]" createOnElement="com.a.Agency">
<jb:wiring beanIdRef="contact" />
</jb:bindings>
<!-- <resource-config selector="agency/agentOfRecord">-->
<resource-config selector="com.a.Agent">
org.milyn.javabean.BeanPopulator
contact
com.b.ProducerContact
true
</resource-config>
<resource-config selector="com.a.Agent">
com.a.ProducerVisitor
TC_person
</resource-config>
<!-- <resource-config selector="agency/firstLocation">-->
<!-- <resource-config selector="com.a.AgencyLocation">-->
<resource-config selector="com.a.Address">
org.milyn.javabean.BeanPopulator
primaryAddress
com.b.Address
</resource-config>
<resource-config selector="com.a.Address">
com.a.ProducerVisitor
TC_business
</resource-config>
</smooks-resource-list>
Below are two different transformation results:
Result with tester (without ESB):
Transformation results (ALL):
producer:
<com.b.Producer>
<com.b.ProducerContact>
John
Doe41
<__value__>TC_person</__value__>
<AddressLine1>s</AddressLine1>
<AddressLine2>s</AddressLine2>
<__value__>TC_business</__value__>
c
z
</com.b.ProducerContact>
<__value__>TC_check</__value__>
<__value__>TC_gold</__value__>
a41
true
</com.b.Producer>
contacts:
<com.b.ProducerContact-array>
<com.b.ProducerContact>
John
Doe41
<__value__>TC_person</__value__>
<AddressLine1>s</AddressLine1>
<AddressLine2>s</AddressLine2>
<__value__>TC_business</__value__>
c
z
</com.b.ProducerContact>
</com.b.ProducerContact-array>
contact:
<com.b.ProducerContact>
John
Doe41
<__value__>TC_person</__value__>
<AddressLine1>s</AddressLine1>
<AddressLine2>s</AddressLine2>
<__value__>TC_business</__value__>
c
z
</com.b.ProducerContact>
primaryAddress:
<com.b.Address>
<AddressLine1>s</AddressLine1>
<AddressLine2>s</AddressLine2>
<__value__>TC_business</__value__>
c
z
</com.b.Address>
Result with ESB:
2009-03-02 10:39:47,867 INFO [STDOUT]
Transformation results (ALL):
producer:
<com.b.Producer>
<com.b.ProducerContact>
John
Doe41
<__value__>TC_person</__value__>
<__value__>TC_business</__value__>
</com.b.ProducerContact>
<com.b.ProducerContact>
</com.b.ProducerContact>
<com.b.ProducerContact>
</com.b.ProducerContact>
<__value__>TC_check</__value__>
<__value__>TC_gold</__value__>
ROOT
true
</com.b.Producer>
contacts:
<com.b.ProducerContact-array>
<com.b.ProducerContact>
John
Doe41
<__value__>TC_person</__value__>
<__value__>TC_business</__value__>
</com.b.ProducerContact>
<com.b.ProducerContact>
</com.b.ProducerContact>
<com.b.ProducerContact>
</com.b.ProducerContact>
</com.b.ProducerContact-array>
contact:
<com.b.ProducerContact>
<__value__>TC_person</__value__>
<__value__>TC_business</__value__>
</com.b.ProducerContact>
primaryAddress:
<com.b.Address>
<__value__>TC_business</__value__>
</com.b.Address>