Error when using XmlBeans generated classes

后端 未结 5 2263
刺人心
刺人心 2021-02-20 09:43

I\'ve generated classes with XMLBeans from an xsd file and packed them in a jar file. then I\'ve added that jar to the project classpath in eclipse and everything compiles and r

5条回答
  •  长情又很酷
    2021-02-20 10:30

    In your generated jar file make sure you have included the class files generated from your xmlbeans.

    From the stacktrace :

    Caused by: java.lang.ClassNotFoundException: schemaorg_apache_xmlbeans.system.s8
    B21CFFFCFED0B2438C2585C61F113F7.TypeSystemHolder
    

    it suggests that during compile time the required class files are in classpath but in your built jar these files are missing.

    Check your jar file to see if these classes are present.

    EDIT: As per question rephrased

    For building jar with dependecies in Maven use jar-with-dependencies option, example

    Two very good reference :

    1. http://www.sonatype.com/books/mvnref-book/reference/assemblies-sect-basics.html

    2. http://thomassundberg.wordpress.com/2011/03/05/create-an-executable-jar-from-maven/

    In the second one you don't need a main class if your jar is not an executable jar

提交回复
热议问题