Calling an ejb of remote server from another ejb
anamika Feb 27, 2004 11:11 PMhi all,
I have the same requirement as specified in the thread
http://www.jboss.org/index.html?module=bb&op=viewtopic&t=30024
(calling a function of another ejb residing on another server)
When i followed the thread, i got the result also. Now i can communicate between the ejbs.
Again i have a problem. When i specify the context properties in the code, i am forced to specify the provider url of the remote machine for remote ejb communication. this makes some difficulty for generalization.
I have specified the ejb reference of remote ejb in ejb-jar.xml and corresponding specification is there in jboss.xml like this
ejb-jar.xml
<ejb-name>AEJB</ejb-name>
package.AHome
package.ARemote
<ejb-class>package.AEJB</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<ejb-ref>
<ejb-ref-name>ejb/BEJB</ejb-ref-name>
<ejb-ref-type>Stateless</ejb-ref-type>
package.BHome
package.BRemote
</ejb-ref>
In jboss.xml
<ejb-name>AEJB</ejb-name>
<ejb-ref>
<ejb-ref-name>ejb/BEJB</ejb-ref-name>
<jndi-name>jnp://remote machine ip:1099/ejb/BEJB</jndi-name>
</ejb-ref>
At the time of deployment, server is identifying the external referenced ejb along with its path. So i need not give any url at context properties. Isn't it? but when i take the url specification from context properties, it is showing ejb not found exception. The exception is like this.
javax.naming.NameNotFoundException: BEJB not bound
21:31:00,000 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
21:31:00,000 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
21:31:00,000 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
21:31:00,000 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:282)
21:31:00,000 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:256)
21:31:00,000 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:493)
21:31:00,015 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:472)
21:31:00,015 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:347)
If anybody knows the solution pls help me. i am stumped now......
saritha