0 Replies Latest reply on Nov 21, 2005 12:52 PM by delkant

    EJB3 and jboss4.0.3SP1 jndi exception from standalone progra

    delkant

      Hi. i have the next problem,
      i have one ejb3 Test.class with the next code:
      Server side

      package my.pkg.ejb;
      
      import javax.ejb.Remote;
      import javax.ejb.Stateful;
      
      @Stateful
      @Remote
      public class Test {
       public String getTest(){
       return "the big test";
       }
      }
      


      and then i have also my Client

      Test

      package py.pkg.client.jnditest;
      import java.util.Properties;
      import javax.naming.Context;
      import javax.naming.InitialContext;
      import javax.rmi.PortableRemoteObject;
      
      import my.pkg.Test;
      public class Test
       {
      
       /**
       * @param args
       */
       public static void main(String[] args)
       {
       try{
       Properties prop = new Properties();
       prop.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
       prop.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
       prop.put(Context.PROVIDER_URL, "jnp://localhost:1099");
       //Use them to get the context
       Context context = new InitialContext(prop);
       Object ref = context.lookup(Test.class.getName());
       Test p = (Test)PortableRemoteObject.narrow(ref, Test.class);
       System.out.println("lookup(test): " + p.getTest());
       }
       catch (Exception e)
       {
       System.out.println("Exception "+e);
       e.printStackTrace();
       }
       }
      
       }
      


      i put also in my classpath the jbossall-client.jar, the ejb3 class.

      but when i run my test client.. i get the next ERRROR


      Exception javax.naming.NamingException: Could not dereference object [Root exception is java.lang.ArrayIndexOutOfBoundsException: 0]javax.naming.NamingException: Could not dereference object [Root exception is java.lang.ArrayIndexOutOfBoundsException: 0]

      at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1135)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:690)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
      at javax.naming.InitialContext.lookup(InitialContext.java:351)
      at py.com.wpg.jnditest.Test.main(Test.java:49)
      Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
      at org.jboss.ejb3.session.BaseSessionProxyFactory.getEjbMetaData(BaseSessionProxyFactory.java:76)
      at org.jboss.ejb3.session.BaseSessionProxyFactory.setEjb21Objects(BaseSessionProxyFactory.java:47)
      at org.jboss.ejb3.stateful.StatefulRemoteProxyFactory.createProxy(StatefulRemoteProxyFactory.java:112)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:121)
      at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:69)
      at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:566)
      at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:436)
      at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:247)
      at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:285)
      at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:169)




      can anyone help me??
      thanks