How to include external jar in ejb-jar

2019-09-04 08:46发布

问题:

How can I include external jar file in my ejb3 jar file? There is one external jar project with all helper classes and manifest.mf file. Now I have this jar in my classpath in eclipse. But when eclipse build the ejb-jar I want it to include this external jar file so in Application server when my ejb loads and run it can use classes in external jar. Right now I am adding a reference in Manifest.mf for ejb-jar, still when eclipse build the ejb-jar it is not packaging this external jar and during runtime I am getting ClassNotFoundException.

Can somebody please give me an example how to achieve this? I am using Eclipse 3.6 and EJB3

回答1:

You have to create ear or war deployment and include your ejb.jar and a third-party.jar into it. Then deploy it to jboss



回答2:

I found a solution. Method 2 Worked for me. the tutorial uses Rational, but I assume Eclipse will be similar. http://www.ibm.com/developerworks/rational/library/07/1211_schrag/index.html check it out.