Call to EJB method from a remote jboss server(servlet) - servlets

case 1:
I'm having war in one jboss server and ejb jar in another jboss server.
I want to call my ejb from my servlet which is present in another server.
How to call it. can any one help me with a working sample and required configurations.
case 2:
Message Driven Bean(MDB) in my transaction jboss server and business method in another jboss server. How to call my business method from my transaction server.
kindly help me to solve this case
Thanks in advance

I can't (won't) help with a working example, but this is what you have to do:
Your EJBs (session beans) must be configured in a way to support remote access, RMI.
You have to export your EJB client classes into a separate JAR file; those are the interfaces and base classes required to perform an RMI call (stubs). This is required as clients (your WAR) must understand how to deserialize/serialize the RMI communication between your servlets and the remote EJBs.
Make the exported EJB client JAR available to your WAR file
Define an initial context pointing to your remote EJB server as described here.
Deploy and run it...
BTW: A personal opinion, RMI communication is painful and you should try to avoid it as it tightly couples the client (your WAR) to the remote EJBs.
EDIT: Which EJB version and which IDE do you use?

Related

EJB: What is remote client?

I am going through EJB specification(ejb-3_1-pfd-spec). I am not able to completely grasp concept of remote client:
Spec document states following:
"The interface used by a remote client of a session bean is implemented by the container as a remote business interface (or a remote EJBObject interface), and the remote client view of a session bean is location-independent. A client running in the same JVM as the session object uses the same API as a client running in a different JVM on the same or different machine"
This suggests that remote client can run in same JVM or different JVM from session object.
But different discussion threads suggest that a remote client is one which runs in JVM different from session bean.
So which definition is more accurate.
Any guidance would be of great value.
This is a bit reflexive - a remote client on JVM A on machine A is connecting through to an EJB component on JVM B on machine B, that's all either side is aware of. In some situations, it may be that machine A and machine B are the same machine. It may also happen that JVM A and JVM B are the same JVM.
The important thing is that remote clients are location agnostic - they must behave the same regardless of where they are on the network. As a programmer, this means your code must not assume they are in the same place. As a deployer, it means that you can choose to deploy them on one machine or on several, without any code changes.

Coherence cache for.net client

I am trying to access a coherence cache using .net client.The cluster is already set up , all I have to do is to access the coherence cache from the client side and get the objects from the cacheservice . As of now I have the coherence dll and the client config .what else should I do ?
You should check the 'Developing Remote Clients for Oracle Coherence' guide,
specifically client side configuration:
http://docs.oracle.com/middleware/1212/coherence/COHCG/gs_configextend.htm#BEBEGIAE
The link included in the other answer is a great start. Basically:
You run at least one "proxy" in the cluster
You configure the client to point to the proxy or proxies (or a load balancer in front of the proxies)
You use the Coherence C# API in .NET and it finds the configuration and connects to proxy

Kettle client to invoke EJBs deployed in JBoss

I'm just starting with Kettle (PDI).
I want to know if it is possible to deploy EJB3 in JBoss AS 5.1.0, and then invoke EJBs from a remote client through KETTLE by using the JNDI API to first lookup the bean proxy and then invoke on that proxy?
Basically, I want to extract, transform and load data that was deployed to the application server through Kettle.
Thanks
Generally speaking you'd like to implement a normal stand-alone remote EJB client. This client is to be integrated into an (open source) ETL tool.
I would be very surprised if this does not work. If you managed to have a stand-alone remote client (sometimes tough enough), there could be one problem: Conflicting libraries: Normally a JBoss clients use jboss-client.jar, and its content may conflict with libraries provided by Kettle. But Kettle is open source, so with a little effort you could resolve this as well.

How to configure a Message Driven Bean to subscribe to a remote JMS Topic

I am trying to get a MessageDriven (EJB 3) bean to subscribe to a JMS Topic on another glassfish instance on another host. Is this possible?
In the Glassfish console you can modify the JMS server and point it to another Glassfish instance or a standalone OpenMQ broker. Although you can configure several JMS hosts to my knowledge Glassfish will always use the one called default_JMS_host so that's the one you want to edit.
Just one thing: in such a setup the two server instances will share queues and topics, which may not be what you want if the two servers are for example running the same application but don't want to share e.g a particular queue. This can easily be solved via the Destination Resources configuration, by specifying different physical names for that queue.

we get the Ejb home and ejb remote implementation at client side?

In some articles on different sites i read that we only serialize/deserialize the state of object.On the deserialization side actual class definition should be present.
If that is the case, In case of EJB then how we get the Ejb home and ejb remote implementaion from server(which is on remote machine) as on client side we just have home and remote interfaces.
In addition to the home and remote interfaces, you need "stub" implementations of those classes on the client. These are generated in a vendor-specific way during application deployment, or in same cases, they are generated dynamically on the client. In any case, the server-side implementation is never needed on the client: when a method is invoked on a stub, the method request is sent over the network, and the server executes the logic when it receives it.

Resources