You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by David Blevins <da...@gmail.com> on 2012/01/28 00:14:15 UTC

Re: svn commit: r1236635 - /openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java

Not sure this is accurate.

The entire webapp itself should be treated as one EjbModule and all jars in WEB-INF/lib/ and WEB-INF/classes are part of the same module.

The path of the EjbModule needs to be the same as the WebModule or ejb-link functionality will break as will resolving persistence units when there is more than one unit with the same name and the module path is used to distinguish each.


-David

On Jan 27, 2012, at 3:20 AM, rmannibucau@apache.org wrote:

> Author: rmannibucau
> Date: Fri Jan 27 11:20:06 2012
> New Revision: 1236635
> 
> URL: http://svn.apache.org/viewvc?rev=1236635&view=rev
> Log:
> trying to create the web ejb module from WEB-INF/classes if exists to get DD read
> 
> Modified:
>    openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
> 
> Modified: openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
> URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java?rev=1236635&r1=1236634&r2=1236635&view=diff
> ==============================================================================
> --- openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java (original)
> +++ openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java Fri Jan 27 11:20:06 2012
> @@ -644,8 +644,27 @@ public class DeploymentLoader implements
>         // than an ear file, so the ear-style code we were previously
>         // using doesn't exactly work anymore.
>         //
> +        // EjbModule webEjbModule = new EjbModule(webModule.getClassLoader(), webModule.getModuleId(), webModule.getJarLocation(), null, null);
> +        EjbModule webEjbModule = null;
> +        StringBuilder webInfClassesPath = new StringBuilder(warPath);
> +        if (!warPath.endsWith("/")) {
> +            webInfClassesPath.append("/");
> +        }
> +        webInfClassesPath.append("WEB-INF/classes");
> +        final String webInfClasses = webInfClassesPath.toString();
> +        final File webInfClassesFile = new File(webInfClasses);
> +        if (webInfClassesFile.exists()) {
> +            try {
> +                webEjbModule = createEjbModule(webInfClassesFile.toURI().toURL(), webModule.getJarLocation(), webModule.getClassLoader(), webModule.getModuleId());
> +            } catch (MalformedURLException e) {
> +                logger.error("can't create an ejbmodule with WEB-INF/classes");
> +                // don't throw it we use the next test to initialize the ejbmodule
> +            }
> +        }
> +        if (webEjbModule == null) {
> +            webEjbModule = new EjbModule(webModule.getClassLoader(), webModule.getModuleId(), webModule.getJarLocation(), null, null);
> +        }
> 
> -        EjbModule webEjbModule = new EjbModule(webModule.getClassLoader(), webModule.getModuleId(), webModule.getJarLocation(), null, null);
>         webEjbModule.getAltDDs().putAll(webModule.getAltDDs());
>         appModule.getEjbModules().add(webEjbModule);
> 
> 
> 
> 


Re: svn commit: r1236635 - /openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java

Posted by Romain Manni-Bucau <rm...@gmail.com>.
added a test -> r1237343

shout if you still find an issue ;).

- Romain


2012/1/29 Romain Manni-Bucau <rm...@gmail.com>

> having a quick look: the path didnt change, simply the path used to get DD
> so it should be ok no?
>
> - Romain
>
>
>
> 2012/1/29 Romain Manni-Bucau <rm...@gmail.com>
>
>> I will have a look tonight, should be fast to fix.
>>
>> - Romain
>>
>> Le 28 janv. 2012 15:55, "Romain Manni-Bucau" <rm...@gmail.com> a
>> écrit :
>>
>> That's the question but we shouldnt ignore ejb jar and other dd too. That
>>> s why i patched like it.
>>>
>>> - Romain
>>>
>>> Le 28 janv. 2012 00:14, "David Blevins" <da...@gmail.com> a
>>> écrit :
>>>
>>>> Not sure this is accurate.
>>>>
>>>> The entire webapp itself should be treated as one EjbModule and all
>>>> jars in WEB-INF/lib/ and WEB-INF/classes are part of the same module.
>>>>
>>>> The path of the EjbModule needs to be the same as the WebModule or
>>>> ejb-link functionality will break as will resolving persistence units when
>>>> there is more than one unit with the same name and the module path is used
>>>> to distinguish each.
>>>>
>>>>
>>>> -David
>>>>
>>>> On Jan 27, 2012, at 3:20 AM, rmannibucau@apache.org wrote:
>>>>
>>>> > Author: rmannibucau
>>>> > Date: Fri Jan 27 11:20:06 2012
>>>> > New Revision: 1236635
>>>> >
>>>> > URL: http://svn.apache.org/viewvc?rev=1236635&view=rev
>>>> > Log:
>>>> > trying to create the web ejb module from WEB-INF/classes if exists to
>>>> get DD read
>>>> >
>>>> > Modified:
>>>> >
>>>>  openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
>>>> >
>>>> > Modified:
>>>> openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
>>>> > URL:
>>>> http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java?rev=1236635&r1=1236634&r2=1236635&view=diff
>>>> >
>>>> ==============================================================================
>>>> > ---
>>>> openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
>>>> (original)
>>>> > +++
>>>> openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
>>>> Fri Jan 27 11:20:06 2012
>>>> > @@ -644,8 +644,27 @@ public class DeploymentLoader implements
>>>> >         // than an ear file, so the ear-style code we were previously
>>>> >         // using doesn't exactly work anymore.
>>>> >         //
>>>> > +        // EjbModule webEjbModule = new
>>>> EjbModule(webModule.getClassLoader(), webModule.getModuleId(),
>>>> webModule.getJarLocation(), null, null);
>>>> > +        EjbModule webEjbModule = null;
>>>> > +        StringBuilder webInfClassesPath = new StringBuilder(warPath);
>>>> > +        if (!warPath.endsWith("/")) {
>>>> > +            webInfClassesPath.append("/");
>>>> > +        }
>>>> > +        webInfClassesPath.append("WEB-INF/classes");
>>>> > +        final String webInfClasses = webInfClassesPath.toString();
>>>> > +        final File webInfClassesFile = new File(webInfClasses);
>>>> > +        if (webInfClassesFile.exists()) {
>>>> > +            try {
>>>> > +                webEjbModule =
>>>> createEjbModule(webInfClassesFile.toURI().toURL(),
>>>> webModule.getJarLocation(), webModule.getClassLoader(),
>>>> webModule.getModuleId());
>>>> > +            } catch (MalformedURLException e) {
>>>> > +                logger.error("can't create an ejbmodule with
>>>> WEB-INF/classes");
>>>> > +                // don't throw it we use the next test to initialize
>>>> the ejbmodule
>>>> > +            }
>>>> > +        }
>>>> > +        if (webEjbModule == null) {
>>>> > +            webEjbModule = new EjbModule(webModule.getClassLoader(),
>>>> webModule.getModuleId(), webModule.getJarLocation(), null, null);
>>>> > +        }
>>>> >
>>>> > -        EjbModule webEjbModule = new
>>>> EjbModule(webModule.getClassLoader(), webModule.getModuleId(),
>>>> webModule.getJarLocation(), null, null);
>>>> >         webEjbModule.getAltDDs().putAll(webModule.getAltDDs());
>>>> >         appModule.getEjbModules().add(webEjbModule);
>>>> >
>>>> >
>>>> >
>>>> >
>>>>
>>>>
>

Re: svn commit: r1236635 - /openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java

Posted by Romain Manni-Bucau <rm...@gmail.com>.
having a quick look: the path didnt change, simply the path used to get DD
so it should be ok no?

- Romain


2012/1/29 Romain Manni-Bucau <rm...@gmail.com>

> I will have a look tonight, should be fast to fix.
>
> - Romain
>
> Le 28 janv. 2012 15:55, "Romain Manni-Bucau" <rm...@gmail.com> a
> écrit :
>
> That's the question but we shouldnt ignore ejb jar and other dd too. That
>> s why i patched like it.
>>
>> - Romain
>>
>> Le 28 janv. 2012 00:14, "David Blevins" <da...@gmail.com> a
>> écrit :
>>
>>> Not sure this is accurate.
>>>
>>> The entire webapp itself should be treated as one EjbModule and all jars
>>> in WEB-INF/lib/ and WEB-INF/classes are part of the same module.
>>>
>>> The path of the EjbModule needs to be the same as the WebModule or
>>> ejb-link functionality will break as will resolving persistence units when
>>> there is more than one unit with the same name and the module path is used
>>> to distinguish each.
>>>
>>>
>>> -David
>>>
>>> On Jan 27, 2012, at 3:20 AM, rmannibucau@apache.org wrote:
>>>
>>> > Author: rmannibucau
>>> > Date: Fri Jan 27 11:20:06 2012
>>> > New Revision: 1236635
>>> >
>>> > URL: http://svn.apache.org/viewvc?rev=1236635&view=rev
>>> > Log:
>>> > trying to create the web ejb module from WEB-INF/classes if exists to
>>> get DD read
>>> >
>>> > Modified:
>>> >
>>>  openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
>>> >
>>> > Modified:
>>> openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
>>> > URL:
>>> http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java?rev=1236635&r1=1236634&r2=1236635&view=diff
>>> >
>>> ==============================================================================
>>> > ---
>>> openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
>>> (original)
>>> > +++
>>> openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
>>> Fri Jan 27 11:20:06 2012
>>> > @@ -644,8 +644,27 @@ public class DeploymentLoader implements
>>> >         // than an ear file, so the ear-style code we were previously
>>> >         // using doesn't exactly work anymore.
>>> >         //
>>> > +        // EjbModule webEjbModule = new
>>> EjbModule(webModule.getClassLoader(), webModule.getModuleId(),
>>> webModule.getJarLocation(), null, null);
>>> > +        EjbModule webEjbModule = null;
>>> > +        StringBuilder webInfClassesPath = new StringBuilder(warPath);
>>> > +        if (!warPath.endsWith("/")) {
>>> > +            webInfClassesPath.append("/");
>>> > +        }
>>> > +        webInfClassesPath.append("WEB-INF/classes");
>>> > +        final String webInfClasses = webInfClassesPath.toString();
>>> > +        final File webInfClassesFile = new File(webInfClasses);
>>> > +        if (webInfClassesFile.exists()) {
>>> > +            try {
>>> > +                webEjbModule =
>>> createEjbModule(webInfClassesFile.toURI().toURL(),
>>> webModule.getJarLocation(), webModule.getClassLoader(),
>>> webModule.getModuleId());
>>> > +            } catch (MalformedURLException e) {
>>> > +                logger.error("can't create an ejbmodule with
>>> WEB-INF/classes");
>>> > +                // don't throw it we use the next test to initialize
>>> the ejbmodule
>>> > +            }
>>> > +        }
>>> > +        if (webEjbModule == null) {
>>> > +            webEjbModule = new EjbModule(webModule.getClassLoader(),
>>> webModule.getModuleId(), webModule.getJarLocation(), null, null);
>>> > +        }
>>> >
>>> > -        EjbModule webEjbModule = new
>>> EjbModule(webModule.getClassLoader(), webModule.getModuleId(),
>>> webModule.getJarLocation(), null, null);
>>> >         webEjbModule.getAltDDs().putAll(webModule.getAltDDs());
>>> >         appModule.getEjbModules().add(webEjbModule);
>>> >
>>> >
>>> >
>>> >
>>>
>>>

Re: svn commit: r1236635 - /openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java

Posted by Romain Manni-Bucau <rm...@gmail.com>.
I will have a look tonight, should be fast to fix.

- Romain

Le 28 janv. 2012 15:55, "Romain Manni-Bucau" <rm...@gmail.com> a
écrit :

> That's the question but we shouldnt ignore ejb jar and other dd too. That
> s why i patched like it.
>
> - Romain
>
> Le 28 janv. 2012 00:14, "David Blevins" <da...@gmail.com> a
> écrit :
>
>> Not sure this is accurate.
>>
>> The entire webapp itself should be treated as one EjbModule and all jars
>> in WEB-INF/lib/ and WEB-INF/classes are part of the same module.
>>
>> The path of the EjbModule needs to be the same as the WebModule or
>> ejb-link functionality will break as will resolving persistence units when
>> there is more than one unit with the same name and the module path is used
>> to distinguish each.
>>
>>
>> -David
>>
>> On Jan 27, 2012, at 3:20 AM, rmannibucau@apache.org wrote:
>>
>> > Author: rmannibucau
>> > Date: Fri Jan 27 11:20:06 2012
>> > New Revision: 1236635
>> >
>> > URL: http://svn.apache.org/viewvc?rev=1236635&view=rev
>> > Log:
>> > trying to create the web ejb module from WEB-INF/classes if exists to
>> get DD read
>> >
>> > Modified:
>> >
>>  openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
>> >
>> > Modified:
>> openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
>> > URL:
>> http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java?rev=1236635&r1=1236634&r2=1236635&view=diff
>> >
>> ==============================================================================
>> > ---
>> openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
>> (original)
>> > +++
>> openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
>> Fri Jan 27 11:20:06 2012
>> > @@ -644,8 +644,27 @@ public class DeploymentLoader implements
>> >         // than an ear file, so the ear-style code we were previously
>> >         // using doesn't exactly work anymore.
>> >         //
>> > +        // EjbModule webEjbModule = new
>> EjbModule(webModule.getClassLoader(), webModule.getModuleId(),
>> webModule.getJarLocation(), null, null);
>> > +        EjbModule webEjbModule = null;
>> > +        StringBuilder webInfClassesPath = new StringBuilder(warPath);
>> > +        if (!warPath.endsWith("/")) {
>> > +            webInfClassesPath.append("/");
>> > +        }
>> > +        webInfClassesPath.append("WEB-INF/classes");
>> > +        final String webInfClasses = webInfClassesPath.toString();
>> > +        final File webInfClassesFile = new File(webInfClasses);
>> > +        if (webInfClassesFile.exists()) {
>> > +            try {
>> > +                webEjbModule =
>> createEjbModule(webInfClassesFile.toURI().toURL(),
>> webModule.getJarLocation(), webModule.getClassLoader(),
>> webModule.getModuleId());
>> > +            } catch (MalformedURLException e) {
>> > +                logger.error("can't create an ejbmodule with
>> WEB-INF/classes");
>> > +                // don't throw it we use the next test to initialize
>> the ejbmodule
>> > +            }
>> > +        }
>> > +        if (webEjbModule == null) {
>> > +            webEjbModule = new EjbModule(webModule.getClassLoader(),
>> webModule.getModuleId(), webModule.getJarLocation(), null, null);
>> > +        }
>> >
>> > -        EjbModule webEjbModule = new
>> EjbModule(webModule.getClassLoader(), webModule.getModuleId(),
>> webModule.getJarLocation(), null, null);
>> >         webEjbModule.getAltDDs().putAll(webModule.getAltDDs());
>> >         appModule.getEjbModules().add(webEjbModule);
>> >
>> >
>> >
>> >
>>
>>

Re: svn commit: r1236635 - /openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java

Posted by Romain Manni-Bucau <rm...@gmail.com>.
That's the question but we shouldnt ignore ejb jar and other dd too. That s
why i patched like it.

- Romain

Le 28 janv. 2012 00:14, "David Blevins" <da...@gmail.com> a écrit :

> Not sure this is accurate.
>
> The entire webapp itself should be treated as one EjbModule and all jars
> in WEB-INF/lib/ and WEB-INF/classes are part of the same module.
>
> The path of the EjbModule needs to be the same as the WebModule or
> ejb-link functionality will break as will resolving persistence units when
> there is more than one unit with the same name and the module path is used
> to distinguish each.
>
>
> -David
>
> On Jan 27, 2012, at 3:20 AM, rmannibucau@apache.org wrote:
>
> > Author: rmannibucau
> > Date: Fri Jan 27 11:20:06 2012
> > New Revision: 1236635
> >
> > URL: http://svn.apache.org/viewvc?rev=1236635&view=rev
> > Log:
> > trying to create the web ejb module from WEB-INF/classes if exists to
> get DD read
> >
> > Modified:
> >
>  openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
> >
> > Modified:
> openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
> > URL:
> http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java?rev=1236635&r1=1236634&r2=1236635&view=diff
> >
> ==============================================================================
> > ---
> openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
> (original)
> > +++
> openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
> Fri Jan 27 11:20:06 2012
> > @@ -644,8 +644,27 @@ public class DeploymentLoader implements
> >         // than an ear file, so the ear-style code we were previously
> >         // using doesn't exactly work anymore.
> >         //
> > +        // EjbModule webEjbModule = new
> EjbModule(webModule.getClassLoader(), webModule.getModuleId(),
> webModule.getJarLocation(), null, null);
> > +        EjbModule webEjbModule = null;
> > +        StringBuilder webInfClassesPath = new StringBuilder(warPath);
> > +        if (!warPath.endsWith("/")) {
> > +            webInfClassesPath.append("/");
> > +        }
> > +        webInfClassesPath.append("WEB-INF/classes");
> > +        final String webInfClasses = webInfClassesPath.toString();
> > +        final File webInfClassesFile = new File(webInfClasses);
> > +        if (webInfClassesFile.exists()) {
> > +            try {
> > +                webEjbModule =
> createEjbModule(webInfClassesFile.toURI().toURL(),
> webModule.getJarLocation(), webModule.getClassLoader(),
> webModule.getModuleId());
> > +            } catch (MalformedURLException e) {
> > +                logger.error("can't create an ejbmodule with
> WEB-INF/classes");
> > +                // don't throw it we use the next test to initialize
> the ejbmodule
> > +            }
> > +        }
> > +        if (webEjbModule == null) {
> > +            webEjbModule = new EjbModule(webModule.getClassLoader(),
> webModule.getModuleId(), webModule.getJarLocation(), null, null);
> > +        }
> >
> > -        EjbModule webEjbModule = new
> EjbModule(webModule.getClassLoader(), webModule.getModuleId(),
> webModule.getJarLocation(), null, null);
> >         webEjbModule.getAltDDs().putAll(webModule.getAltDDs());
> >         appModule.getEjbModules().add(webEjbModule);
> >
> >
> >
> >
>
>