DRb marshalling fails for EJB objects
-------------------------------------

                 Key: JRUBY-3837
                 URL: http://jira.codehaus.org/browse/JRUBY-3837
             Project: JRuby
          Issue Type: Bug
    Affects Versions: JRuby 1.3.1, JRuby 1.2
         Environment:  $ java -version
java version "1.6.0_0"
OpenJDK Runtime Environment (IcedTea6 1.4.1) (6b14-1.4.1-0ubuntu7)
OpenJDK 64-Bit Server VM (build 14.0-b08, mixed mode)


 $ ruby --version
ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]



            Reporter: Mikael Lammentausta
            Assignee: Thomas E Enebo


I am using JRuby to access remote EJBs (through RMI) and pass the object over 
the DRb to MRI Ruby.

JRuby 1.1.6 works as expected and I can use the EJB objects on MRI Ruby. 
However, versions 1.2.0 and 1.3.1 both give the same error.

I tried also simple test with local Java classes, and they work on all versions.

The EJB interface contains the method "desFileLdap", which in this is test case 
should return "DC".

<pre>
  def test_raw
    drb = DRb::DRbObject.new_with_uri('druby://localhost:9876')
    p drb.inspect
    java_obj = drb.new()
    p java_obj.inspect
    ejb = java_obj.callEJB('@username')
    p ejb.desFileLdap
  end
</pre>


With JRuby 1.1.6:
<pre>
"#<DRb::DRbObject:0x7f1ec014ee80 @ref=nil, @uri=\"druby://localhost:9876\">"
"#<DRb::DRbObject:0x7f1ec0149250 @ref=14, @uri=\"druby://localhost:9876\">"
"DC"
.
Finished in 1.890095 seconds.
</pre>


With JRuby >= 1.2.0:
<pre>
"#<DRb::DRbObject:0x7f209dcd0ec8 @ref=nil, @uri=\"druby://localhost:9876\">"
"#<DRb::DRbObject:0x7f209dccb360 @ref=20, @uri=\"druby://localhost:9876\">"
E
Finished in 1.138273 seconds.

  1) Error:
test_raw(EntityTest):
NoMethodError: undefined method `desFileLdap' for 
#<DRb::DRbUnknown:0x7f209dcc66a8>
    ./test/entity_test.rb:21:in `test_raw'
</pre>



This is the DRb server / RMI client code:

<pre>
require 'java'

# load Java libraries
....


### load the DRb client/server
require 'drb/drb'

    # formulate uri
    uri = "druby://localhost:9876"

    DRb.start_service(uri, Java::CallEjb)
    DRb.thread.join # loops forever
</pre>

When testing just the RMI client, all JRubies work ok. They can access the 
objects and their attributes.

Finally, the (abridged) CallEjb Java class:
<pre>

// private class imports here, that provide the objects


import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;

public class CallEjbDBProf {

        public Utenza callEJB(String username) throws Exception{
                if((username == null || username.equalsIgnoreCase(""))) {
                        return null;
                }
                DBProfServices dbProf;
                Context ctx = null;
                UtenzaDTO utenza = null;

                try {
                        Properties env = new Properties();
                        ClassLoader classLoader = getClass().getClassLoader();
                        env 
.load(classLoader.getResourceAsStream("ejbProperties.properties"));

                        ctx = new InitialContext(env);

                        if (ctx != null) {
                                DBProfServicesHome dbProfHome = 
(DBProfServicesHome) PortableRemoteObject.narrow(ctx.lookup("DBProfServices"), 
DBProfServicesHome.class);
                                dbProf = dbProfHome.create();
                                System.out.println("Call EJB");
                                utenza = dbProf.getUtenza(username);
                                System.out.println("Return profili");
                        }

                } catch (Exception e) {
                        e.printStackTrace();
                        throw e;
                }
                return utenza;
        }
}

</pre>



Hopefully that is enough data, because I cannot provide the EJBs for testing.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to