Problem making a class in another jar visiable to a ejb in its ejb jar
Tony Evans
Ranch Hand
Joined: Jun 29, 2002
Posts: 521
posted
0
m, I have a ejb which is trying to call a class in another jar. When I try to laod my ejb jar file I get the following error:
Unable to deploy EJB: .\adminsvr\stage\_appsdir_BrokerEAR_ear\BrokerEJB.jar from BrokerEJB.jar:
[EJB:010106]EJB : TradeObject .Unable to initialize method info for remote or home interface. The error is java.lang.NoClassDefFoundError: brokearage/broker/co/trade/BrokerTrade.
The class BrokerTrade.class is in a jar called TradeJar.jar
Its is called by and passed as a parameter by TradesBean.java a statless session bean.
The steps I have taken is
1)Create both jars. 2)Add both jars to the META-INF directory in the BrokerEAR.ear file
Manifest-Version: 1.0 Ant-Version: Apache Ant 1.6.5 Created-By: Apache Ant 1.5.1 Class-Path: TradeJar.jar, BrokerEJB.jar
Are there any other steps I need to do to make a class in one jar visiable to a class in another jar.
If I put BrokerTrade.class into the BrokerEJB.jar I solve the problem, but what I want to find out is how classes from one jar can interact with classes from another jar.
Tony Evans
Ranch Hand
Joined: Jun 29, 2002
Posts: 521
posted
0
Solved the problem in my BrokerEJB.jar under the META-INF directory I need to add the classpath TradeJar.jar to the Manifest.mf
I thought you only needed to add it under the .EAR META-INF, but if a class in one jar is calling a class in another jar then you need to add that jar to the first classes Jar classpath which is the Manifest.mf file.
Exactly. If it is in the same ear, you would use your application.xml to set the "modules". so a module would point to a jar file. In this case the Ear file does not need the information in the META-INF file.