| Author |
XMLBeans and Groovy
|
Robert Harvey
Greenhorn
Joined: Nov 18, 2011
Posts: 4
|
|
I am developing in Netbeans and have 2 XMLBean libraries (Schemas1.jar, Schemas2.jar). One of my XMLBeans, Class A, is defined in Schemas1.jar. Class A contains a type, Class B, defined in Schemas2.jar. I have a Groovy class, Class MyGroovy, that operates on Class A to obtain a reference to Class B. My compilation works, but runtime produces a nullpointer exception:
java.lang.NullPointerException
at org.apache.xmlbeans.impl.schema.SchemaPropertyImpl.getType(SchemaPropertyImpl.java:92)
at org.apache.xmlbeans.impl.schema.SchemaTypeImpl.createElementType(SchemaTypeImpl.java:965)
at org.apache.xmlbeans.impl.values.XmlObjectBase.create_element_user(XmlObjectBase.java:924)
at org.apache.xmlbeans.impl.store.Xobj.getUser(Xobj.java:1669)
at org.apache.xmlbeans.impl.store.Xobj.find_element_user(Xobj.java:2074)
at schemas1.model.impl.ClassAImpl.getClassB(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl$GetBeanMethodMetaProperty.getProperty(MetaClassImpl.java:3460)
at org.codehaus.groovy.runtime.callsite.GetEffectivePojoPropertySite.getProperty(GetEffectivePojoPropertySite.java:61)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:237)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetPropertySafe(AbstractCallSite.java:343)
I posted a question to the XMLBean folks, but they have not responded in over 2 weeks. Thought I would post this at CodeRanch to help me solve this. If I operate on ClassA and ClassB from a normal Java class, the nullpointer is not observed. Seems to be tied to how groovy handles "aggregate" XMLBeans objects.
Any help is much appreciated,
Thanks!
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 13842
|
|
|
Sounds like a Groovy question to me, and we have a Groovy forum. Moving...
|
 |
Mohamed Sanaulla
Bartender
Joined: Sep 08, 2007
Posts: 2694
|
|
|
May be you could show us the code?
|
Mohamed Sanaulla | My Blog
|
 |
 |
|
|
subject: XMLBeans and Groovy
|
|
|