1

I'm trying to work with a stateful EJB Bean in an application which is deployed on a websphere server. For other customers we deploy on wildfly and I don't have any issues there. On Websphere however, the first lookup works fine as well. But after that, the managed bean that uses the EJB Bean gets serialized via a <t:savestate> cause it's request scoped but we need it to live longer than that (We're still working on JSF 1 unfortunately, but we will go to JSF 2 soon and hope to fix the issue with view/flow scope. The problem needs to be solved anyway cause we need the feature in an earlier version of our application.) In the next request, trying to access the EJB Bean, it still exists, but throws the following exception:

java.rmi.RemoteException: CORBA BAD_OPERATION 0x0 no 
nested exception is: 
org.omg.CORBA.BAD_OPERATION: 
The delegate has not been set! 
vmcid: 0x0 minor code: 0 completed: No

I tried several ways to look the bean up and I have no idea how to solve this. It both occurs on Websphere 8.0.0.4 and 8.5.5.14. The Bean is implementing Serializable and I even tried to make the Remote Interface extend Serializable.

user207421
  • 305,947
  • 44
  • 307
  • 483
  • This looks very similar to the scenario in https://stackoverflow.com/questions/17020019/second-call-to-remote-ejb3-bean-from-jsf-in-different-application-delegate-not - what WebSphere levels are you on? That question references a WAS fix PM61337, which is quite old – wtlucy Aug 08 '19 at 14:53
  • one version is on 8.0.0.4, PM61337 is in 8.0.0.5, I'll apply that, but that wouldn't explain it still being an issue on 8.5.5.14 which is the other version, would it? – Adoptivkind1904 Aug 08 '19 at 15:13
  • Apologies, I overlooked that the question I linked to is dealing with a @ViewScoped bean. I've just looked up PM61337 and it only applies to the WAS JSF 2.0 MyFaces implementation, so assuming you're using SunRI 1.2 it won't make any difference here. – wtlucy Aug 08 '19 at 15:31
  • AFAIK SFSB reference is not serializable. If you want to store/persist EJB reference you should obtain the handle. You would need to change your EJB to implement EJBObjcet, like in 2.x era. Check [this](https://stackoverflow.com/questions/6554073/ejb3-0-serializing-a-handle-to-a-stateful-bean). – Gas Aug 12 '19 at 11:46
  • @Gas do you have any examples on how to implement the getHandle method? I can't find any and I don't know what to return there – Adoptivkind1904 Aug 13 '19 at 12:01
  • You would need to implement your EJB in [old fashon 2.1 way](https://docs.oracle.com/cd/E16439_01/doc.1013/e13981/ses21imp001.htm). Implementation will be provided by the container, and your businenss interface would need to extend EJBObject. But having said that - storing state in a stateful session bean is not the best idea anyway, and persisting that is even worst. So I'd strongly suggest to refactor your app to use stateless bean and store state either in httpsession or in database. – Gas Aug 13 '19 at 12:33

0 Answers0