1 Reply Latest reply on Apr 12, 2007 9:31 AM by mhoennig

    NullPointerException at sun.reflect.NativeMethodAccessorImpl

    mhoennig

      Dear JBoss experts,

      I tried my own "hello world" with EJB3 on JBoss 4.0.5GA today. But when I invoke a method on my SLSB, I am getting this stack:

      [java] log4j:WARN No appenders could be found for logger (org.jboss.security.SecurityAssociation).
      [java] log4j:WARN Please initialize the log4j system properly.
      [java] java.lang.NullPointerException
      [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      [java] at java.lang.reflect.Method.invoke(Method.java:585)
      [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
      [java] at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:263)
      [java] at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
      [java] at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
      [java] at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
      [java] at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
      [java] at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
      [java] at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:398)
      [java] at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
      [java] at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:190)
      [java] at org.jboss.remoting.Client.invoke(Client.java:525)
      [java] at org.jboss.remoting.Client.invoke(Client.java:488)
      [java] at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:55)
      [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      [java] at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
      [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      [java] at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
      [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      [java] at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:77)
      [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      [java] at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102)
      [java] at $Proxy0.ping(Unknown Source)
      [java] at ....EJB3TestClient.main(EJB3TestClient.java:38)

      Does the log4j warning has to do with it? Looking at the stack I doubt it.

      My SLSB is pretty simple:

      1. a remote interface:

      package ...;
      
      @javax.ejb.Remote
      public interface EJB3StatelessTestSessionFacade
      {
       public String ping();
      }
      


      2. the bean:

      package ...;
      
      @javax.ejb.Stateless
      public class EJB3StatelessTestSessionBean
       implements EJB3StatelessTestSessionFacade
      {
       public String ping()
       {
       return "pong ";
       }
      }


      3. a client:

      package ...;
      
      import java.util.Properties;
      import javax.ejb.EJB;
      import javax.naming.InitialContext;
      
      public class EJB3TestClient
      {
       @EJB public static EJB3StatelessTestSessionFacade aFacade;
      
       /**
       * @param args
       */
       public static void main(String[] args)
       {
       try
       {
       Properties p = new Properties();
       p.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
       p.put("java.naming.factory.url.pkgs","=org.jboss.naming:org.jnp.interfaces");
       p.put("java.naming.provider.url","localhost:1099");
       p.put("jnp.socket.Factory","org.jnp.interfaces.TimedSocketFactory");
      
       System.out.println( "getting initial context" );
       InitialContext aIC = new InitialContext(p);
      
       if ( aFacade == null )
       {
       System.out.println( "session bean lookup" );
       aFacade = (EJB3StatelessTestSessionFacade)
       aIC.lookup( "java:ejb3test/EJB3StatelessTestSessionBean/remote" );
       }
      
       System.out.println( "calling session bean" );
       System.out.println( aFacade.ping() );
       }
       catch ( Exception aExc )
       {
       aExc.printStackTrace(System.err);
       }
       }
      
      }


      Any idea what I am doing wrong?

      Thanks!
      ... Michael