*
The moose likes EJB and other Java EE Technologies and the fly likes Communication between EJBs deployed in different Application Servers from different vendors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Communication between EJBs deployed in different Application Servers from different vendors" Watch "Communication between EJBs deployed in different Application Servers from different vendors" New topic
Author

Communication between EJBs deployed in different Application Servers from different vendors

Lekamge Perera
Greenhorn

Joined: Aug 01, 2011
Posts: 5

Hi All

I ‘m trying to create a small EJB 3.1 application in which I want to use two application servers from two different vendors. (JBoss 6.1.0 Final and Glassfish 3.1). This is just to experience the taste of distributed applications and new features of EJB3.1.

This is the problem I’m having…

I have created a simple EJB (kind of a hello world ejb) and deployed it in GlassFish server which is running in machine A. Let’s call it GlassFishHelloWorldEjb. This one has business remote and local views.
I have created another EJB project in which I have an EJB called JBossHelloWorldEjb. I have deployed it in the Jboss server which is running in the machine B.

Now I want to inject GlassFishHelloWorldEjb to a reference in the JBossHelloWorldEjb so that I can call it within the JBossHelloWorldEjb. Then I have a web app deployed in the Jboss which calls the JBossHelloWorldEjb.

MyWebApp(Jboss, machine B)-----> JBossHelloWorldEjb (Jboss, machine B)----> GlassFishHelloWorldEjb(GlassFish, Machine A)

I tried many ways to inject the GlassFishHelloWorldEjb in to the JBossHelloWorldEjb but failed. Could some please shed some light to achieve this.

Would greatly appreciate if you could show me the way to do this through both INJECTION and Programmatic JNDI look up.

Cheers
Asanka
Lekamge Perera
Greenhorn

Joined: Aug 01, 2011
Posts: 5

please?
Andrew Moko
Ranch Hand

Joined: Dec 16, 2011
Posts: 55
Hi,
I havent tried writing a distributed app running on diff application servers however here's my two cents. Have GlassFishHelloWorldEjb registered on the glassfish jndi tree and assign a remote jndi name. Do the same with JBossHelloWorldEjb have it registered under jboss. On JBossHelloWorldEjb, have a copy reference of GlassFishHellWorldEjb with all associated/ related objects/ depencencies. Then do a context lookup using the remote glassfishejb jndi name and map it onto the reference object.

Something like:
Context ctx = new InitialContext(env);
GlassFishHelloWorldEjb bean = (GlassFishHelloWorldEjb) PortableRemoteObject.narrow(ctx.lookup("jndi.glassfishhelloworld"), GlassFishHelloWorldEjb.class);

Not sure how to go about injecting a remote bean but a jndi lookup always works just fine.

Good luck!
Mr sujeet khandelwal
Greenhorn

Joined: Dec 21, 2011
Posts: 13
Hi,

One more solution to solve this problem you can make "GlassFishHelloWorldEjb" to webservice.

It would require you to do
- @WebService annotation to "GlassFishHelloWorldEjb".
- Create a client of "GlassFishHelloWorldEjb" in app of jboss.
- Use that client in "JbossHelloWorldEjb".

cheers.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Communication between EJBs deployed in different Application Servers from different vendors
 
Similar Threads
Calling EJB from a different Server
@EJB annotation from a remote client
Accessing session bean in a distributed environment
How to deploy ejb application on two jvms?
[JMS] communication between producer-consumer, different vendors