tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Invoke an EJB that was deployed within a different WAR
Date Thu, 20 May 2010 14:54:22 GMT
This seems like a pretty simple problem, but I've tried everything and need some help.

We're running openejb within tomcat.  I have a war application (named ReportGenerator) deployed
which contains an ejb lib with an ejb named ReportGeneratorBean. 
@Stateless(name = ReportGeneratorBean.EJB_NAME, mappedName = ReportGeneratorBean.EJB_NAME)
public class ReportGeneratorBean implements ReportGeneratorLocal {
	public static final String EJB_NAME = "ejb/ReportgeneratorBean/local";

This war and bean deploys fine and I can invoke it from the openejb console without problems.

I have a second war application (named PaymentTracker) deployed to the same JVM which contains
an ejb lib with an ejb named PaymentTrackerBean.
@Stateless(name = PaymentTrackerBean.EJB_NAME, mappedName = PaymentTrackerBean.EJB_NAME)
public class PaymentTrackerBean implements PaymentTrackerLocal {
	public static final String EJB_NAME = "ejb/PaymenttrackerBean/local";

Now, I simply want the PaymentTrackerBean to invoke a method on the ReportGeneratorBean. 
	private ReportGeneratorLocal reportGenerator;

Sounds easy right.  The problem is, in order to avoid a ClassNotFoundException upon the PaymentTracker
deployment, I have to package the jar which contains the ReportGeneratorLocal (because of
the ReportGeneratorLocal declaration within my PaymentTrackerBean).  When I do this, the PaymentTrackerBean
will fail to deploy because openejb tries to deploy the ReportGeneratorBean again (when it
finds the jar) and I end up with a duplicate id exception.

So I then tried to deploy the PaymentTracker with just the ReportGeneratorLocal class within
it.  The app deploys, but the ReportGeneratorLocal is not being injected (I end up with a
null pointer).  I played around with the openejb.xml openejb.deployments.classpath.exclude/include
but I didn't have any luck and I'm not sure you can even do this.  My thought was that I can
tell openejb to not load the ReportGeneratorBean when deploying the PaymentTracker application.

I then tried adding the following to the PaymentTrackerBean's ejb-jar.xml

But then I'm getting the following error.

2010-05-20 07:55:05,392 - ERROR - Unable to deploy collapsed ear in war /payment-tracker:
Exception: null
	at org.apache.openejb.core.TempClassLoader.loadClass(
	at org.apache.openejb.core.TempClassLoader.loadClass(

So I think it is possible that I have something wrong with my syntax, but I'm not sure.

I can NOT put the ReportGeneratorBean in my tomcat/lib dir because it has too many dependencies.
 I've already tried this by creating a single jar with the exploded dependencies and this
causes other issues.

Since this ReportGeneratorBean can be useful to many of our apps, I'd don't want to deploy
it with the PaymentTracker app.

Anyone have any solutions or suggestions?

Thanks so much!

This message was sent on behalf of at

View raw message