In further digging through the trace logs, I find a whole bunch of 
ClassCastException prior to the CyclicReferenceException.
Any idea what may be causing the ClassCastExceptions? 

The error seems to be happening only when there is one or more instance of a 
particular bean within the object graph.
i.e. Person bean is used to generate Person.xml & Person bean has an Address 
bean as a property. We get the error mainly when there is an address record for 
a Person.

[10/24/06 12:47:52:027 EDT] 3a828432 AbstractBeanW E 
org.apache.commons.betwixt.io.AbstractBeanWriter [MethodExpression] Cannot 
evaluate expression 
[10/24/06 12:47:52:027 EDT] d138432 ORBRas d com.ibm.rmi.iiop.CDROutputStream 
setStreamFormatVersion:387 Alarm : 1 custom stream format=1
[10/24/06 12:47:52:046 EDT] 3a828432 AbstractBeanW E 
org.apache.commons.betwixt.io.AbstractBeanWriter TRAS0014I: The following 
exception was logged java.lang.IllegalArgumentException: [EMAIL PROTECTED]
at sun.reflect.GeneratedMethodAccessor464.invoke(Unknown Source)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled
 Code))
at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
at 
org.apache.commons.betwixt.expression.MethodExpression.evaluate(MethodExpression.java(Compiled
 Code))
at 
org.apache.commons.betwixt.io.AbstractBeanWriter.writeElementContent(AbstractBeanWriter.java(Compiled
 Code))
at 
org.apache.commons.betwixt.io.AbstractBeanWriter.writeElement(AbstractBeanWriter.java(Inlined
 Compiled Code))
at 
org.apache.commons.betwixt.io.AbstractBeanWriter.writeElementContent(AbstractBeanWriter.java(Compiled
 Code))
at 
org.apache.commons.betwixt.io.AbstractBeanWriter.writeElement(AbstractBeanWriter.java(Compiled
 Code))
at 
org.apache.commons.betwixt.io.AbstractBeanWriter.writeBean(AbstractBeanWriter.java(Compiled
 Code))
...
at 
org.apache.commons.betwixt.io.AbstractBeanWriter.write(AbstractBeanWriter.java:144)
at org.apache.commons.betwixt.io.BeanWriter.write(BeanWriter.java:190)
.
java.lang.IllegalArgumentException: [EMAIL PROTECTED]
at sun.reflect.GeneratedMethodAccessor464.invoke(Unknown Source)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled
 Code))
at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
at 
org.apache.commons.betwixt.expression.MethodExpression.evaluate(MethodExpression.java(Compiled
 Code))
at 
org.apache.commons.betwixt.io.AbstractBeanWriter.writeElementContent(AbstractBeanWriter.java(Compiled
 Code))
at 
org.apache.commons.betwixt.io.AbstractBeanWriter.writeElement(AbstractBeanWriter.java(Inlined
 Compiled Code))
at 
org.apache.commons.betwixt.io.AbstractBeanWriter.writeElementContent(AbstractBeanWriter.java(Compiled
 Code))
at 
org.apache.commons.betwixt.io.AbstractBeanWriter.writeElement(AbstractBeanWriter.java(Compiled
 Code))
at 
org.apache.commons.betwixt.io.AbstractBeanWriter.writeBean(AbstractBeanWriter.java(Compiled
 Code))
...
at 
org.apache.commons.betwixt.io.AbstractBeanWriter.write(AbstractBeanWriter.java:144)
at org.apache.commons.betwixt.io.BeanWriter.write(BeanWriter.java:190)
-----Original Message-----
From: Rao, Sailesh [mailto:[EMAIL PROTECTED]
Sent: Monday, October 23, 2006 3:38 PM
To: commons-user@jakarta.apache.org
Subject: Betwixt CyclicReferenceException: Bean graph contains a cyclic
reference



I get a CyclicReferenceException while using Betwixt to write a bean. We get 
this exception on our development server - websphere 5.1, JDK 1.4.2.5, AIX 5.2, 
betwixt 0.7, hibernate 3.1. However the same code worked on my local 
workstation - webshere 5.1, J2RE 1.4.2 , XP version 5.1, betwixt 0.7, hibernate 
3.1. We are using .betwixt files for all bean properties that needs to be 
written. Any ideas?? 

Thanks
Sailesh

---------------------------------------------------------------Exception 
Trace----------------------------------------------------------------------------------------------------------------------
[10/13/06 8:50:17:980 EDT] 5e3e469a AbstractBeanW E 
org.apache.commons.betwixt.io.AbstractBeanWriter  Cyclic reference at bean: 
XXXXXXXX
[10/13/06 8:50:17:990 EDT] 5e3e469a SystemErr     R 
org.apache.commons.betwixt.io.CyclicReferenceException: Bean graph contains a 
cyclic reference
[10/13/06 8:50:17:991 EDT] 5e3e469a SystemErr     R     at 
org.apache.commons.betwixt.io.AbstractBeanWriter.pushBean(AbstractBeanWriter.java:1014)
[10/13/06 8:50:17:991 EDT] 5e3e469a SystemErr     R     at 
org.apache.commons.betwixt.io.AbstractBeanWriter.writeBean(AbstractBeanWriter.java:348)
[10/13/06 8:50:17:991 EDT] 5e3e469a SystemErr     R     at 
org.apache.commons.betwixt.io.AbstractBeanWriter.writeBean(AbstractBeanWriter.java:267)
[10/13/06 8:50:17:991 EDT] 5e3e469a SystemErr     R     at 
org.apache.commons.betwixt.io.AbstractBeanWriter.writeElementContent(AbstractBeanWriter.java:936)
[10/13/06 8:50:17:991 EDT] 5e3e469a SystemErr     R     at 
org.apache.commons.betwixt.io.AbstractBeanWriter.writeElement(AbstractBeanWriter.java:738)
[10/13/06 8:50:17:991 EDT] 5e3e469a SystemErr     R     at 
org.apache.commons.betwixt.io.AbstractBeanWriter.writeElementContent(AbstractBeanWriter.java:955)
[10/13/06 8:50:17:991 EDT] 5e3e469a SystemErr     R     at 
org.apache.commons.betwixt.io.AbstractBeanWriter.writeElement(AbstractBeanWriter.java:738)
[10/13/06 8:50:17:991 EDT] 5e3e469a SystemErr     R     at 
org.apache.commons.betwixt.io.AbstractBeanWriter.writeBean(AbstractBeanWriter.java:374)
[10/13/06 8:50:17:992 EDT] 5e3e469a SystemErr     R     at 
org.apache.commons.betwixt.io.AbstractBeanWriter.writeBean(AbstractBeanWriter.java:267)
[10/13/06 8:50:17:992 EDT] 5e3e469a SystemErr     R     at 
org.apache.commons.betwixt.io.AbstractBeanWriter.writeElementContent(AbstractBeanWriter.java:945)
[10/13/06 8:50:17:992 EDT] 5e3e469a SystemErr     R     at 
org.apache.commons.betwixt.io.AbstractBeanWriter.writeElement(AbstractBeanWriter.java:738)
[10/13/06 8:50:17:992 EDT] 5e3e469a SystemErr     R     at 
org.apache.commons.betwixt.io.AbstractBeanWriter.writeBean(AbstractBeanWriter.java:374)
[10/13/06 8:50:17:992 EDT] 5e3e469a SystemErr     R     at 
org.apache.commons.betwixt.io.AbstractBeanWriter.writeBean(AbstractBeanWriter.java:267)
[10/13/06 8:50:17:992 EDT] 5e3e469a SystemErr     R     at 
org.apache.commons.betwixt.io.AbstractBeanWriter.writeElementContent(AbstractBeanWriter.java:936)
[10/13/06 8:50:17:992 EDT] 5e3e469a SystemErr     R     at 
org.apache.commons.betwixt.io.AbstractBeanWriter.writeElement(AbstractBeanWriter.java:738)
[10/13/06 8:50:17:992 EDT] 5e3e469a SystemErr     R     at 
org.apache.commons.betwixt.io.AbstractBeanWriter.writeBean(AbstractBeanWriter.java:374)
[10/13/06 8:50:17:992 EDT] 5e3e469a SystemErr     R     at 
org.apache.commons.betwixt.io.AbstractBeanWriter.writeBean(AbstractBeanWriter.java:243)
[10/13/06 8:50:17:992 EDT] 5e3e469a SystemErr     R     at 
org.apache.commons.betwixt.io.AbstractBeanWriter.write(AbstractBeanWriter.java:144)
[10/13/06 8:50:17:992 EDT] 5e3e469a SystemErr     R     at 
org.apache.commons.betwixt.io.BeanWriter.write(BeanWriter.java:190)

----------------------------------------------------------Code----------------------------------------------------------------------------------------------------------------------
         ...
        outputWriter.write("<?xml version='1.0' ?>");
        BeanWriter beanWriter = new BeanWriter(outputWriter);

        IntrospectionConfiguration introConfig = 
beanWriter.getXMLIntrospector().getConfiguration();
        introConfig.setAttributesForPrimitives(false);
        
introConfig.setMappingDerivationStrategy(MappingDerivationStrategy.USE_INTROSPECTION_TIME_TYPE);
        introConfig.setWrapCollectionsInElement(true);
        PropertySuppressionStrategy pss = new PropertySuppressionStrategy() {
            public boolean suppressProperty(Class clazz, Class type, String 
name) {
                if (clazz == com.xxx.yyy.zzz)
                        return true;
                else
                        return false;
            }
        };
        introConfig.setPropertySuppressionStrategy(pss);
        
        beanWriter.getBindingConfiguration().setMapIDs(false);
        beanWriter.enablePrettyPrint();
        beanWriter.write(this);
        ...
        ...


------------------------------------------------------------------Server 
details---------------------------------------------------------------------------------------------------------------------------------------------
WebSphere Platform 5.1 [ND 5.1.1.11 cf110622.05] [JDK 1.4.2.5 
pj9ap32142-20060428] [BASE 5.1.1.11 cf110622.05]  running with process name 
SSE01_CELL\SSE01_w93\BRIT_APP_w93 and process id 749774
Host Operating System is AIX, version 5.2
Java version = J2RE 1.4.2 IBM AIX build ca142-20060421 (SR5) (JIT enabled: 
jitc), Java Compiler = jitc, Java VM name = Classic VM
was.install.root = /usr/WebSphere/SSEServer01
user.install.root = /usr/WebSphere/SSEServer01
Java Home = /usr/WebSphere/SSEServer01/java/jre
ws.ext.dirs = 
/usr/WebSphere/SSEServer01/java/lib:/usr/WebSphere/SSEServer01/classes:/usr/WebSphere/SSEServer01/classes:/usr/WebSphere/SSEServer01/lib:/usr/WebSphere/SSEServer01/lib/ext:/usr/WebSphere/SSEServer01/web/help:/usr/WebSphere/SSEServer01/deploytool/itp/plugins/com.ibm.etools.ejbdeploy/runtime
Classpath = 
/usr/WebSphere/SSEServer01/properties:/usr/WebSphere/SSEServer01/properties:/usr/WebSphere/SSEServer01/lib/bootstrap.jar:/usr/WebSphere/SSEServer01/lib/j2ee.jar:/usr/WebSphere/SSEServer01/lib/lmproxy.jar:/usr/WebSphere/SSEServer01/lib/urlprotocols.jar
Java Library path = 
/usr/WebSphere/SSEServer01/java/jre/bin:/usr/WebSphere/SSEServer01/java/jre/bin/classic:/usr/WebSphere/SSEServer01/java/jre/bin:/usr/WebSphere/SSEServer01/bin:/usr/mqm/java/lib:/usr/opt/wemps/lib:/opt/fitb/db2/db2rtcl/sqllib/lib:/usr/lib
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



This e-mail transmission contains information that is confidential and may be 
privileged.   It is intended only for the addressee(s) named above. If you 
receive this e-mail in error, please do not read, copy or disseminate it in any 
manner. If you are not the intended recipient, any disclosure, copying, 
distribution or use of the contents of this information is prohibited. Please 
reply to the message immediately by informing the sender that the message was 
misdirected. After replying, please erase it from your computer system. Your 
assistance in correcting this error is appreciated.


This e-mail transmission contains information that is confidential and may be 
privileged.   It is intended only for the addressee(s) named above. If you 
receive this e-mail in error, please do not read, copy or disseminate it in any 
manner. If you are not the intended recipient, any disclosure, copying, 
distribution or use of the contents of this information is prohibited. Please 
reply to the message immediately by informing the sender that the message was 
misdirected. After replying, please erase it from your computer system. Your 
assistance in correcting this error is appreciated.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to