Search code examples
ejb-3.0weblogic11g

Call EJB from another domain


What I am doing:
I'm trying to develop a small prog for calling the EJB from another domain.

Version
EJB 3.0
Weblogic 10.3.6

There are 2 domains on Machine1 and Machine2 so the managed servers are
domain1_cluster1_machine1 domain1_cluster1_machine2
domain2_cluster1_machine1 domain2_cluster1_machine2
(hope that I make it clear)

I followed this blog to develop the prog: http://edwin.baculsoft.com/tag/weblogic/

I deployed the EJB on domain1_cluster1_machine1 and domain1_cluster1_machine2 with Active status and it can be found in JNDI tree.
Then the client application is deployed on domain2_cluster1_machine1 and domain2_cluster1_machine2

All of the code is same as the blog, besides the provider url:

t3://[IP of Machine1]:[Listen port of domain**1**_cluster1_machine1]

When I run the client application from domain2_cluster1_machine1, I got the following exception:

javax.naming.CommunicationException [Root exception is java.rmi.UnmarshalException: failed to unmarshal class java.lang.Object; nested exception is: java.lang.ClassNotFoundException: com.edw.ejb3.HelloEJBRemote]

When I type wrong in the lookup ie ic.lookup("com.edw.ejb3.HelloEJBRemote"), the exception is:

javax.naming.NameNotFoundException: While trying to lookup 'com.edw.ejb3.HelloEJBRemote' didn't find subcontext 'com'. Resolved '' [Root exception is javax.naming.NameNotFoundException: While trying to lookup 'com.edw.ejb3.HelloEJBRemote' didn't find subcontext 'com'. Resolved '']; remaining name 'com/edw/ejb3/HelloEJBRemote'

Therefore, can I conclude that the client is able to find the EJB from domain1 as the exception is not NameNotFoundException?

Then what's wrong this it? Is it related to security?

I am newbie of both Weblogic and EJB. Your help will be appreciated. Thank you!


Solution

  • As mentioned in the comments, Please make sure that you have deployed the EJBs like described below -

    Cluster 1

    • HelloEJBRemote
    • HelloEJBRemoteImpl

    Cluster 2

    • HelloEJBRemote

    Do a look up from Cluster2 to Cluster 1 for the Bean using the JNDI name of HelloEJBRemoteImpl