简体   繁体   English

来自xmlbeans的RuntimeException - 找不到已编译的模式

[英]RuntimeException from xmlbeans - can't find compiled schema

I'm getting a RuntimeException while executing some code that depends on generated xmlbeans classes. 我在执行一些依赖于生成的xmlbeans类的代码时遇到了RuntimeException。 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. xbean.jar版本在构建和执行环境中是相同的。 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...

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. 我使用xmlBeans生成Java类,并在我的项目中手动将源文件复制到“noNamespace”之外进行修改。 unfortunately I did not recognize that there were also generated class files in the "schemaorg_apache_xmlbeans" folder and did not copy them. 遗憾的是,我没有意识到“schemaorg_apache_xmlbeans”文件夹中也生成了类文件,并且没有复制它们。
After switching to the usage of the generated jar-file everything worked fine for me. 切换到生成的jar文件的使用后,一切正常。

I've never used the library before but I can kind of guess at what's going on. 我之前从未使用过该库,但我可以猜测发生了什么。 With that qualifier (ie, I'm just making this up, but it's been 7 hours and no one else has made anything up)... 有了这个资格赛(也就是说,我只是做了这个,但是已经7个小时了,没有其他人做过任何事情)......

Stating the obvious: something has been compiled somewhere and can't be loaded. 陈述显而易见:某些东西已被编译到某处并且无法加载。 I don't think this something is in the jar file; 我不认为这个东西在jar文件中; I'm guessing it's one of your resources that's been compiled/cached to some location. 我猜这是你的资源之一被编译/缓存到某个位置。

I would guess either: 我猜也是:

  • it's compiled in a place it's not loadable from (messed up classpath/config) 它是在一个无法加载的地方编译的(搞砸了classpath / config)
  • the versioning is wrong between what's been compiled and what wants to be loaded 在编译的内容和想要加载的内容之间进行版本控制是错误的

Did you change something (eg schema version?) between the compilation and loading/running? 您是否在编译和加载/运行之间更改了某些内容(例如架构版本?)?

Can you remove the compiled version and recompile and then try a reload? 你可以删除已编译的版本并重新编译然后尝试重新加载吗?

Can you locate the compiled version in the file system? 你能在文件系统中找到编译后的版本吗?

To do this, you might try 为此,您可以尝试

grep "s2B8331230CBD98F4933B0B025B6BF726" `find .` grep“s2B8331230CBD98F4933B0B025B6BF726”`find .`

from some suitable directory. 从一些合适的目录。

Can you do an an md5 on the class/resource causing problems in both compile and runtime environments? 你能在类/资源上做一个md5导致编译和运行时环境出现问题吗? Do they match? 他们匹配吗?

Hope something in there helps or triggers a thought. 希望那里的某些东西可以帮助或触发思想。

I have seen this problem often when there was a script (ant, maven, ...) that would handle the XMLBeans compilation and another mechanism was used for compiling and running the rest of the code. 当有一个脚本(ant,maven,...)处理XMLBeans编译并且另一个机制用于编译和运行其余代码时,我经常看到这个问题。 Sometimes one piece will delete the generated files that XMLBeans is looking for in your stack trace, but will leave the generated XMLBeans Java files so everything will compile and look fine. 有时,一个部分将删除XMLBeans在堆栈跟踪中查找的生成文件,但是将保留生成的XMLBeans Java文件,以便所有内容都可以编译并且看起来很好。

I have also seen this when using the option to output the source files, but not the class files. 我在使用选项输出源文件时也看到了这一点,但不是类文件。 The non-Java source files are only generated directly into the class folder or jar file generated by XMLBeans. 非Java源文件仅直接生成到XMLBeans生成的类文件夹或jar文件中。

These class files are generated in the resources/schemaorg_apache_xmlbeans directory. 这些类文件在resources / schemaorg_apache_xmlbeans目录中生成。 I have seen xmlbeans behaviour where the generated ant script has failed to include this directory in the jar it creates (perhaps due to a bug?) Check that it has been included in the jar. 我已经看到了xmlbeans行为,其中生成的ant脚本未能在它创建的jar中包含此目录(可能是由于一个错误?)检查它是否已包含在jar中。 You could manually re-jar, or check your code generation commandline options. 您可以手动重新jar,或检查代码生成命令行选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从自定义类导入时,无法对XMLBeans jar进行签名 - XMLBeans jar can't be signed when imported from custom class RuntimeException 找不到布局 XML 资源 - RuntimeException can't find layout XML resource HTTP 500 java.lang.RunTimeException找不到FacesContext - HTTP 500 java.lang.RunTimeException Can't find FacesContext XML-BEANS编译模式:无法找到已编译的模式资源schemaorg_apache_xmlbeans / system / sE130CAA0A01A7CDE5A2B4FEB8B311707 / index.xsb - XML-BEANS compiled schema: Could not locate compiled schema resource schemaorg_apache_xmlbeans/system/sE130CAA0A01A7CDE5A2B4FEB8B311707/index.xsb XMLBeans模式编译-scomp实用程序 - XMLBeans schema compilation - scomp utility 模式无法使用“找不到字段ID…”异常进行初始化 - Schema can't initialize with “Can't find field id …” exception 如何使用Apache XMLBeans从Xsd-Schema中读取Xsd-Annotations? - How to read Xsd-Annotations from Xsd-Schema using Apache XMLBeans? 带有XMLBeans数据绑定的Axis2-从具有anyType的XSD架构生成的Java客户端出现问题 - Axis2 with XMLBeans data binding - Problem with a java client generated from a XSD schema with anyType RuntimeException:在路径DexPathList上找不到类 - RuntimeException : Didn't find class on path: DexPathList 使用XMLBeans编译2 WSDL使用的共享模式 - Compiling shared schema used by 2 WSDL using XMLBeans
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM