File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JBoss/WildFly and the fly likes external libraries in EJB projects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "external libraries in EJB projects" Watch "external libraries in EJB projects" New topic

external libraries in EJB projects

Karol Oslowski
Ranch Hand

Joined: Jul 22, 2005
Posts: 51
Dear All!

I'm trying to write a Session Bean in which one of the business methods is giving as result a class from an external jar (external = not included in the jboss lib). When I try to deploy it I get something like this:


java.lang.NoClassDefFoundError: org/apache/myfaces/custom/tree2/TreeNodeBase
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(
at java.lang.Class.privateGetPublicMethods(
at java.lang.Class.privateGetPublicMethods(
at java.lang.Class.getMethods(
at org.jboss.verifier.strategy.AbstractVerifier.hasEJBCreateMethod(
at org.jboss.verifier.strategy.EJBVerifier20.verifySessionBean(
at org.jboss.verifier.strategy.EJBVerifier20.checkSession(
at org.jboss.verifier.BeanVerifier.verify(


I'm using jboss 4.0.3 and myeclipse. When I check the export checkbox it doesn't help and the resulting ear still doesn't contain the required jar.

In other words the question is:

What's the proper way of deploying external libraries that are to be used by EJB project? Putting them in /lib directory of JBoss seems to work but I suppose this is not the way to go. So how to include external jars in EAR deployment so that they are visible by JBoss classloader (for validating purposes)? (using JBoss and myeclipse)

Thank you in advance for all help.

Kind regards

Heonkoo Lee
Ranch Hand

Joined: Feb 10, 2005
Posts: 85
I would put the external jar in the ear if the jar is only used by a certain application. You can specify the ear's class loader repository in jboss-app.xml (in ear's META-INF directory) like this:

[ October 24, 2005: Message edited by: Heonkoo Lee ]
I agree. Here's the link:
subject: external libraries in EJB projects
It's not a secret anymore!