Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes EJB and other Java EE Technologies and the fly likes How tu re use EJB with a war project 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 » Java » EJB and other Java EE Technologies
Bookmark "How tu re use EJB with a war project" Watch "How tu re use EJB with a war project" New topic
Author

How tu re use EJB with a war project

Thiebaut olivier
Greenhorn

Joined: Jul 10, 2008
Posts: 14
Hey,

I implement EJBs 3.0 classes and packaging them in a jar file. I don't want to use a EAR project.
So I develop an web project in a war file.
But i want to use the EJB in this new project, so i imported the EJB's project like a library ( with maven )

mvn install:file ....


but when i deploy there is an error because glassfish consider that the EJB's project is already deployed.

Is there a solution to import an EJB's project with maven ?

Do it must packaging all in EAR project ?
But how use EJB in an another project ?

so many questions ...

Do you have a link with explications to packaging with many independant EJB.

Thanks
Olivier / paris ;=)
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30138
    
150

Olivier,
If you pack them in an ejb jar instead of a regular jar, they are part of the ear and you can reuse them by copying the jar into different ears.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

If you need to install EJB into maven, you need to use EJB packaging as Jeanne has mentioned. Too add dependency of that EJB in your maven project, you can do this.


And you need to package them in as an EAR in order to use both EJB and WAR together. EJB 3.1 will fix this issue, though.


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Thiebaut olivier
Greenhorn

Joined: Jul 10, 2008
Posts: 14
Thanks,

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How tu re use EJB with a war project
 
Similar Threads
maven: the war directory structure
package structure during design
What does maven "packaging = jar" mean ?
maven ear plugin question
javaee: eclipse + maven