Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-594

Cannot get EJB Home interface from Remote interface

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • JBossAS-3.2.6 Final
    • None
    • None

    Description

      SourceForge Submitter: dciarnie .
      One cannot get an EJB home interface from a remote
      interface (using getEJBHome()) when the JNDI connection
      properties are not set in the System property space.
      The following code fragment illustrates the problem:

      ==============================
      Properties props = new Properties();

      props.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");

      // host must be remote, not local
      props.setProperty(Context.PROVIDER_URL,"remotehost:1099");
      props.setProperty(Context.URL_PKG_PREFIXES,"org.jboss.naming");

      InitialContext ctx = new InitialContext(props);

      FooHome foohome = (FooHome)ctx.lookup("ejb/foohome");
      Foo foo = foo.findByPrimaryKey(id);

      EJBHome home = foo.getEJBHome();
      ==============================

      The last line will fail with a
      java.lang.reflect.UndeclaredThrowableException caused
      by a java.net.SocketTimeoutException.

      I have traced the problem to
      org.jboss.proxy.ejb.GenericEJBInterceptor.getEJBHome(Invocation).

      which has the line

      InitialContext iniCtx = new InitialContext();

      and therein lies the problem. This assumes that the
      JNDI connection properties have been set in the System
      property space which is not the case in the above example.

      The remote interface must have explicit access to the
      JNDI properties used to retrieve it in the first place.
      It cannot assume that these properties have been set
      in the System property space.

      Note that this problem also exists in v3.2. It does
      not exist in 2.4.x.

      Attachments

        Activity

          People

            starksm64 Scott Stark (Inactive)
            sourceforge-user SourceForge legacy user (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: