4 Replies Latest reply on Nov 9, 2005 8:48 AM by Guillaume Bessez

    No appenders could be found for logger (org.jnp.interfaces.N

    Alex Boumbarov Newbie

      Hi all,

      I am trying to invoke an EJB session bean through RMI, using the following piece of code:

      if (System.getSecurityManager() == null)
      System.setSecurityManager(new RMISecurityManager()
      public void checkConnect(String host, int port) {}
      public void checkConnect(String host, int port, Object context) {}
      public void checkPermission(Permission perm, Object context) {}
      public void checkPermission(Permission perm) {}

      String registryAddr = "jnp://"+ip+":"+port+"/";
      Hashtable rmiHash = new Hashtable();






      InitialContext ic = new InitialContext(rmiHash);
      return ic.lookup(jndiName);

      When invoke this piece of code I get the following message:

      No appenders could be found for logger (org.jnp.interfaces.NamingContext)

      Thetre is no problem after that, the methods of the remote object are executing OK. I just would like to know why this message appears. I am developing a console that calls various objects through RMI and this message in question just tends to remain on top of the window when it appears and it is quite a nuisance.

      Thanks, Alex

        • 1. Re: No appenders could be found for logger (org.jnp.interfac
          Alex Boumbarov Newbie

          Correction: the full text of the message is:

          No appenders could be found for logger (org.jnp.interfaces.NamingContext)

          log4j:WARN Please initialize the log4j system properly.

          • 2. Re: No appenders could be found for logger (org.jnp.interfac
            Frank Griffin Novice

            I'm getting this too. A forum search shows people asking variants of this question all over the place, with the common theme being that the messages appear on the client side in spite of the fact that all of the jars in client/ are in the CLASSPATH. The usual recommendation is to add a log4j.properties or a log4j.xml to the CLASSPATH, but it would be helpful if the distro contained such a default file for client use. The only log4j.properties I can find is buried in a SAR file in all/deploy, and I'm assuming that the log4j.xml files in xx/conf are for server use.

            Could someone please clear this up and add it to a FAQ ? Thanks.

            • 3. Re: No appenders could be found for logger (org.jnp.interfac
              jaikiran pai Master

              Whenever log4j APIs are used for logging, you should place log4j.xml or log4j.properties in your classpath. Now, if you have server side application in jboss, then there is already a log4j.xml in conf directory. In case you have a client application which uses log4j API, then you will have to place the log4j.xml or log4j.properties in your client classpath. These files will be used for finding appropriate appenders for a logger.

              but it would be helpful if the distro contained such a default file for client use

              This file is application specific, so the distribution cannot contain this file.

              Sample contents of log4j.xml:

              <?xml version="1.0" encoding="UTF-8" ?>
              <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
              <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
               <appender name="myAppender"
               <layout class="org.apache.log4j.SimpleLayout"/>
               <priority value="debug" />
               <appender-ref ref="myAppender"/>

              Sample log4j.properties:

              # The root logger is assigned priority level DEBUG and an appender
              # named myAppender.
              log4j.rootLogger=debug, myAppender
              # The appender's type specified as FileAppender, i.e. log output
              # written to a file.
              # The appender is assigned a layout SimpleLayout.
              # SimpleLayout will include only priority level of the log
              # statement and the log statement itself in log output.

              Have a look at :
              http://www.developer.com/open/article.php/10930_3097221_3 for the same

              • 4. Re: No appenders could be found for logger (org.jnp.interfac
                Guillaume Bessez Newbie

                I had this problem:

                log4j:WARN No appenders could be found for logger (org.jboss.security.SecurityAssociation).
                log4j:WARN Please initialize the log4j system properly.

                So i added the advised log4j.xml file to the classpath, and i now get :

                DEBUG - Using ThreadLocal: false
                at $Proxy1.diagnose(Unknown Source)
                at PSDB_Plugin.run.SessionClient.main(SessionClient.java:52)
                Caused by: java.io.NotSerializableException: PSDB_Plugin.ejb.Result
                at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1075)
                at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291)
                at java.rmi.MarshalledObject.(MarshalledObject.java:92)
                at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:410)
                at sun.reflect.GeneratedMethodAccessor91.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:585)
                at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
                at sun.rmi.transport.Transport$1.run(Transport.java:153)
                at java.security.AccessController.doPrivileged(Native Method)
                at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
                at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
                at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
                at java.lang.Thread.run(Thread.java:595)
                at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
                at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
                at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
                at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
                at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:119)
                at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:227)
                at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:167)
                at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
                at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
                at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:97)
                at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)

                Any idea of what the problem is ?