简体   繁体   English

线程“main”中的异常 java.lang.NoClassDefFoundError: si.gov.fu.InvoiceRequest - 如何解决?

[英]Exception in thread "main" java.lang.NoClassDefFoundError: si.gov.fu.InvoiceRequest - how to resolve?

I get this error when I try to run my code, project builds normally, also I get no errors while compiling and packaging everything into .jar file.当我尝试运行我的代码时出现此错误,项目构建正常,并且在将所有内容编译和打包到 .jar 文件时也没有出现错误。 I am using Intellij software.我正在使用 Intellij 软件。

eveything stops when I try to call this line:当我尝试调用此行时,一切都停止了:

JAXBContext jaxbContext = JAXBContext.newInstance(InvoiceRequest.class);

I have imported the: import si.gov.fu.*;我已经导入了:import si.gov.fu.*; import si.gov.fu.InvoiceRequest;导入 si.gov.fu.InvoiceRequest;

But at first, when I tried to import second library, I had the InvoiceRequest crossed, like I cannot use it, even though it has been compiled and packed up like it should.但起初,当我尝试导入第二个库时,我遇到了 InvoiceRequest 交叉,就像我不能使用它一样,即使它已经按照它应该的方式编译和打包。

Any clue?有什么线索吗?

Best regards此致

You are getting a runtime error.您收到运行时错误。 Guess your program was compiled and linked successfully, but the InvoiceRequest is not available at runtime, that is it is changed since compilation.猜猜你的程序编译成功,链接成功,但是运行时InvoiceRequest不可用,就是编译后改变了。

InvoiceRequest is in the classpath, otherwise you would have got a ClassNotFoundException, the NoClassDefFoundError is a runtime error. InvoiceRequest 在类路径中,否则你会得到一个 ClassNotFoundException, NoClassDefFoundError是一个运行时错误。

So recompile and deploy again with the dependencies in proper order.因此,以正确的顺序重新编译和部署依赖项。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM