I'm totaly newbie in EJB and i need to understand how "ejb pool" works and how it is shared between EARS.
We have an EAR (named "ear1") deployed on WebSphere 8.5. This EAR contains some Stateless EJB3 (test.Ejb1, test.Ejb2, test.Ejb3) used by business-logic for access DB (using a "SQL-DB-datasource1").
We need to build a new EAR (named "ear2") and deploy it in the same websphere, but referencing a new datasource ("SQL-DB-datasource2").
Questions:
1. the EJB pool is the same and shared between ears, right?
2. if (mistake) i use same packages and the same EJB's names in both EARs (test.Ejb1, test.Ejb2, test.Ejb3), am i risking "ejb conflicts" between the two EARS when i will reference these EJB into rest services?
3. Or each EAR has "its own context" in the EJB pool?
4. "ear2" can access EJBs defined in "ear1"?
5. depends on how i make the "EJB lookup"?
Thanks!
Asked
Active
Viewed 81 times
-2

Bart
- 1
- 1
1 Answers
0
- No, each EJB has its own pool.
- No, each application is loaded by a distinct class loader (by default), which means there is no risk of conflict, only a risk of potential confusion for you.
- Yes.
- Yes if the EJBs have remote interfaces. Yes but with caveats if the EJBs have local interfaces; see the "Local client views" section of the EJB modules topic in the Knowledge Center.
- Yes, you will need to use a lookup string. The EJB container will print a
CNTR0167I
message when an application is starting, which will give you the lookup string. I would recommend using thejava:global
lookup string with an EJB reference (@EJB
annotation or<ejb-ref>
/<ejb-local-ref>
XML element).

Brett Kail
- 33,593
- 2
- 85
- 90