Hi,
  I have a client app of a stateful session bean. The app serializes the
component interface to a file, recreates it and uses it. (Code below). 
The output from the Session bean is a follows...

15:14:17,421 INFO  [STDOUT] HelloBeanEJB()
15:14:17,421 INFO  [STDOUT] setSessionContext
15:14:17,421 INFO  [STDOUT] ejbCreate
15:14:27,531 INFO  [STDOUT] HelloBeanEJB()
15:14:27,531 INFO  [STDOUT] setSessionContext

The first 3 lines are prior to serialization. What confuses me here is when
I deserialize the handle and use it I get the bean constructor & 
setSessionContext  called... I had assumed the deserialized reference
would be for the same bean...


Client Code:

           InitialContext initial = new InitialContext(Properties);
           Object objref = initial.lookup("SessionTestBean");

           HelloBeanHome home = 
               (HelloBeanHome)PortableRemoteObject.narrow(objref, 
                                            HelloBeanHome.class);

           HelloBean hello = home.create();
                   System.out.println(hello.sayHello());

           FileOutputStream out = new FileOutputStream("theObject");
           ObjectOutputStream s = new ObjectOutputStream(out);
           s.writeObject(hello.getHandle());
           s.flush();
           Thread.sleep(10000);

           FileInputStream in = new FileInputStream("theObject");
           ObjectInputStream si = new ObjectInputStream(in);
           Handle theHandle = (Handle)si.readObject();
           HelloBean hello1 = (HelloBean)theHandle.getEJBObject();;
           System.out.println(hello1.sayHello());


Thanks,

Andy

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3827989#3827989

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3827989


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to