11 Replies Latest reply on Aug 28, 2003 5:32 AM by adrian.brock

    Publisher cannot publish message

    weite

      I'm a noob to JBoss and log4j. I have been trying out to use log4j for my application in JBoss. I have written a simple program to send some logs thru JMSappender. However the behaviour of the publisher has been rather unpredictable. I have rewrote JMSAppender which I basically put some println statements to trace thru. The problem with my publisher is that sometimes it basically hangs before the line where it tries to do a publish(message). I'm not sure why it hangs there and yet it works sometimes. Any help would be appreciated.

      Here's my configuration file used:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
      <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">




      <!-- The default pattern: Date Priority [Category] Message\n -->













      <!-- The default pattern: Date Priority [Category] Message\n -->





      <appender-ref ref="CONSOLE"/>
      <appender-ref ref="JMS" />


      </log4j:configuration>


      Here's my program doing the logging,

      import org.apache.log4j.Logger;
      import org.apache.log4j.xml.DOMConfigurator;

      public class Helloworld{
      static Logger logger = Logger.getLogger("Helloworld");
      static public void main(String[] args){
      DOMConfigurator.configure(args[0]);
      logger.info("Entering application");
      logger.info("Exiting application");
      }
      }

        • 1. Re: Publisher cannot publish message
          weite

          here's some of the output i got from the console, not sure if its helpful

          0 [main] DEBUG org.jboss.mq.referenceable.SpyConnectionFactoryObjectFactory
          - Extracting SpyConnectionFactory from reference
          90 [main] DEBUG org.jboss.mq.referenceable.SpyConnectionFactoryObjectFactory
          - The GenericConnectionFactory is: GenericConnectionFactory:[server=org.jboss.mq
          .il.oil.OILServerIL@f1bb78,connectionProperties={OIL_TCPNODELAY_KEY=yes, PingPer
          iod=60000, OIL_PORT_KEY=8090, ClientILService=org.jboss.mq.il.oil.OILClientILSer
          vice, OIL_ADDRESS_KEY=192.168.1.10}]
          170 [main] DEBUG org.jboss.mq.Connection - Setting the clockDaemon's thread fa
          ctory
          300 [main] DEBUG org.jboss.mq.GenericConnectionFactory - Handing out ClientIL:
          org.jboss.mq.il.oil.OILClientILService
          doing lookup
          410 [main] DEBUG org.jboss.mq.referenceable.SpyDestinationObjectFactory - SpyD
          estinationObjectFactory->getObjectInstance()
          330 [OILClientILService-0] DEBUG org.jboss.mq.il.oil.OILClientILService - Wait
          ing for the server to connect to me on port 1779

          • 2. Re: Publisher cannot publish message

            It is waiting for the client to connection back to you
            because you are using OIL. What error do you see on the server?

            Is there a firewall in the way?

            Regards,
            Adrian

            • 3. Re: Publisher cannot publish message
              weite

              I do not get to see any errors on the server side until I do a Ctrl-C on my publisher.

              Server error from console:
              22:30:23,771 INFO [Server] JBoss (MX MicroKernel) [3.2.1 (build: CVSTag=JBoss_3
              _2_1 date=200305041533)] Started in 19s:508ms
              22:38:33,886 ERROR [OILClientIL] Cannot connect to the ConnectionReceiver/Server

              java.net.SocketException: Connection reset
              at java.net.SocketInputStream.read(SocketInputStream.java:168)


              I do not have any firewalls running. I'm running the publisher, JBoss and the consumer on the same machine. I do not understand sometimes it works perfectly without any errors by just retrying the publisher program again and again.

              Is the OIL thing important in understanding how it works? I'm a complete newbie in this. Thanks for any input!! :)

              • 4. Re: Publisher cannot publish message

                OIL connects back to the client from the server.
                This is where it is hanging.
                Try UIL2.

                Just because you are on the same server doesn't mean
                the firewall won't get in the way.

                Some OSs like Redhat install a firewall by default.

                Regards,
                Adrian

                • 5. Re: Publisher cannot publish message
                  weite

                  I've made the change to my config files with this line:


                  Is there anything more I need to change?

                  I've tried my publisher again with the changes and it seems to be locked up before doing publishing again.

                  It sits and wait at this line:
                  320 [main] DEBUG org.jboss.mq.GenericConnectionFactory - Handing out ClientIL:
                  org.jboss.mq.il.uil.UILClientILService

                  There's no new log being displayed at my JBoss console until I do a Ctrl-C on my publisher.

                  This is what that has been dumped out:

                  09:53:45,402 INFO [Server] JBoss (MX MicroKernel) [3.2.1 (build: CVSTag=JBoss_3
                  _2_1 date=200305041533)] Started in 31s:795ms
                  09:55:04,787 INFO [UILServerILService] Client request resulted in a server exce
                  ption:
                  java.rmi.RemoteException: Cannot connect to the ConnectionReceiver/Server
                  at org.jboss.mq.il.uil.UILClientIL.createConnection(UILClientIL.java:148
                  )
                  at org.jboss.mq.il.uil.UILServerILService.run(UILServerILService.java:25
                  5)
                  at java.lang.Thread.run(Thread.java:536)
                  09:55:04,817 WARN [UILServerILService] Connection failure (3).
                  java.rmi.RemoteException: Cannot connect to the ConnectionReceiver/Server
                  at org.jboss.mq.il.uil.UILClientIL.createConnection(UILClientIL.java:148
                  )
                  at org.jboss.mq.il.uil.UILServerILService.run(UILServerILService.java:25
                  5)
                  at java.lang.Thread.run(Thread.java:536)


                  I'm currently using Win2K and I haven't install any firewall packages on my machine.

                  Thanks.

                  • 6. Re: Publisher cannot publish message

                    And the DEBUG message in log/server.log is?

                    Regards,
                    Adrian

                    • 7. Re: Publisher cannot publish message

                      Ah! I didn't read your response.

                      This error is thrown when it cannot get socket streams.
                      It is hanging on the socket open for some reason?

                      Regards,
                      Adrian

                      • 8. Re: Publisher cannot publish message
                        weite

                        I've tried using UILConnectionFactory and UIL2ConnectionFactory. Anything else I can try? It seems that OIL has higher chance of connecting while UIL or UIL2 has zero chance of connecting.

                        • 9. Re: Publisher cannot publish message

                          On your previous report you got a RemoteException.
                          In server/default/log/server.log there will be a DEBUG
                          message that shows the real SocketException

                          Regards,
                          Adrian

                          • 10. Re: Publisher cannot publish message
                            weite

                            I've finally got my logging application to work by using RMIConnectionFactory. Does that mean that OIL and UIL are broken?

                            Regarding UIL,

                            these are the errors thrown on the server log when I do a CTRL-C on the publisher:

                            09:53:28,542 ERROR [SocketManager] Failed to create ObjectInputStream
                            java.net.SocketException: Connection reset
                            at java.net.SocketInputStream.read(SocketInputStream.java:168)


                            If I sit and wait, time out occurs:
                            09:54:48,837 ERROR [SocketManager] Failed to create ObjectInputStream
                            java.net.SocketTimeoutException: Read timed out
                            at java.net.SocketInputStream.socketRead0(Native Method)

                            • 11. Re: Publisher cannot publish message

                              Like I said before, it cannot read from the socket.
                              It is the same problem for both OIL and UIL

                              I've got no idea why it cannot read from the socket?
                              It isn't a firewall problem otherwise RMI wouldn't work.

                              Regards,
                              Adrian