how to pass a non-remote object as parameter of an ejb method


EJB programming & troubleshooting: how to pass a non-remote object as parameter of an ejb method

  1. My client visual interface is dynamic, so i have to pass the visual container (java.awt.Container) et a methode of my session bean :
    sessionbean.writePanel(java.awt.Container conteneur)

    But I have this message :
    error message :"" : java2iiop: fatal error: internal problem; please contact Inprise Customer Support.

    Due to the fact that java.awt.Container doens't implement Remote Interface. But I absolutly need to pass it to my session bean method ! How can I do ?

    Thanks !

  2. It doesn't sound to me like the problem is that Container isn't remote. You are allowed to pass Serializable parameters to EJB methods, and Container is Serializable.
    I can't see what's causing the problem though... :(

    Good luck
  3. yes, you're right, parameters don't need to implement java.rmi.Remote !
    That's the answer I received on an other forum, but it's wrong.

    But I don't understand why I can't pass a JPanel, JScrollPane, java.awt.Container to my session bean method ;(

    It seems to be something about the visual components.

    ps: sorry for my english ;)

  4. If you still can't work this out the normal way you can try this workaround: Declare the bean method to accept a java.rmi.MarshalledObject. This craps up type checking, but it might get the work done. I can't believe your server does not support passing a MarshalledObject...

    As a side note, from my expirience you may have some difficulties loading a graphical component in an EJB. They tend to try and hook up with the graphical system for some size calculations, and break down if one is not available.
    Once I needed to load some images in my EJB to make sure they're valid, I was running iPlanet on Sun Solaris and it failed to even load the Image class (static blocks...). We had to set up an X system for it (and I had to load it up in a seperate shell to do that...). Quite a head ache :)

  5. The problem you had with needing an X server is an old one with UNIX systems. The 1.2 (and 3) classes use the native libraries on a machine to do graphics rendering. Under UNIX that requires an X server to talk to. (Which in nice contradictory style is actually the machine the display is on, not the one running the processes!)

    Even though the classes never display anything on that screen, then still need access to it to draw anything.

    Very naff.

    Helpfully enough, this is gone in 1.4. You can do headless graphics handling now. Hurrah!


  6. Hey Tony.
    I know what caused the problem, it was just an example for Christophe. If I didn't know the problem I wouldn't set up an X for that machine, would I? :)
    I tracked the particular static blocks that caused the problem (as I said, it's an initialization of the metrics system) and notified Sun about it. I was using 1.2, I think. I'm happy to hear they fixed it in 1.4... you sure about that? Anyway to use it in EJB we'll have to wait for new versions of the App servers to come out...

    Thanks for your time anyway :)
  7. I don't use unix, and I don't understand why I can't pass an object of type java.axt.Container, or JComponent, JPanel, JScrollPane to a method of a session bean ;(

    They are all serializable!

    The error message I Obtained when JBuilder try to generate stubs, ... is : "" : java2iiop: fatal error: internal problem; please contact Inprise Customer Support.
    Thanks you Inprise ;)

    I have an other solution (less beautifull ;) ), but I would like to understand why I can't do that.