Thufir
Thufir

Reputation: 8487

NoClassDefFound means that the class cannot be found?

I don't understand NoClassDefFoundError in the context of running an OpenEJB client:

thufir@doge:~$ 
thufir@doge:~$ java -classpath .:NetBeansProjects/HelloClient/dist/HelloClient.jar:apache-openejb-4.7.1/lib/openejb-client-4.7.1.jar org.acme.HelloClient
Exception in thread "main" java.lang.NoClassDefFoundError: javax/ejb/EJBHome

The missing class, EJBHome, is in the libray for the project:

libraries

Yet doesn't show up in the manifest. How do I either force NetBeans to add the JAR to the classpath (if that's the solution), or, include the JAR in the classpath during execution?

Upvotes: 1

Views: 823

Answers (2)

Davide Lorenzo MARINO
Davide Lorenzo MARINO

Reputation: 26926

NoClassDefFoundError means that the class was present at compile time, but is not present at run time. So probably your deploy has'nt that class.

Upvotes: 3

Jon Skeet
Jon Skeet

Reputation: 1499830

You include the jar file in the classpath when you execute by simply putting it in that list of jar files you've already got - you're already specifying openejb-client-4.7.1.jar etc; just add javaee-api-7.0.jar to that list (with the right directory, of course).

Upvotes: 2

Related Questions