This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Deploying EJB and dependent classes

 
vivek nagulapati
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,
I am trying to deploy an EJB which uses an external Java class to perform the business logic. I packed the EJB, along with the deployment descriptors and the external Java class into a jar file and tried deploying the EJB bean.
I am always getting a "NoClassFoundError" on the external class when deploying the EJB. Somehow the application server i.e., JBoss 3.2.1 is unable to load the external Java class.
I tried packing the external jar file and copied the jar file into the "server/default/lib" but in vain. I also tried "CLASSPATH" point to the jar file but the error still persisted.
Do we have to edit the ejb-jar.xml file and can we use <resource-ref> for external Java classes or is it reserved for external EJB's?
Can anyone help me?
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suspect that it's not the external class that is the problem but rather some other class that that class depends on. NoClassDefFound exceptions are tricky to track down, but often it isn't the class that is in the exception message. Take a look at that class's imports (and the imports of those classes) to see what class in the tree is missing.
 
Marcos Maia
Ranch Hand
Posts: 977
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by vivek nagulapati:

I tried packing the external jar file and copied the jar file into the "server/default/lib" but in vain. I also tried "CLASSPATH" point to the jar file but the error still persisted.
Can anyone help me?

Business Classes should not be in the server classpath as they're problably not used for most of the applications.
You should package the classes together with your .jar or .ear file. It's also a good idea to read about the classloader of the app server u're using.
regards.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic