Discussions

EJB programming & troubleshooting: calling a client from a bean

  1. calling a client from a bean (4 messages)

    I have a bean which connects to a price feed and recieves prices asynchronously. I want to send these prices back to the client that initiated the connection. How do I do this ?.

    I thought I could pass the client to the bean (using an interface), and then have the bean call a price update method on the client, but when I tried this I got this exception:

    java.rmi.MarshalException: error marshalling arguments; nested exception is:
            java.io.NotSerializableException: examples.ejb.basic.statefulSession.Client
    java.io.NotSerializableException: examples.ejb.basic.statefulSession.Client
          at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1148)
            at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
            at weblogic.common.internal.ChunkedObjectOutputStream.writeObject(ChunkedObjectOutputStream.java:102)
            at weblogic.common.internal.ChunkedObjectOutputStream.writeObject(ChunkedObjectOutputStream.java:108)
            at examples.ejb.basic.statefulSession.TraderBeanEOImpl_WLStub.connect(TraderBeanEOImpl_WLStub.java:413)
            at examples.ejb.basic.statefulSession.Client.<init>(Client.java:51)
            at examples.ejb.basic.statefulSession.Client.main(Client.java:33)


    even though the client implements Serializable.

    any help would be appreciated!

    chris davis

    Threaded Messages (4)

  2. calling a client from a bean[ Go to top ]

    Chris,

    i think what u tryin to do is make a call-back to ur client. is the client within the same JVM as the bean ????

    i think there shud no problem if they r in the same JVM.

    if they r not then u cant just make call-back on ur client which is in a different JVM. remember ur object is not network(stub/skeleton) aware to be able to receive calls across machine or process. u have just serialized the object and that wont do the job.

    the best solution to ur problem is probably JMS. what kinda client is it - servlet/jsp or java app/applet.

    kapil
  3. calling a client from a bean[ Go to top ]

    No they're not in the same jvm. The client is just a standalone java application. I guess your right, I have to use a different mechanism for the return data.

    thanks for your help

    Chris,
  4. calling a client from a bean[ Go to top ]

    You could either use JMS or RMI. If they are within the same JVM user the Observer pattern. Callbacks are generally avoided.
  5. It's a weblogic 6 known bug[ Go to top ]

    java.rmi.MarshalException

    It's a weblogic 6 known bug with reading longs inside a chunked value. This is
    fixed in SP2 and the relevant CR is CR124377 - you can get a patch for
    SP1 from support.

    see: http://forums.bea.com/bea/message.jspa?messageID=200032537