Re: Building WAR files with/without EAR context
On Fri, 18 Nov 2016 11:17:08 +0100 Stefan Seidel wrote: > you don't usually depend on EJBs in your WARs. That's actually right. You depend on the API (interfaces) of the EJBs. This is usually in separate JAR (but it is not required to be). > You should depend on > ejb- client. IIRC you'll have to explicitely configure your EJB > project to create an ejb-client artifact. You mean this: http://maven.apache.org/plugins/maven-ejb-plugin/examples/generating-ejb-client.html That's one possibility to separate interfaces and classes. But IMHO this only sufficies very simple scenarios. I usually separate the classes and interfaces by hand and have different modules for them. - martin pgpQF_XDm17wF.pgp Description: Digitale Signatur von OpenPGP
Re: Building WAR files with/without EAR context
Hi, you don't usually depend on EJBs in your WARs. You should depend on ejb- client. IIRC you'll have to explicitely configure your EJB project to create an ejb-client artifact. I just tried that though, and the ejb-client JAR is still kept inside the WAR. Are you planning to deploy your WAR files also in a servlet container? Because if not, you could mark the ejb/ejb-client dependency as provided. That's how we solved that. Stefan - On Thursday 17 November 2016 15:07:31 Stefan Seidel wrote: > On 17 Nov 2016, Clemens von Musil wrote: > > We pushed a very minimal example project to a public github repo located > > here: > > > > https://github.com/kr1schan/mavenToy > > > > The project consists of an ear, two war modules, one ejb module and one > > plain jar artifact. > > Both war modules depend on the ejbmodule as well as on the jar artifact. > > SkinnyWar is enabled and configured in all conscience. > > > > After 'mvn clean package', the resulting ear shows correct handling of the > > jar dependency. > > The ejb dependency remains in both war files. > > Good to have a minimal example showing the problem! I confirm that I can > reproduce the buggy (?) behavior. > > Unfortunately I can reproduce it and can't see the error when looking > into it for 5 minutes. Don't have time for a close look right now, sorry. > > - martin
Re: Building WAR files with/without EAR context
On 17 Nov 2016, Clemens von Musil wrote: > We pushed a very minimal example project to a public github repo located > here: > > https://github.com/kr1schan/mavenToy > > The project consists of an ear, two war modules, one ejb module and one > plain jar artifact. > Both war modules depend on the ejbmodule as well as on the jar artifact. > SkinnyWar is enabled and configured in all conscience. > > After 'mvn clean package', the resulting ear shows correct handling of the > jar dependency. > The ejb dependency remains in both war files. Good to have a minimal example showing the problem! I confirm that I can reproduce the buggy (?) behavior. Unfortunately I can reproduce it and can't see the error when looking into it for 5 minutes. Don't have time for a close look right now, sorry. - martin pgpmDxkBhdffg.pgp Description: Digitale Signatur von OpenPGP
Re: Building WAR files with/without EAR context
We pushed a very minimal example project to a public github repo located here: https://github.com/kr1schan/mavenToy The project consists of an ear, two war modules, one ejb module and one plain jar artifact. Both war modules depend on the ejbmodule as well as on the jar artifact. SkinnyWar is enabled and configured in all conscience. After 'mvn clean package', the resulting ear shows correct handling of the jar dependency. The ejb dependency remains in both war files. Can you please point us our error? Thanks a lot, Clemens von Musil P.S: There is a branch called 'ejb-skinny-wars' showing the workaround I described in my latest post. 2016-11-16 10:39 GMT+01:00 Martin Hoeller : > On 16 Nov 2016, Clemens von Musil wrote: > > > This is true for jar dependencies. > > > > But if the war file depends on an artifact with type ejb > > (ejb), the skinnywar-option ignores this dependency and let > it > > remain in war/lib. > > This is not true in general, it works for me! > Did you declare the dependency correct with ejb in *all* > places (WAR and EAR, and maybe a parent POM)) where you reference it? > > > And if there are two war files WAR1 and WAR2 depending on the same > artifact > > with type ejb, the ear isn't deployable as the beans within the > > ejb-artifact resist in WAR1/lib _and_ WAR2/lib. The container tries to > > deploy beans from both loations and struggles as it cannot deploy the > same > > bean twice. > > This is a logical result from the above problem. > > > We found a workaound. We define all dependencies without the type-tag to > > keep the skinnywar-option working. To avoid malicious packaging inside > the > > EAR, we define all these dependencies as jarmodules with explicit deploy > > path and entry in the application.xml. Such a definition looks like > > > > > > groupid > > artifactid > > true > > / > > > > > > Ugly but working. > > This shouldn't be necessary. I really think you have a configuration bug > and missed the ejb in some places. > > - martin > -- Clemens von Musil - mu...@sipgate.de Telefon: +49 (0)211-63 55 56-85 Telefax: +49 (0)211-63 55 55-22 sipgate GmbH - Gladbacher Str. 74 - 40219 Düsseldorf HRB Düsseldorf 39841 - Geschäftsführer: Thilo Salmon, Tim Mois Steuernummer: 106/5724/7147, Umsatzsteuer-ID: DE219349391 www.sipgate.de - www.sipgate.at - www.sipgate.co.uk
Re: Building WAR files with/without EAR context
On 16 Nov 2016, Clemens von Musil wrote: > This is true for jar dependencies. > > But if the war file depends on an artifact with type ejb > (ejb), the skinnywar-option ignores this dependency and let it > remain in war/lib. This is not true in general, it works for me! Did you declare the dependency correct with ejb in *all* places (WAR and EAR, and maybe a parent POM)) where you reference it? > And if there are two war files WAR1 and WAR2 depending on the same artifact > with type ejb, the ear isn't deployable as the beans within the > ejb-artifact resist in WAR1/lib _and_ WAR2/lib. The container tries to > deploy beans from both loations and struggles as it cannot deploy the same > bean twice. This is a logical result from the above problem. > We found a workaound. We define all dependencies without the type-tag to > keep the skinnywar-option working. To avoid malicious packaging inside the > EAR, we define all these dependencies as jarmodules with explicit deploy > path and entry in the application.xml. Such a definition looks like > > > groupid > artifactid > true > / > > > Ugly but working. This shouldn't be necessary. I really think you have a configuration bug and missed the ejb in some places. - martin pgpqa8E2V9Nlr.pgp Description: Digitale Signatur von OpenPGP
Re: Building WAR files with/without EAR context
This is true for jar dependencies. But if the war file depends on an artifact with type ejb (ejb), the skinnywar-option ignores this dependency and let it remain in war/lib. And if there are two war files WAR1 and WAR2 depending on the same artifact with type ejb, the ear isn't deployable as the beans within the ejb-artifact resist in WAR1/lib _and_ WAR2/lib. The container tries to deploy beans from both loations and struggles as it cannot deploy the same bean twice. We found a workaound. We define all dependencies without the type-tag to keep the skinnywar-option working. To avoid malicious packaging inside the EAR, we define all these dependencies as jarmodules with explicit deploy path and entry in the application.xml. Such a definition looks like groupid artifactid true / Ugly but working. 2016-11-16 9:24 GMT+01:00 Martin Hoeller : > On 14 Nov 2016, Clemens von Musil wrote: > > > Hi again, > > > > thanks a lot for your advice, Martin. > > > > We spent a lot of time into skinny wars but stuck with ejb dependencies. > > > > The EAR contains several WAR modules and these WAR modules share several > > EJB modules. > > Unfortunately, the skinny war option seems to ignore transitive EJB > > dependencies so that we get errors with duplicate beans on startup. > > The skinnyWar-option should just remove JARs from the WAR that are also > defined in the POM of the EAR module. Nothing special about transitive > dependencies here I' guess. > > Try this again: > https://maven.apache.org/plugins/maven-ear-plugin/ > examples/skinny-wars.html > > If you list a dependency in the EAR, it should then be removed from the > WAR that is bundled with the EAR (this not the WAR installed in your > local repo!). > > If this is not the case, there is either a bug, or you are doing > something wrong. But you would need to provide more details: POMs of the > WAR and the EAR and a listing of the relevant EAR and WAR contents. > > hth, > - martin > -- Clemens von Musil - mu...@sipgate.de Telefon: +49 (0)211-63 55 56-85 Telefax: +49 (0)211-63 55 55-22 sipgate GmbH - Gladbacher Str. 74 - 40219 Düsseldorf HRB Düsseldorf 39841 - Geschäftsführer: Thilo Salmon, Tim Mois Steuernummer: 106/5724/7147, Umsatzsteuer-ID: DE219349391 www.sipgate.de - www.sipgate.at - www.sipgate.co.uk
Re: Building WAR files with/without EAR context
On 14 Nov 2016, Clemens von Musil wrote: > Hi again, > > thanks a lot for your advice, Martin. > > We spent a lot of time into skinny wars but stuck with ejb dependencies. > > The EAR contains several WAR modules and these WAR modules share several > EJB modules. > Unfortunately, the skinny war option seems to ignore transitive EJB > dependencies so that we get errors with duplicate beans on startup. The skinnyWar-option should just remove JARs from the WAR that are also defined in the POM of the EAR module. Nothing special about transitive dependencies here I' guess. Try this again: https://maven.apache.org/plugins/maven-ear-plugin/examples/skinny-wars.html If you list a dependency in the EAR, it should then be removed from the WAR that is bundled with the EAR (this not the WAR installed in your local repo!). If this is not the case, there is either a bug, or you are doing something wrong. But you would need to provide more details: POMs of the WAR and the EAR and a listing of the relevant EAR and WAR contents. hth, - martin pgpt83DaVhmrL.pgp Description: Digitale Signatur von OpenPGP
Re: Building WAR files with/without EAR context
Hi again, thanks a lot for your advice, Martin. We spent a lot of time into skinny wars but stuck with ejb dependencies. The EAR contains several WAR modules and these WAR modules share several EJB modules. Unfortunately, the skinny war option seems to ignore transitive EJB dependencies so that we get errors with duplicate beans on startup. All workarounds we could imagine do not work properly. Recently we tried to omit the "ejb" on all EJB dependencies and put all libs into the EAR-root folder. This "hack" leads our wildfly into some unpredictable (and completely messed up state) deploying all beans into any random module... Some sites advice to exclude $(war_module)/lib completely what makes the WAR module undeployable in standalone mode. Could you please point us any direction to get skinny wars working with shared EJB modules? Thanks a lot, Clemens von Musil 2016-11-09 9:18 GMT+01:00 Martin Hoeller : > Hi! > > On 08 Nov 2016, Clemens von Musil wrote: > > > I am working on a multimodule maven project consisting of several EJB, > WAR > > and an EAR module. The EJB modules contain shared functionality. > > > > To increase development speed, I want the WAR modules build in a way that > > allows me to bundle them into the EAR as well as deploy them standalone > in > > my EE container. > > Wrong approach! Build the WAR as you would need it in standalone-mode and > configure the maven-ear-plugin to make the WAR a skinny war. > > Details can be found here: > https://maven.apache.org/plugins/maven-ear-plugin/ > examples/skinny-wars.html > > hth, > - martin > -- Clemens von Musil - mu...@sipgate.de Telefon: +49 (0)211-63 55 56-85 Telefax: +49 (0)211-63 55 55-22 sipgate GmbH - Gladbacher Str. 74 - 40219 Düsseldorf HRB Düsseldorf 39841 - Geschäftsführer: Thilo Salmon, Tim Mois Steuernummer: 106/5724/7147, Umsatzsteuer-ID: DE219349391 www.sipgate.de - www.sipgate.at - www.sipgate.co.uk
Re: Building WAR files with/without EAR context
Hi! On 08 Nov 2016, Clemens von Musil wrote: > I am working on a multimodule maven project consisting of several EJB, WAR > and an EAR module. The EJB modules contain shared functionality. > > To increase development speed, I want the WAR modules build in a way that > allows me to bundle them into the EAR as well as deploy them standalone in > my EE container. Wrong approach! Build the WAR as you would need it in standalone-mode and configure the maven-ear-plugin to make the WAR a skinny war. Details can be found here: https://maven.apache.org/plugins/maven-ear-plugin/examples/skinny-wars.html hth, - martin pgp2_fx7oPWiR.pgp Description: Digitale Signatur von OpenPGP