My servlet calls an ejb deployed in the same app server (WebLogic) passing reference to an object. This object is serializable and the its a remote call to the ejb. I have oserved a difference in the state of the object when application is deployed as EAR and when it is deployed in exploded form. Such a difference is not expected. The ejb should not be able to change the state. Can you throw some light on this.
Originally posted by abhinav srivastava: Not the EJB, the Object whose reference is passed gets its state changed.
uhhm :-(. I have heard that weblogic optimizes remote calls / rather calls to remote EJBs if it figures out that the caller and the EJb are in the same VM (by making it a local invocation). Now I did'nt know that it does'nt respect the pass-by value semantics in that case. The pass by reference behaviour that you are referring to w'd have been ok if it had been an EJB with Local interfaces.
Joined: Mar 06, 2001
Originally posted by Pradeep Bhat: Objects are passed by reference when both the war and jar are in the same ear file.
Is this documented somewhere / is it there in some book ? I find this strange. When i use a remote EJB, dont I always program assuming that "pass-by-value" semantics will be respected. I mean the parameters passed to a remote EJb if serializable has to be a pass by value? I guess many applications do have the war and the jar packaged together in a ear.
Weblogic Application Server is hosting both Servlets and EJBs. It seems that in case of an EAR file, its pass by refrence and in case of Exploded deployment its pass by value. Haven't found any documentation in support of this though thats the way it is.
Oracle 9iAS also supports pass by value. You make use of copy-by-value tag in orion-ejb-jar.xml . Whether or not to copy (clone) all the incoming and outgoing parameters in EJB calls. Set to 'false' if you are certain that your application does not assume copy-by-value semantics for a speed-up. The default is 'true'.
Joined: Jan 23, 2002
Oracle 9iAS also supports pass by value.
All certified J2EE implementations must support pass-by-value. What they can support is the non-compliant pass-by-reference. Then there's the question of which one is the default.