-
1. Re: Deploy the same EJB twice - nobody know ?!?
juha Nov 3, 2003 1:21 PM (in response to cwele)Yes it's possible.
jboss.xml to bind the two EJBs with different global names.
You need to correctly map the private lookup name you use in servlets with jboss-web.xml file. That way they both may use the same constant value.
-- Juha -
2. Re: Deploy the same EJB twice - nobody know ?!?
cwele Nov 3, 2003 3:58 PM (in response to cwele)OK, then take a look at this:
Here is part of my jboss.xml for that firstEjb , packaged into first.ear
jboss.xml: (firstEjb.jar -> first.ear)
<ejb-name>FirstEjb</ejb-name>
<jndi-name>firstEar/FirstEjb</jndi-name>
...
-the client for that firstEjb, web application (packaged along with that ejb in the first.ear) haves folloving ejb-ref:
web.xml: (firstWeb.war -> first.ear)
<ejb-ref>
<ejb-ref-name>ejb/FirstEjb</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
...
...
</ejb-ref>
jboss-web.xml: (firstWeb.war -> first.ear)
<ejb-ref>
<ejb-ref-name>ejb/FirstEjb</ejb-ref-name>
<jndi-name>firstEar/FirstEjb</jndi-name>
</ejb-ref>
======
jboss.xml: (_firstEjb.jar -> second.ear)
<ejb-name>FirstEjb</ejb-name>
<jndi-name>secondEar/FirstEjb</jndi-name>
...
-ejb client, another ejb (packaged along with that _firstEjb in the second.ear) haves folloving ejb-ref:
ejb-jar.xml: (someEjb.jar -> second.ear)
<ejb-ref>
<ejb-ref-name>ejb/FirstEjb</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
...
...
</ejb-ref>
jboss.xml: (someEjb.jar -> second.ear)
<ejb-ref>
<ejb-ref-name>ejb/FirstEjb</ejb-ref-name>
<jndi-name>secondEar/FirstEjb</jndi-name>
</ejb-ref>
----
-In both cases (both clients uses, the same statement below)
InitialContenxt.lookup('ejb/FirstEjb');
throws NamingException : FirstEjb not bound !
So, what is wrong ? I am totaly confused :(
(Jboss 3.0.4)
And, wheter is possible to achieve this goal if firstEjb have local interfaces, instead of Remote ? -
3. Re: Deploy the same EJB twice - nobody know ?!?
juha Nov 3, 2003 4:03 PM (in response to cwele)try lookup on "java:comp/env/ejb/FirstEjb" instead
-
4. Re: Deploy the same EJB twice - nobody know ?!?
cwele Nov 4, 2003 4:31 AM (in response to cwele)-No, with
java:comp/env/ejb/FirstEjb
- the same thing happens :
NamignException .. NameNotFoundExcepion FirstEjb not bound
-------
-Let make thing simple, suppose I have just one client for that firstEjb:
here is part of my jboss.xml for that firstEjb , packaged into first.ear
jboss.xml: (firstEjb.jar -> first.ear)
<ejb-name>FirstEjb</ejb-name>
<jndi-name>firstEar/FirstEjb</jndi-name>
...
-the client for that firstEjb, web application (packaged along with that ejb in the first.ear) haves folloving ejb-ref
web.xml: (firstWeb.war -> first.ear)
<ejb-ref>
<ejb-ref-name>ejb/FirstEjb</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
...
...
</ejb-ref>
jboss-web.xml: (firstWeb.war -> first.ear)
<ejb-ref>
<ejb-ref-name>ejb/FirstEjb</ejb-ref-name>
<jndi-name>firstEar/FirstEjb</jndi-name>
</ejb-ref>
----
Is this correct ? I think yes, but
InitialContenxt.lookup('ejb/FirstEjb') AND
InitialContenxt.lookup('java:comp/env/ejb/FirstEjb')
both raises NameNotFoundException : FirstEjb not bound !
-This is very strange, any other EJB server will not raise that exception.
-So I think, this is impossible to achieve by JBoss server. The only way to do this, as I can see, is simple avoid
<jndi-name>firstEar/FirstEjb</jndi-name>
from jboss.xml for that firstEjb, and looking up with
default ejb-name:
ic.lookup('FirstEjb');
- But, on that way, I cannot deploy that EJB twice ! (with different jboss.xml) :(((
- Any other solution ? -
5. Re: Deploy the same EJB twice - nobody know ?!?
darranl Nov 4, 2003 5:40 AM (in response to cwele)To find out exactly what is bound where :-
Goto http://localhost:8080/jmx-console
Click on the 'service=JNDIView' link
Invoke the 'java.lang.String list()' method.
You will be given the details of everything bound to JNDI without having to use trial and error to get the client to work. -
6. Re: Deploy the same EJB twice - nobody know ?!?
cwele Nov 4, 2003 3:02 PM (in response to cwele)-Thanks everyone for help.
After restarting JBoss, everything works just fine
(without any changes :((