1 2 Previous Next 17 Replies Latest reply on Feb 5, 2014 9:48 AM by jbertram

    Jboss 7.1 final and JMS

    thinksteep

      Hi All,

       

      First of all thank you community for your help and time on my posts. With community help we were able to port all (except one) of the components from 4.2.3a to 7.1.

       

      This is our final component JMS. It seems there is major change in using JMS with 7.1. Could someone point me right direction?

       

      First question I have is, Is HornetQ server default JMS Server for 7.1? Do we need to install any components related to HornetQ or they are by default with 7.1?

       

      Any references on how to proceed will be really helpful.

       

      Thanks for your time and help.

        • 1. Re: Jboss 7.1 final and JMS
          jbertram

          HornetQ is the default JMS implementation in AS 7.x.

           

          Use standalone-full.xml and you'll have everything you need from a JMS perspective.

           

          If you have further questions let me know.

          • 2. Re: Jboss 7.1 final and JMS
            hannelita

            Hi! Try starting your JBoss with

             

            ./standalone.sh -c standalone-full.xml

             

             

            • 3. Re: Jboss 7.1 final and JMS
              thinksteep

              Hi Justin & Hanneli,

               

              I tried what you suggested and it seems Queues are registered. Now I am trying to connect to these queues from other standalone client and getting following error:  Could you please help us on how to proceed?

               

              2012-03-29 12:05:19,932 ERROR Can't initialize JMS connection to queue queue/jmsName

              javax.naming.NoInitialContextException: Cannot instantiate class: org.jboss.naming.remote.client.InitialContextFactory [Root exception is java.lang.ClassNotFoundException: org.jboss.naming.remote.client.InitialContextFactory]

                  at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)

                  at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)

                  at javax.naming.InitialContext.init(InitialContext.java:223)

                  at javax.naming.InitialContext.<init>(InitialContext.java:197)

                  at com.name.yyy.dc.jms.cs.csFactory.getInitialContext(csFactory.java:187)

                  at com.name.yyy.dc.jms.cs.csFactory.createSender(csFactory.java:145)

                  at com.name.yyy.dc.jms.cs.csFactory.getpacektSender(csFactory.java:63)

                  at com.name.yyy.system.server.colSer.doStart(colSer.java:656)

                  at com.name.yyy.system.server.colSer.csStart(colSer.java:269)

                  at com.name.yyy.system.Da.boot(Da.java:201)

                  at com.name.yyy.system.Da$1.run(Da.java:101)

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

              Caused by: java.lang.ClassNotFoundException: org.jboss.naming.remote.client.InitialContextFactory

                  at java.net.URLClassLoader$1.run(URLClassLoader.java:200)

                  at java.security.AccessController.doPrivileged(Native Method)

                  at java.net.URLClassLoader.findClass(URLClassLoader.java:188)

                  at java.lang.ClassLoader.loadClass(ClassLoader.java:307)

                  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

                  at java.lang.ClassLoader.loadClass(ClassLoader.java:252)

                  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)

                  at java.lang.Class.forName0(Native Method)

                  at java.lang.Class.forName(Class.java:247)

                  at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:46)

                  at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)

                  ... 11 more

               

              Lookup code is:

               

               

                          p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");

                          p.put(Context.PROVIDER_URL, "remote://localhost:4447");

                          p.put(Context.SECURITY_PRINCIPAL, "username");

                          p.put(Context.SECURITY_CREDENTIALS, "pwd");

               

                           InitialContext iniCtx =new InitialContext(p);

                          qcf = (QueueConnectionFactory) iniCtx.lookup("jms/RemoteConnectionFactory");

                          que = (Queue) iniCtx.lookup("queue/jmsName");

               

              Standalone-full.xml is:

               

              <jms-queue name="jmsName">

                                      <entry name="queue/jmsName"/>

                                      <entry name="java:jboss/exported/jms/queue/jmsName"/>

                                  </jms-queue>

               

              Thanks for your time and help.

              • 4. Re: Jboss 7.1 final and JMS
                hannelita

                Hi thinksteep

                 

                I think you haven't added JBoss Client jar tou your project. Go to JBOSS_FOLDER/bin/client and add the jar jboss-client.jar to your classpath. Check if it works! If not, ping back here and I try to help

                • 5. Re: Jboss 7.1 final and JMS
                  thinksteep

                  Hi Hanneli,

                   

                  Thanks for quick reply.

                   

                  client.jar resolved that error, but now I am seeing another error. I know this is because of wrong version of jar in classpath but not sure which jar it is. Could you please help us?

                   

                  Here is the exception stack:

                   

                  2012-03-29 14:04:30,346 ERROR Can't initialize JMS connection to queue queue/jmsName

                  javax.naming.NamingException: Failed to create remoting connection [Root exception is java.util.ServiceConfigurationError: org.xnio.XnioProvider: Provider org.xnio.nio.NioXnioProvider could not be instantiated: java.lang.NoSuchMethodError: org.jboss.logging.Logger.tracef(Ljava/lang/String;Ljava/lang/Object;)V]

                      at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:36)

                      at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:117)

                      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)

                      at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)

                      at javax.naming.InitialContext.init(InitialContext.java:223)

                      at javax.naming.InitialContext.<init>(InitialContext.java:197)

                      at com.name.yyy.datacollector.jms.cs.csFactory.getInitialContext(csFactory.java:187)

                      at com.name.yyy.datacollector.jms.cs.csFactory.createSender(csFactory.java:145)

                      at com.name.yyy.datacollector.jms.cs.csFactory.getSender(csFactory.java:63)

                      at com.name.yyy.system.server.CServerImpl.doStart(CServerImpl.java:656)

                      at com.name.yyy.system.server.CServerImpl.collectorServerStart(CServerImpl.java:269)

                      at com.name.yyy.system.Da.boot(Da.java:201)

                      at com.name.yyy.system.Da$1.run(Da.java:101)

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

                  Caused by: java.util.ServiceConfigurationError: org.xnio.XnioProvider: Provider org.xnio.nio.NioXnioProvider could not be instantiated: java.lang.NoSuchMethodError: org.jboss.logging.Logger.tracef(Ljava/lang/String;Ljava/lang/Object;)V

                      at java.util.ServiceLoader.fail(ServiceLoader.java:207)

                      at java.util.ServiceLoader.access$100(ServiceLoader.java:164)

                      at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:353)

                      at java.util.ServiceLoader$1.next(ServiceLoader.java:421)

                      at org.xnio.Xnio.doGetInstance(Xnio.java:187)

                      at org.xnio.Xnio.getInstance(Xnio.java:146)

                      at org.jboss.remoting3.Remoting.createEndpoint(Remoting.java:73)

                      at org.jboss.naming.remote.client.cache.EndpointCache.get(EndpointCache.java:44)

                      at org.jboss.naming.remote.client.InitialContextFactory.createEndpoint(InitialContextFactory.java:194)

                      at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateEndpoint(InitialContextFactory.java:175)

                      at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateConnection(InitialContextFactory.java:126)

                      at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:106)

                      ... 12 more

                  Caused by: java.lang.NoSuchMethodError: org.jboss.logging.Logger.tracef(Ljava/lang/String;Ljava/lang/Object;)V

                      at org.xnio.nio.NioXnio.<init>(NioXnio.java:76)

                      at org.xnio.nio.NioXnioProvider.<clinit>(NioXnioProvider.java:34)

                      at java.lang.Class.forName0(Native Method)

                      at java.lang.Class.forName(Class.java:247)

                      at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:345)

                      ... 21 more

                   

                  Thanks for your time and help.

                  • 6. Re: Jboss 7.1 final and JMS
                    thinksteep

                    Hi Justin and Hanneli,

                     

                    Please ignore my previous post. I was able to overcome that issue. Now when I try to connect to Queue and read something I am getting  following error: I didn't give any role while adding user 'yyyyyy'. I am confused on what roles should be assigned to this user to have full permissions on the queue. Any help would be really appreciated.

                     

                    Caused by: javax.jms.JMSSecurityException: User: yyyyyy doesn't have permission='CONSUME' on address jms.queue.queueName

                        at org.hornetq.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:312)

                        at org.hornetq.core.client.impl.ClientSessionImpl.internalCreateConsumer(ClientSessionImpl.java:1792)

                        at org.hornetq.core.client.impl.ClientSessionImpl.createConsumer(ClientSessionImpl.java:478)

                        at org.hornetq.core.client.impl.ClientSessionImpl.createConsumer(ClientSessionImpl.java:444)

                        at org.hornetq.core.client.impl.DelegatingSession.createConsumer(DelegatingSession.java:189)

                        at org.hornetq.jms.client.HornetQQueueBrowser.getEnumeration(HornetQQueueBrowser.java:91)

                        at com.name.yyy.dc.jms.cs.getLatestTimestamp(cs.java:311)

                        ... 10 more

                     

                    Thanks for your time and help.

                    • 7. Re: Jboss 7.1 final and JMS
                      jbertram

                      By default users in the role "guest" have the ability to send and consume messages, and create and delete non-durable queues:

                       

                                      <security-settings>

                                          <security-setting match="#">

                                              <permission type="send" roles="guest"/>

                                              <permission type="consume" roles="guest"/>

                                              <permission type="createNonDurableQueue" roles="guest"/>

                                              <permission type="deleteNonDurableQueue" roles="guest"/>

                                          </security-setting>

                                      </security-settings>

                       

                      The easiest thing would be for your user to be in this role.  Otherwise you can put your user in a different role and change the default <security-settings>.

                      • 8. Re: Jboss 7.1 final and JMS
                        rwhitely

                        thinksteep, I'd love it if you could post how you fixed you problem with this error:

                         

                        javax.naming.NamingException: Failed to create remoting connection [Root exception is java.util.ServiceConfigurationError: org.xnio.XnioProvider: Provider org.xnio.nio.NioXnioProvider could not be instantiated: java.lang.NoSuchMethodError

                         

                        I'm getting the same thing, and I have no clue how to fix it. Was it just missing an extra dependency or JAR in the classpath or something?

                        • 9. Re: Jboss 7.1 final and JMS
                          thinksteep

                          Hi rwhitely,

                           

                          It was because of having previous version of jboss client jar in classpath. Make sure your client classpath doesnt' contain old jboss client jar files. Instead use client jar included in jboss 7.1.

                           

                          Thank you,

                          • 10. Re: Jboss 7.1 final and JMS
                            rwhitely

                            That seems to be what my problem was too. Can't believe I didn't notice that sooner.

                             

                            I'm still running into errors, but they appear to be completely unrelated. Thanks!

                            • 11. Re: Jboss 7.1 final and JMS
                              daemon0509

                              Hi thinksteep

                               

                              I have a problem as same as you in Jboss .

                              I have seen all of your discuss contents, but I still have no idea how to fix it, can you help me and how do you fix?

                              The error code as follows.

                               

                               

                              Exception in thread "main" javax.naming.NamingException: Failed to create remoting connection [Root exception is java.util.ServiceConfigurationError: org.xnio.XnioProvider: Provider org.xnio.nio.NioXnioProvider could not be instantiated: java.lang.NoSuchMethodError: org.jboss.logging.Logger.tracef(Ljava/lang/String;Ljava/lang/Object;)V]

                                  at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:36)

                                  at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:121)

                                  at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)

                                  at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)

                                  at javax.naming.InitialContext.init(Unknown Source)

                                  at javax.naming.InitialContext.<init>(Unknown Source)

                                  at SendRecvClient.setupPTP(SendRecvClient.java:63)

                                  at SendRecvClient.sendRecvAsync(SendRecvClient.java:81)

                                  at SendRecvClient.main(SendRecvClient.java:184)

                              Caused by: java.util.ServiceConfigurationError: org.xnio.XnioProvider: Provider org.xnio.nio.NioXnioProvider could not be instantiated: java.lang.NoSuchMethodError: org.jboss.logging.Logger.tracef(Ljava/lang/String;Ljava/lang/Object;)V

                                  at java.util.ServiceLoader.fail(Unknown Source)

                                  at java.util.ServiceLoader.access$100(Unknown Source)

                                  at java.util.ServiceLoader$LazyIterator.next(Unknown Source)

                                  at java.util.ServiceLoader$1.next(Unknown Source)

                                  at org.xnio.Xnio.doGetInstance(Xnio.java:187)

                                  at org.xnio.Xnio.getInstance(Xnio.java:146)

                                  at org.jboss.remoting3.Remoting.createEndpoint(Remoting.java:73)

                                  at org.jboss.naming.remote.client.EndpointCache.get(EndpointCache.java:44)

                                  at org.jboss.naming.remote.client.InitialContextFactory.createEndpoint(InitialContextFactory.java:193)

                                  at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateEndpoint(InitialContextFactory.java:174)

                                  at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateNamingStore(InitialContextFactory.java:138)

                                  at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:104)

                                  ... 7 more

                              Caused by: java.lang.NoSuchMethodError: org.jboss.logging.Logger.tracef(Ljava/lang/String;Ljava/lang/Object;)V

                                  at org.xnio.nio.NioXnio.<init>(NioXnio.java:76)

                                  at org.xnio.nio.NioXnioProvider.<clinit>(NioXnioProvider.java:34)

                                  at java.lang.Class.forName0(Native Method)

                                  at java.lang.Class.forName(Unknown Source)

                                  ... 17 more

                               

                              Thank you.

                              • 12. Re: Jboss 7.1 final and JMS
                                thinksteep

                                Hi Chen,  As my response to rwhitley, It was because of having old version (not 7.1) of jboss client jar in classpath. Make sure your client classpath doesnt' contain old jboss client jar files. Instead use client jar included in jboss 7.1.  Caused by: java.lang.NoSuchMethodError: org.jboss.logging.Logger.tracef(Ljava/lang/String;Ljava/lang/Object;)V     at org.xnio.nio.NioXnio.(NioXnio.java:76)     at org.xnio.nio.NioXnioProvider.(NioXnioProvider.java:34)     at java.lang.Class.forName0(Native Method)     at java.lang.Class.forName(Unknown Source)     ... 17 more  This message strongly indicates Jar mismatch.  Thank you,

                                • 13. Re: Jboss 7.1 final and JMS
                                  daemon0509

                                  Hi thinksteep

                                  I checked my set of classpath, I'm sure that have no old verison of jboss client.jar.

                                  But it still exists the same message.

                                  So, I have no idea how to improve it, I tried to find a lot of information about this on google, but it still can't be fix.

                                  Maybe you have more suggests that can give me, or I can give you my simple code.

                                   

                                  Thanks for your help on time.

                                  • 14. Re: Jboss 7.1 final and JMS
                                    als

                                    its because of your logging.jar, be sure the first in classpath should be logging.jar from EAP

                                    1 2 Previous Next