File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Application Frameworks and the fly likes Spring Framework - EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Spring Framework - EJB" Watch "Spring Framework - EJB" New topic

Spring Framework - EJB

vaitheeswaran subramanian

Joined: Jan 06, 2005
Posts: 15
I am using web module built of java server faces and spring framework calling ejb. The ejb is implemented the spring way, having the interface and using dependency injection to set the apt implementation.
When the ejb is invoked for the first time, it executes perfectly and returns a List to web module as expected.
But durign subsequent invocations, it throws the following exception

org.springframework.remoting.RemoteConnectFailureException: Cannot connect to remote service [HubServiceHome]; nested exception is java.rmi.MarshalException: CORBA MARSHAL 0x4942f896 No; nested exception is:
org.omg.CORBA.MARSHAL: Unable to read value from underlying bridge : Unable to load Class long : null vmcid: IBM minor code: 896 completed: No

EJB Bean instantiates a POJO Service bean(in the way recommended by Spring Framework). The POJO then invokes another interface again using Spring which is a Hibernate DAO class.. I added debug messages only to find out that all the beans (POJOs are invoked correctly and that the list is returned correctly to the SessionBean object. The exception occurs at the point when the ejb is about to return the List to the Web module.

At the web module level, I tried replacing Spring BeanFactory with initial context only to see that it doesn't change the outcome.
Any help will be very much appreciated.
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1428
Why are you using both Spring and EJB in the middle(Business) Layer ? Any specific reason ?
Jeremi Tripp

Joined: Oct 16, 2006
Posts: 1
Hey, I just started supporting and enhancing some legacy code that uses Spring , EJB's, and Hibernate. I understand the frustrations of combining the three technolgies. If I had my choice, I would rip out Spring and maybe Hibernate, but it is not my decision to make.

Can you post some code? You can trim out any company secrets from the code.
vaitheeswaran subramanian

Joined: Jan 06, 2005
Posts: 15
I got a solution for my issue. The issue is because I am returning a POJO from ejb to web module that is created and controlled by Hibernate and Spring framework.
For the first call, it returns the Hibernate POJO (that represents a table). But my subsequest calls fail. So all I did was created a DTO object that resembles the POJO, deep copied the values and returned the DTO.
I agree. Here's the link:
subject: Spring Framework - EJB
jQuery in Action, 3rd edition