Protocol Switching, Remote call to an EJB from presentation to Business using Spring

510 Views Asked by At

I have been using Spring DI and IOC extensively in my earlier projects. As per a new project requirement, we have to setup our projects as follows :

  1. Business project (Java project)
  2. Common project ( Java project)
  3. Presentation project (Web project)

Business and presentation communicates/uses the common layer. However, the business and presentation are to be deployed in different app servers, and the communication between business and presentation is not http based. Presentation invokes the business through iiop protocol. That means, the protocol switching happens, while calling business (Java project) from presentation (web project).

In order to setup different application layers, I did something as follows :

In Business project, I encapsulated all business logic methods, and DAO methods in a facade object, using SPRING dependency Injection feature and normal OOPS technique.

Now I want to expose facade object using EJB, and from the presentation layer, I want to invoke the ejb jndi and get the facade object by making an EJB call.

I need to know :

  1. How can I create an EJB (a simple stateless session bean EJB 2.1) and expose it using Spring ?

  2. How can I access an EJB using spring ? (does not matter if the same has been exposed using spring or not)

I did not find any proper/complete example (even in spring ref), for doing the same configuration in spring.

Any help in this topic is highly appreciated.

Thanks and Regards,

Jitendriya Dash Java/J2EE developer, Mumbai, India.

1

There are 1 best solutions below

1
On
  1. You don't expose it using Spring. You expose it by deploying it in your app server as a remote EJB. That's not Spring's responsibility.
  2. You access a remote EJB by following the instructions in the reference documentation : http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/htmlsingle/spring-framework-reference.html#ejb.