4 Replies Latest reply on Dec 6, 2001 10:30 AM by bdturne

    Trying to access ejb in jboss

    weetat

      Hi all ,
      I am using jdk1.3 , RedHat6.1 and jboss2.1 version.
      I am trying to access my ejb which jboss container is in another computer and Tomcat is in another computer.
      I cannot accessed the ejb , it give me error message : NullPointerException error message. Below is the code :
      Anybody have any ideas ? Thanks


      Properties props = new Properties();
      props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      props.put(Context.PROVIDER_URL, "localhost:1099");

      try

      {

      InitialContext ctx = new InitialContext(props);
      objects = (Object)PortableRemoteObject.narrow(ctx.lookup(jndiname),objclass);

      }
      catch(Exception e){
      e.printStackTrace();
      }

      return objects;

        • 1. Re: Trying to access ejb in jboss

          Hi Weetat

          What is assigned to jndiname?

          Is the bean deployed correctly?

          Jesper

          • 2. Re: Trying to access ejb in jboss
            seven

            I think u should change the line
            props.put(Context.PROVIDER_URL, "localhost:1099");
            to
            props.put(Context.PROVIDER_URL, "the_host_where_jboss_is_located:1099");

            • 3. Re: Trying to access ejb in jboss
              weetat

              Hi seven ,

              I have done that. However when my jsp tried to call the ejb from jboss container , it display error message below :

              javax.naming.CommunicationException : Root exception is java.io.StreamCorruptedException : Type code out of range , is 125

              at java.io.ObjecInputStream.peekCode(ObjectInputStream.java:1276)
              .........................
              ..

              Do you have any ideas why i have the error message ??
              Thanks russell.

              • 4. Re: Trying to access ejb in jboss
                bdturne

                Damn - I've got this exact problem - and I thought the answer was going to be here !

                Has anyone had this problem / anyone got any idea how to FIX this problem ?

                Ben