File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes EJB must implement in ear file? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "EJB must implement in ear file?" Watch "EJB must implement in ear file?" New topic
Author

EJB must implement in ear file?

Nakataa Kokuyo
Ranch Hand

Joined: Jul 24, 2011
Posts: 184
Good day,

I'm New in EJB thanks to confirm my understanding:-

1. EJB module need to be implement in .ear file format? can it hold it in .war file?
2. can i mix with the EJB code(Connect to DB_1 ) with other code which due with JPA and Hibernate(Connect to DB_2) and package it into single package?

Thanks

K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2247
    
    7

Let see. From my understanding, an EJB module is a jar file. If you wan to incorporate an EJB module in a web app ... then the file needs to be an enterprise archive (ear) file. An EAR can have multiple war and jar (both EJB and app client).

For Q2, because of Q1 (different files) you can package the EJB code with your web code (war) together. Yet the EJB package names can be the same as the packages in the WAR.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
Nakataa Kokuyo
Ranch Hand

Joined: Jul 24, 2011
Posts: 184
Thanks Tsang for guidance!

Just to confirm my understanding, means i should have a single .ear file to package EJB and web module together? I'm seeking a way how to handle my case in Maven, just in case if you can enlighten me on this.
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2247
    
    7

I'm sure you can google for samples
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: EJB must implement in ear file?
 
Similar Threads
How tu re use EJB with a war project
when calling EJb , i am getting exception (javax.naming.LinkException)
Urgent........please respond..question about EAR files
Global JNDI access with EJB 3.1 and JBoss 6
Custom jar to work with third-party ear