EJB Question

If I have a local EJB bean which has two classes and an interface:

Class:

AccountRoleBean

AccountMgrException

Interface

AccountRole (Local)

And I use it in a webapp, it appears I have to import both the interface and the exception class.

And I'm injecting the class as @EJB AccountRole accountRole

It seems kind of redundant. Do I have the wrong idea?

[407 byte] By [amattasa] at [2007-11-27 11:48:46]
# 1

This is correct. The web application must have access to both the local interface and any other

classes referenced by the business methods on that local interface.

One way to package the classes is to add them to the .war, in addition to the ejb-jar. An alternative is

to refactor the shared classes into a .jar file and put it in a directory called "lib" at the top-level of the

.ear.In Java EE 5, any .jar files in an .ear level "lib" directory are automatically made visible to all

modules within the application.

--ken

ksaksa at 2007-7-29 18:21:13 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

So basically it needs a copy of it to see what its calling, however it executes at the remote or local bean?

amattasa at 2007-7-29 18:21:13 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3

Yes, it needs the classes that are part of the client view. The EJB execution itself needs all the

client view classes + the bean implementation class.

ksaksa at 2007-7-29 18:21:13 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...