You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Karan Malhi <ka...@gmail.com> on 2008/07/29 19:45:38 UTC

need clarification on moduleId of an EjbModule in openejb-tomcat

Assume there is a  webapp whose context root is "somewebapp" and the
tomcat-install location to be /home/karan/install/apache-tomcat

So, if "somewebapp" was deployed in tomcat, the absolute path of somewebapp
would be
/home/karan/install/apache-tomcat/webapps/somewebapp

Need to find out what the moduleId of an EjbModule would be in the following
scenarios. (I have tried to answer my own question by specifying the
moduleId, let me know if that is correct)

Scenario 1: If the EJB classes are stored under somewebapp/WEB-INF/classes
and there is no WEB-INF/classes/META-INF/ejb-jar.xml
ModuleId:- The context root of the web app in which ejb is located

Scenario 2: If the EJB classes are stored under somewebapp/WEB-INF/classes
and there is a WEB-INF/classes/META-INF/ejb-jar.xml and the ejb-jar.xml has
the following contents
<ejb-jar id='someid' />
ModuleId:- The value of the id attribute in the ejb-jar element of the
ejb-jar.xml file. In this case it would be "someid"

Scenario 3: If the EJB classes are stored under
somewebapp/WEB-INF/lib/some.jar and there is no META-INF/ejb-jar.xml inside
the jar
ModuleId:- The absolute path of the jar file. In this case it would be
/home/karan/install/apache-tomcat/somewebapp/WEB-INF/lib/some.jar


Scenario 4: If the EJB classes are stored under
somewebapp/WEB-INF/lib/some.jar and there is a META-INF/ejb-jar.xml inside
the jar and the ejb-jar.xml has the following contents
<ejb-jar id='someid' />
ModuleId:- Not sure what it is going to be here as this should cause a
conflict with Scenario 2.


-- 
Karan Singh Malhi

Re: need clarification on moduleId of an EjbModule in openejb-tomcat

Posted by Karan Malhi <ka...@gmail.com>.
Dont want to lose this info (info from dblevins about moduleId), dumping it
in this thread:-

 order of preference for a moduleId of an EJB  is:
 1. <ejb-jar id="">
 2. jar name
 3. context name
 4. directory name

On Wed, Jul 30, 2008 at 12:42 AM, David Blevins <da...@visi.com>wrote:

>
> On Jul 29, 2008, at 4:43 PM, Karan Malhi wrote:
>
>  I am a little confused with moduleId right now. For example, when we
>> create
>> an EjbModule instance , we specify the moduleId in the constructor itself.
>> So after we create the instance, we update the altDDs for that module, but
>> I
>> do  not see the code where we overwrite the moduleId we created when
>> creating the EjbModule instance, with the moduleId we discovered in the
>> ejb-jar.xml file. Could somebody please point me to the code where we read
>> the id from ejb-jar.xml and overwrite the moduleId of the EjbModule.
>>
>
> This code could likely get cleaned up, but...
>
> The DeploymentLoader.createEjbModule method is the primary place where
> EjbModule instances are created.  Nearly all usages of that method pass null
> in for the moduleId.  In the createEjbModule method, we read in the
> deployment descriptor and pass it into the EjbModule constructor which will
> in turn pull the id out of the ejbJar instance upon finding the moduleId to
> be null.  Sort of round about and likely could be cleaned up.
>
> In the event that an altDD is supplied, then you're right, we don't update
> the moduleId of the EjbModule.  We probably could though I'm not sure if
> changing the moduleId partway into the deploy process would cause issues.
>  Currently, we don't actually support the <alt-dd> element of the
> application.xml, so the situation could never happen as things are now.  We
> probably should support it, but I have yet to see anyone ask for it.
>
> -David
>
>
>  On Tue, Jul 29, 2008 at 1:45 PM, Karan Malhi <ka...@gmail.com>
>> wrote:
>>
>>  Assume there is a  webapp whose context root is "somewebapp" and the
>>> tomcat-install location to be /home/karan/install/apache-tomcat
>>>
>>> So, if "somewebapp" was deployed in tomcat, the absolute path of
>>> somewebapp
>>> would be
>>> /home/karan/install/apache-tomcat/webapps/somewebapp
>>>
>>> Need to find out what the moduleId of an EjbModule would be in the
>>> following scenarios. (I have tried to answer my own question by
>>> specifying
>>> the moduleId, let me know if that is correct)
>>>
>>> Scenario 1: If the EJB classes are stored under
>>> somewebapp/WEB-INF/classes
>>> and there is no WEB-INF/classes/META-INF/ejb-jar.xml
>>> ModuleId:- The context root of the web app in which ejb is located
>>>
>>> Scenario 2: If the EJB classes are stored under
>>> somewebapp/WEB-INF/classes
>>> and there is a WEB-INF/classes/META-INF/ejb-jar.xml and the ejb-jar.xml
>>> has
>>> the following contents
>>> <ejb-jar id='someid' />
>>> ModuleId:- The value of the id attribute in the ejb-jar element of the
>>> ejb-jar.xml file. In this case it would be "someid"
>>>
>>> Scenario 3: If the EJB classes are stored under
>>> somewebapp/WEB-INF/lib/some.jar and there is no META-INF/ejb-jar.xml
>>> inside
>>> the jar
>>> ModuleId:- The absolute path of the jar file. In this case it would be
>>> /home/karan/install/apache-tomcat/somewebapp/WEB-INF/lib/some.jar
>>>
>>>
>>> Scenario 4: If the EJB classes are stored under
>>> somewebapp/WEB-INF/lib/some.jar and there is a META-INF/ejb-jar.xml
>>> inside
>>> the jar and the ejb-jar.xml has the following contents
>>> <ejb-jar id='someid' />
>>> ModuleId:- Not sure what it is going to be here as this should cause a
>>> conflict with Scenario 2.
>>>
>>>
>>> --
>>> Karan Singh Malhi
>>>
>>>
>>
>>
>> --
>> Karan Singh Malhi
>>
>
>


-- 
Karan Singh Malhi

Re: need clarification on moduleId of an EjbModule in openejb-tomcat

Posted by David Blevins <da...@visi.com>.
On Jul 29, 2008, at 4:43 PM, Karan Malhi wrote:

> I am a little confused with moduleId right now. For example, when we  
> create
> an EjbModule instance , we specify the moduleId in the constructor  
> itself.
> So after we create the instance, we update the altDDs for that  
> module, but I
> do  not see the code where we overwrite the moduleId we created when
> creating the EjbModule instance, with the moduleId we discovered in  
> the
> ejb-jar.xml file. Could somebody please point me to the code where  
> we read
> the id from ejb-jar.xml and overwrite the moduleId of the EjbModule.

This code could likely get cleaned up, but...

The DeploymentLoader.createEjbModule method is the primary place where  
EjbModule instances are created.  Nearly all usages of that method  
pass null in for the moduleId.  In the createEjbModule method, we read  
in the deployment descriptor and pass it into the EjbModule  
constructor which will in turn pull the id out of the ejbJar instance  
upon finding the moduleId to be null.  Sort of round about and likely  
could be cleaned up.

In the event that an altDD is supplied, then you're right, we don't  
update the moduleId of the EjbModule.  We probably could though I'm  
not sure if changing the moduleId partway into the deploy process  
would cause issues.  Currently, we don't actually support the <alt-dd>  
element of the application.xml, so the situation could never happen as  
things are now.  We probably should support it, but I have yet to see  
anyone ask for it.

-David

> On Tue, Jul 29, 2008 at 1:45 PM, Karan Malhi <ka...@gmail.com>  
> wrote:
>
>> Assume there is a  webapp whose context root is "somewebapp" and the
>> tomcat-install location to be /home/karan/install/apache-tomcat
>>
>> So, if "somewebapp" was deployed in tomcat, the absolute path of  
>> somewebapp
>> would be
>> /home/karan/install/apache-tomcat/webapps/somewebapp
>>
>> Need to find out what the moduleId of an EjbModule would be in the
>> following scenarios. (I have tried to answer my own question by  
>> specifying
>> the moduleId, let me know if that is correct)
>>
>> Scenario 1: If the EJB classes are stored under somewebapp/WEB-INF/ 
>> classes
>> and there is no WEB-INF/classes/META-INF/ejb-jar.xml
>> ModuleId:- The context root of the web app in which ejb is located
>>
>> Scenario 2: If the EJB classes are stored under somewebapp/WEB-INF/ 
>> classes
>> and there is a WEB-INF/classes/META-INF/ejb-jar.xml and the ejb- 
>> jar.xml has
>> the following contents
>> <ejb-jar id='someid' />
>> ModuleId:- The value of the id attribute in the ejb-jar element of  
>> the
>> ejb-jar.xml file. In this case it would be "someid"
>>
>> Scenario 3: If the EJB classes are stored under
>> somewebapp/WEB-INF/lib/some.jar and there is no META-INF/ejb- 
>> jar.xml inside
>> the jar
>> ModuleId:- The absolute path of the jar file. In this case it would  
>> be
>> /home/karan/install/apache-tomcat/somewebapp/WEB-INF/lib/some.jar
>>
>>
>> Scenario 4: If the EJB classes are stored under
>> somewebapp/WEB-INF/lib/some.jar and there is a META-INF/ejb-jar.xml  
>> inside
>> the jar and the ejb-jar.xml has the following contents
>> <ejb-jar id='someid' />
>> ModuleId:- Not sure what it is going to be here as this should  
>> cause a
>> conflict with Scenario 2.
>>
>>
>> --
>> Karan Singh Malhi
>>
>
>
>
> -- 
> Karan Singh Malhi


Re: need clarification on moduleId of an EjbModule in openejb-tomcat

Posted by Karan Malhi <ka...@gmail.com>.
I am a little confused with moduleId right now. For example, when we create
an EjbModule instance , we specify the moduleId in the constructor itself.
So after we create the instance, we update the altDDs for that module, but I
do  not see the code where we overwrite the moduleId we created when
creating the EjbModule instance, with the moduleId we discovered in the
ejb-jar.xml file. Could somebody please point me to the code where we read
the id from ejb-jar.xml and overwrite the moduleId of the EjbModule.




On Tue, Jul 29, 2008 at 1:45 PM, Karan Malhi <ka...@gmail.com> wrote:

> Assume there is a  webapp whose context root is "somewebapp" and the
> tomcat-install location to be /home/karan/install/apache-tomcat
>
> So, if "somewebapp" was deployed in tomcat, the absolute path of somewebapp
> would be
> /home/karan/install/apache-tomcat/webapps/somewebapp
>
> Need to find out what the moduleId of an EjbModule would be in the
> following scenarios. (I have tried to answer my own question by specifying
> the moduleId, let me know if that is correct)
>
> Scenario 1: If the EJB classes are stored under somewebapp/WEB-INF/classes
> and there is no WEB-INF/classes/META-INF/ejb-jar.xml
> ModuleId:- The context root of the web app in which ejb is located
>
> Scenario 2: If the EJB classes are stored under somewebapp/WEB-INF/classes
> and there is a WEB-INF/classes/META-INF/ejb-jar.xml and the ejb-jar.xml has
> the following contents
> <ejb-jar id='someid' />
> ModuleId:- The value of the id attribute in the ejb-jar element of the
> ejb-jar.xml file. In this case it would be "someid"
>
> Scenario 3: If the EJB classes are stored under
> somewebapp/WEB-INF/lib/some.jar and there is no META-INF/ejb-jar.xml inside
> the jar
> ModuleId:- The absolute path of the jar file. In this case it would be
> /home/karan/install/apache-tomcat/somewebapp/WEB-INF/lib/some.jar
>
>
> Scenario 4: If the EJB classes are stored under
> somewebapp/WEB-INF/lib/some.jar and there is a META-INF/ejb-jar.xml inside
> the jar and the ejb-jar.xml has the following contents
> <ejb-jar id='someid' />
> ModuleId:- Not sure what it is going to be here as this should cause a
> conflict with Scenario 2.
>
>
> --
> Karan Singh Malhi
>



-- 
Karan Singh Malhi