You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Duane Homick <dh...@SANDVINE.com> on 2005/11/23 22:50:51 UTC

EJB with Maven2

I have a simple (hopefully) EJB question, but I couldnt find an answer on the website:

I have a project that has two subprojects A & B.  Subproject A contains a message driven bean.  Subproject B contains a utility library.  Subproject A has a dependency on B since it uses that utility library.  

B has packaging of jar
A has packaging of ejb

How would I deploy this to an application server?  If I do it now using the jboss:harddeploy of A, it will deploy the A-1.0.jar, but it will fail when running because B is not in the classpath (as expected).  So, the question becomes 

1) should B be packaged as part of A?
2) should B and A be packaged together in a third subproject called C that produces an ear?
3) some other option?

Thanks
Duane Homick
Sandvine Incorporated

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: EJB with Maven2

Posted by Henry Isidro <hi...@exist.com>.
Alexandre Poitras wrote:

>I think he also needs to add manifest entries so the ejb jar can loads
>class from the other jar. If you don't do that your A project won't be
>in your B project class path.
>
>  
>
Yup you're right there...I didn't mention it anymore since you already 
said something about it. Anyway, hope this clears things up.

Regards,
Henry

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: EJB with Maven2

Posted by Alexandre Poitras <al...@gmail.com>.
I think he also needs to add manifest entries so the ejb jar can loads
class from the other jar. If you don't do that your A project won't be
in your B project class path.

On 11/23/05, Henry Isidro <hi...@exist.com> wrote:
> Alexandre Poitras wrote:
>
> >Just wanted to add, that you need a subproject C to produce the ear
> >file and include jars A and B. It is quite easy to setup. Look in the
> >guides on the Maven site but don't be shy to ask if you need any help!
> >
> >On 11/23/05, Alexandre Poitras <al...@gmail.com> wrote:
> >
> >
> >>I had the same problem but it's quite easy to fix. What do you want is
> >>to add class-path entries in the manifest file of your ejb jar. Of
> >>course, Maven can do all of that for you. You just need to add this
> >>section to your B subproject pom file (I supposed the packaging
> >>specified for it is ejb) :
> >>
> >><project>
> >>  ...
> >>  <build>
> >>    <plugins>
> >>      <plugin>
> >>        <groupId>org.apache.maven.plugins</groupId>
> >>        <artifactId>maven-ejb-plugin</artifactId>
> >>        <configuration>
> >>          <archive>
> >>            <manifest>
> >>              <addClasspath>true</addClasspath>
> >>            </manifest>
> >>          </archive>
> >>        </configuration>
> >>      </plugin>
> >>    </plugins>
> >>  </build>
> >>  ...
> >></project>
> >>
> >>By the way, all those configuration options come from the jar plugin
> >>(wich ejb plugin extends). You can take a look at the following
> >>documentation for more details :
> >>http://maven.apache.org/guides/mini/guide-manifest.html
> >>
> >>It has fixed the problem in my case on Oracle oc4j but the way the
> >>classpath is contructed is standard so it should work without any
> >>problems on JBoss. Hope it's help.
> >>
> >>
> >>
> >>
> >>
> >>On 11/23/05, Duane Homick <dh...@sandvine.com> wrote:
> >>
> >>
> >>>I have a simple (hopefully) EJB question, but I couldnt find an answer on the website:
> >>>
> >>>I have a project that has two subprojects A & B.  Subproject A contains a message driven bean.  Subproject B contains a utility library.  Subproject A has a dependency on B since it uses that utility library.
> >>>
> >>>B has packaging of jar
> >>>A has packaging of ejb
> >>>
> >>>How would I deploy this to an application server?  If I do it now using the jboss:harddeploy of A, it will deploy the A-1.0.jar, but it will fail when running because B is not in the classpath (as expected).  So, the question becomes
> >>>
> >>>1) should B be packaged as part of A?
> >>>2) should B and A be packaged together in a third subproject called C that produces an ear?
> >>>3) some other option?
> >>>
> >>>Thanks
> >>>Duane Homick
> >>>Sandvine Incorporated
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >>>For additional commands, e-mail: users-help@maven.apache.org
> >>>
> >>>
> >>>
> >>>
> >>
> >>--
> >>Alexandre Poitras
> >>Québec, Canada
> >>
> >>
> >>
> >
> >
> >--
> >Alexandre Poitras
> >Québec, Canada
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> >
> >
> You could package the jar inside the ejb-jar but creating an EAR file
> with both jars inside it is the way to do it. Deploy that EAR to your
> container and everything should be fine.
>
> Regards,
> Henry
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


--
Alexandre Poitras
Québec, Canada

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: EJB with Maven2

Posted by Henry Isidro <hi...@exist.com>.
Alexandre Poitras wrote:

>Just wanted to add, that you need a subproject C to produce the ear
>file and include jars A and B. It is quite easy to setup. Look in the
>guides on the Maven site but don't be shy to ask if you need any help!
>
>On 11/23/05, Alexandre Poitras <al...@gmail.com> wrote:
>  
>
>>I had the same problem but it's quite easy to fix. What do you want is
>>to add class-path entries in the manifest file of your ejb jar. Of
>>course, Maven can do all of that for you. You just need to add this
>>section to your B subproject pom file (I supposed the packaging
>>specified for it is ejb) :
>>
>><project>
>>  ...
>>  <build>
>>    <plugins>
>>      <plugin>
>>        <groupId>org.apache.maven.plugins</groupId>
>>        <artifactId>maven-ejb-plugin</artifactId>
>>        <configuration>
>>          <archive>
>>            <manifest>
>>              <addClasspath>true</addClasspath>
>>            </manifest>
>>          </archive>
>>        </configuration>
>>      </plugin>
>>    </plugins>
>>  </build>
>>  ...
>></project>
>>
>>By the way, all those configuration options come from the jar plugin
>>(wich ejb plugin extends). You can take a look at the following
>>documentation for more details :
>>http://maven.apache.org/guides/mini/guide-manifest.html
>>
>>It has fixed the problem in my case on Oracle oc4j but the way the
>>classpath is contructed is standard so it should work without any
>>problems on JBoss. Hope it's help.
>>
>>
>>
>>
>>
>>On 11/23/05, Duane Homick <dh...@sandvine.com> wrote:
>>    
>>
>>>I have a simple (hopefully) EJB question, but I couldnt find an answer on the website:
>>>
>>>I have a project that has two subprojects A & B.  Subproject A contains a message driven bean.  Subproject B contains a utility library.  Subproject A has a dependency on B since it uses that utility library.
>>>
>>>B has packaging of jar
>>>A has packaging of ejb
>>>
>>>How would I deploy this to an application server?  If I do it now using the jboss:harddeploy of A, it will deploy the A-1.0.jar, but it will fail when running because B is not in the classpath (as expected).  So, the question becomes
>>>
>>>1) should B be packaged as part of A?
>>>2) should B and A be packaged together in a third subproject called C that produces an ear?
>>>3) some other option?
>>>
>>>Thanks
>>>Duane Homick
>>>Sandvine Incorporated
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>      
>>>
>>
>>--
>>Alexandre Poitras
>>Québec, Canada
>>
>>    
>>
>
>
>--
>Alexandre Poitras
>Québec, Canada
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>For additional commands, e-mail: users-help@maven.apache.org
>
>
>  
>
You could package the jar inside the ejb-jar but creating an EAR file 
with both jars inside it is the way to do it. Deploy that EAR to your 
container and everything should be fine.

Regards,
Henry

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: EJB with Maven2

Posted by Alexandre Poitras <al...@gmail.com>.
Just wanted to add, that you need a subproject C to produce the ear
file and include jars A and B. It is quite easy to setup. Look in the
guides on the Maven site but don't be shy to ask if you need any help!

On 11/23/05, Alexandre Poitras <al...@gmail.com> wrote:
> I had the same problem but it's quite easy to fix. What do you want is
> to add class-path entries in the manifest file of your ejb jar. Of
> course, Maven can do all of that for you. You just need to add this
> section to your B subproject pom file (I supposed the packaging
> specified for it is ejb) :
>
> <project>
>   ...
>   <build>
>     <plugins>
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-ejb-plugin</artifactId>
>         <configuration>
>           <archive>
>             <manifest>
>               <addClasspath>true</addClasspath>
>             </manifest>
>           </archive>
>         </configuration>
>       </plugin>
>     </plugins>
>   </build>
>   ...
> </project>
>
> By the way, all those configuration options come from the jar plugin
> (wich ejb plugin extends). You can take a look at the following
> documentation for more details :
> http://maven.apache.org/guides/mini/guide-manifest.html
>
> It has fixed the problem in my case on Oracle oc4j but the way the
> classpath is contructed is standard so it should work without any
> problems on JBoss. Hope it's help.
>
>
>
>
>
> On 11/23/05, Duane Homick <dh...@sandvine.com> wrote:
> > I have a simple (hopefully) EJB question, but I couldnt find an answer on the website:
> >
> > I have a project that has two subprojects A & B.  Subproject A contains a message driven bean.  Subproject B contains a utility library.  Subproject A has a dependency on B since it uses that utility library.
> >
> > B has packaging of jar
> > A has packaging of ejb
> >
> > How would I deploy this to an application server?  If I do it now using the jboss:harddeploy of A, it will deploy the A-1.0.jar, but it will fail when running because B is not in the classpath (as expected).  So, the question becomes
> >
> > 1) should B be packaged as part of A?
> > 2) should B and A be packaged together in a third subproject called C that produces an ear?
> > 3) some other option?
> >
> > Thanks
> > Duane Homick
> > Sandvine Incorporated
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
>
>
> --
> Alexandre Poitras
> Québec, Canada
>


--
Alexandre Poitras
Québec, Canada

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: EJB with Maven2

Posted by Alexandre Poitras <al...@gmail.com>.
I had the same problem but it's quite easy to fix. What do you want is
to add class-path entries in the manifest file of your ejb jar. Of
course, Maven can do all of that for you. You just need to add this
section to your B subproject pom file (I supposed the packaging
specified for it is ejb) :

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-ejb-plugin</artifactId>
        <configuration>
          <archive>
            <manifest>
              <addClasspath>true</addClasspath>
            </manifest>
          </archive>
        </configuration>
      </plugin>
    </plugins>
  </build>
  ...
</project>

By the way, all those configuration options come from the jar plugin
(wich ejb plugin extends). You can take a look at the following
documentation for more details :
http://maven.apache.org/guides/mini/guide-manifest.html

It has fixed the problem in my case on Oracle oc4j but the way the
classpath is contructed is standard so it should work without any
problems on JBoss. Hope it's help.





On 11/23/05, Duane Homick <dh...@sandvine.com> wrote:
> I have a simple (hopefully) EJB question, but I couldnt find an answer on the website:
>
> I have a project that has two subprojects A & B.  Subproject A contains a message driven bean.  Subproject B contains a utility library.  Subproject A has a dependency on B since it uses that utility library.
>
> B has packaging of jar
> A has packaging of ejb
>
> How would I deploy this to an application server?  If I do it now using the jboss:harddeploy of A, it will deploy the A-1.0.jar, but it will fail when running because B is not in the classpath (as expected).  So, the question becomes
>
> 1) should B be packaged as part of A?
> 2) should B and A be packaged together in a third subproject called C that produces an ear?
> 3) some other option?
>
> Thanks
> Duane Homick
> Sandvine Incorporated
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>



--
Alexandre Poitras
Québec, Canada

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org