RuntimeException from xmlbeans - can't find compiled schema

12,006

The answer of John was a good hint for me. I generated Java classes with xmlBeans and copied the source files out of the "noNamespace" manually in my project to modify them. unfortunately I did not recognize that there were also generated class files in the "schemaorg_apache_xmlbeans" folder and did not copy them.
After switching to the usage of the generated jar-file everything worked fine for me.

Share:
12,006
findango
Author by

findango

Updated on June 11, 2022

Comments

  • findango
    findango almost 2 years

    I'm getting a RuntimeException while executing some code that depends on generated xmlbeans classes. I can't figure out if this is:

    • me missing something during code-generation or packaging
    • a runtime dependency missing
    • a misleading error message, and I should be looking elsewhere.

    The xbean.jar version is the same in the build and execution environment. Anyone seen this before or have any ideas?

    Thanks.

    ...snip...
    Caused by: java.lang.RuntimeException: Could not instantiate SchemaTypeSystemImpl (java.lang.reflect.InvocationTargetException): is the version of xbean.jar correct?
        at schemaorg_apache_xmlbeans.system.s2B8331230CBD98F4933B0B025B6BF726.TypeSystemHolder.loadTypeSystem(Unknown Source)
        at schemaorg_apache_xmlbeans.system.s2B8331230CBD98F4933B0B025B6BF726.TypeSystemHolder.(Unknown Source)
        ... 38 more
    Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        ... 40 more
    Caused by: org.apache.xmlbeans.SchemaTypeLoaderException: XML-BEANS compiled schema: Could not locate compiled schema resource schemaorg_apache_xmlbeans/system/s2B8331230CBD98F4933B0B025B6BF726/index.xsb (schemaorg_apache_xmlbeans.system.s2B8331230CBD98F4933B0B025B6BF726.index) - code 0
        at org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl$XsbReader.(SchemaTypeSystemImpl.java:1504)
        at org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.initFromHeader(SchemaTypeSystemImpl.java:260)
        at org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.(SchemaTypeSystemImpl.java:183)
        ... 44 more
    ...snip...
    
  • Brad G
    Brad G almost 11 years
    I used wsdltojava to create some soap code. I didn't notice it also created a "resources" folder that I didn't copy into my project.