1 Reply Latest reply on Jul 4, 2014 1:53 AM by fancyerii

    using hornetq client in tomcat

    fancyerii

      I have a background thread that is using hornetq client to receive jms topic message from a remote hornetq broker. This thread is started as ServletContextListener when tomcat starts.

      But the tomcat throws strange Exception:

      llegal access: this web application instance has been stopped already.  Could not load java.net.SocketTimeoutException.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.

      java.lang.IllegalStateException

              at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1588)

              at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)

              at org.jboss.netty.channel.socket.oio.AbstractOioWorker.run(AbstractOioWorker.java:75)

              at org.jboss.netty.channel.socket.oio.OioWorker.run(OioWorker.java:51)

              at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)

              at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)

              at org.jboss.netty.util.VirtualExecutorService$ChildExecutorRunnable.run(VirtualExecutorService.java:175)

              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

              at java.lang.Thread.run(Thread.java:744)

      I suspect that hornetq use linux aio and cause jvm can't use nio which is used by tomcat. How can I force the hornetq client do not use aio?

      my os is ubuntu 12.04 with libaio installed. I can send and receive topic messages in a standalone java application. My java version is :

      java version "1.7.0_45"

      Java(TM) SE Runtime Environment (build 1.7.0_45-b18)

      Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

      tomcat version is 7.0.47

        • 1. Re: using hornetq client in tomcat
          fancyerii

          I move it from startup and start it after tomcat successfully start up.

          it throws error like:

          NoSuchMethodError : org.hornetq.core.buffers.impl.ChannelBufferWrapper.<init>(Lio/netty/buffer/ByteBuf;)V

          int https://community.jboss.org/thread/239027

          And The problem is that hornetq-core. Why other pom is 2.4.0-final but hornetq-core is 2.2.21?

          my pom:

           

           

          <dependency>
          <groupId>org.hornetq</groupId>
          <artifactId>hornetq-jms-client</artifactId>
          <version>2.4.0.Final</version>
          </dependency>
          <dependency>
          <groupId>jboss</groupId>
          <artifactId>jnp-client</artifactId>
          <version>4.2.2.GA</version>
          </dependency>
          <dependency>
          <groupId>org.hornetq</groupId>
          <artifactId>hornetq-commons</artifactId>
          <version>2.4.0.Final</version>
          </dependency>
          <dependency>
          <groupId>org.hornetq</groupId>
          <artifactId>hornetq-core-client</artifactId>
          <version>2.4.0.Final</version>
          </dependency>
          <dependency>
          <groupId>org.hornetq</groupId>
          <artifactId>hornetq-core</artifactId>
          <version>2.4.0.Final</version>
          </dependency>
          <dependency>
          <groupId>io.netty</groupId>
          <artifactId>netty-all</artifactId>
          <version>4.0.13.Final</version>
          </dependency>