开发者

"java.lang.ClassNotFoundException: javax.ejb.EJBObject" when running JAR

I'm getting a java.lang.ClassNotFoundException: javax.ejb.EJBObject error when I'm running my application as a JAR file. When running it in Eclipse everything is working fine.

The application properly access the main class and the main method. But when it tries to load the application context it cannot resolve a reference to an EJB bean. I then get the following error:

Error creating bean with name 'bc' defined in class path resource [blabla.xml]:
    Initialization of bean failed; 
nested exception is 
开发者_Go百科    java.lang.NoClassDefFoundError: javax/ejb/EJBObject 
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275) 
        ... 
Caused by: 
    java.lang.ClassNotFoundException: javax.ejb.EJBObject

I've included all runtime-scoped dependencies with Maven in the JAR file.

Do you know any further information regarding this error?


A little list of things to check:

  • Is the EJBObjectclass located in a dependency with provided scope?
  • Is the JAR containing the EJBObject class really on the classpath? I.e., do you either add it to the class path when running the JAR, or do you use the onejar-plugin to put your dependencies into the JAR?
  • If you are using onejar: Are you really running the JAR created by onejar (myproject.one-jar.jar), and not the one without the dependencies (myproject.jar)?
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜