1 2 3 Previous Next 32 Replies Latest reply on Jun 21, 2006 5:55 AM by timfox

    A simple JMS Client won't work - Errors with different jars

    anshah1

      Hi,

      I have a simple JMS Client,

      Properties env = new Properties();
       env.setProperty("java.naming.factory.initial",
       "org.jnp.interfaces.NamingContextFactory");
       env.setProperty("java.naming.provider.url", "servername");
       env.setProperty("java.naming.factory.url.pkgs",
       "org.jboss.naming:org.jnp.interfaces");
       InitialContext jndi = new InitialContext(env);
       QueueConnectionFactory cf = null;
       QueueConnection connection = null;
       cf = (QueueConnectionFactory) jndi.lookup("/ConnectionFactory");
       String lookUpString = "/queue/A";
      
       Queue queue = (Queue) jndi.lookup(lookUpString);
       System.out.println("Looking up:: " + queue);
       connection = cf.createQueueConnection();
       QueueSession session = connection.createQueueSession(false,
       Session.AUTO_ACKNOWLEDGE);
       QueueSender sender = session.createSender(queue);
       TextMessage message = session.createTextMessage();
       message.setText("Results Done!!");
       System.out.println("In sendMessage()");
       sender.send(message);
      



      I have downloaded the 1.0.1.CR2 release. I have the jboss-messaging-client.jar from this release in my classpath. However on running this code I get the following error.



      ERROR [main] (JBossConnectionFactory.java:251) - Failed to config client side AOP
      java.lang.reflect.InvocationTargetException
       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
       at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
       at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
       at java.lang.reflect.Constructor.newInstance(Unknown Source)
       at org.jboss.remoting.InvokerRegistry.createClientInvoker(InvokerRegistry.java:367)
       at org.jboss.remoting.Client.connect(Client.java:377)
       at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.invoke(ClientConnectionFactoryDelegate.java:184)
       at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate$getClientAOPConfig_8697532701842707646.invokeNext(ClientConnectionFactoryDelegate$getClientAOPConfig_8697532701842707646.java)
       at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.getClientAOPConfig(ClientConnectionFactoryDelegate.java)
       at org.jboss.jms.client.JBossConnectionFactory.ensureAOPConfigLoaded(JBossConnectionFactory.java:234)
       at org.jboss.jms.client.JBossConnectionFactory.createConnectionInternal(JBossConnectionFactory.java:197)
       at org.jboss.jms.client.JBossConnectionFactory.createQueueConnection(JBossConnectionFactory.java:109)
       at org.jboss.jms.client.JBossConnectionFactory.createQueueConnection(JBossConnectionFactory.java:104)
       at polygraph.PolygraphMessageProducer.main(PolygraphMessageProducer.java:31)
      Caused by: java.lang.NoSuchMethodError: org.jboss.util.propertyeditor.PropertyEditors.mapJavaBeanProperties(Ljava/lang/Object;Ljava/util/Properties;Z)V
       at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.setup(MicroSocketClientInvoker.java:135)
       at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.<init>(MicroSocketClientInvoker.java:118)
       at org.jboss.remoting.transport.socket.SocketClientInvoker.<init>(SocketClientInvoker.java:108)
       ... 14 more
      java.lang.RuntimeException: Failed to config client side AOP
       at org.jboss.jms.client.JBossConnectionFactory.ensureAOPConfigLoaded(JBossConnectionFactory.java:252)
       at org.jboss.jms.client.JBossConnectionFactory.createConnectionInternal(JBossConnectionFactory.java:197)
       at org.jboss.jms.client.JBossConnectionFactory.createQueueConnection(JBossConnectionFactory.java:109)
       at org.jboss.jms.client.JBossConnectionFactory.createQueueConnection(JBossConnectionFactory.java:104)
       at polygraph.PolygraphMessageProducer.main(PolygraphMessageProducer.java:31)
      Caused by: java.lang.reflect.InvocationTargetException
       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
       at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
       at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
       at java.lang.reflect.Constructor.newInstance(Unknown Source)
       at org.jboss.remoting.InvokerRegistry.createClientInvoker(InvokerRegistry.java:367)
       at org.jboss.remoting.Client.connect(Client.java:377)
       at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.invoke(ClientConnectionFactoryDelegate.java:184)
       at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate$getClientAOPConfig_8697532701842707646.invokeNext(ClientConnectionFactoryDelegate$getClientAOPConfig_8697532701842707646.java)
       at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.getClientAOPConfig(ClientConnectionFactoryDelegate.java)
       at org.jboss.jms.client.JBossConnectionFactory.ensureAOPConfigLoaded(JBossConnectionFactory.java:234)
       ... 4 more
      Caused by: java.lang.NoSuchMethodError: org.jboss.util.propertyeditor.PropertyEditors.mapJavaBeanProperties(Ljava/lang/Object;Ljava/util/Properties;Z)V
       at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.setup(MicroSocketClientInvoker.java:135)
       at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.<init>(MicroSocketClientInvoker.java:118)
       at org.jboss.remoting.transport.socket.SocketClientInvoker.<init>(SocketClientInvoker.java:108)
       ... 14 more
      



      If I replace this jar file with a jboss-messaging-client.jar from the CR1 download directory then I get


      Exception in thread "main" java.lang.NoSuchMethodError: org.jboss.aop.ClassAdvisor.access$300(Lorg/jboss/aop/ClassAdvisor;)V
       at org.jboss.aop.ClassAdvisor$1.run(ClassAdvisor.java:299)
       at java.security.AccessController.doPrivileged(Native Method)
       at org.jboss.aop.ClassAdvisor.attachClass(ClassAdvisor.java:209)
       at org.jboss.aop.AspectManager.getAdvisor(AspectManager.java:459)
       at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.<clinit>(ClientConnectionFactoryDelegate.java)
       at sun.misc.Unsafe.ensureClassInitialized(Native Method)
       at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(Unknown Source)
       at sun.reflect.ReflectionFactory.newFieldAccessor(Unknown Source)
       at java.lang.reflect.Field.acquireFieldAccessor(Unknown Source)
       at java.lang.reflect.Field.getFieldAccessor(Unknown Source)
       at java.lang.reflect.Field.getLong(Unknown Source)
       at java.io.ObjectStreamClass.getDeclaredSUID(Unknown Source)
       at java.io.ObjectStreamClass.access$600(Unknown Source)
       at java.io.ObjectStreamClass$2.run(Unknown Source)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.io.ObjectStreamClass.<init>(Unknown Source)
       at java.io.ObjectStreamClass.lookup(Unknown Source)
       at java.io.ObjectStreamClass.initNonProxy(Unknown Source)
       at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
       at java.io.ObjectInputStream.readClassDesc(Unknown Source)
       at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
       at java.io.ObjectInputStream.readObject0(Unknown Source)
       at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
       at java.io.ObjectInputStream.readSerialData(Unknown Source)
       at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
       at java.io.ObjectInputStream.readObject0(Unknown Source)
       at java.io.ObjectInputStream.readObject(Unknown Source)
       at java.rmi.MarshalledObject.get(Unknown Source)
       at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:57)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:637)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
       at javax.naming.InitialContext.lookup(Unknown Source)
       at polygraph.PolygraphMessageProducer.main(PolygraphMessageProducer.java:26)
      


      I also have the jbossall-client.jar file in my classpath. I am running a messaging configuration with the JBOSS server.


      Any clues as to what is going wrong?

      thanks,
      Anuj


        • 1. Re: A simple JMS Client won't work - Errors with different j
          timfox

          Is this a stand-alone client?

          Also need to make sure you are using the latest jboss-messaging-client everywhere and it is on your client classpath *before* any other jars

          • 2. Re: A simple JMS Client won't work - Errors with different j
            anshah1

            Yes it is a stand alone client. It seems changing the order of jbossall-client.jar and jboss-messaging-client.jar helped upto some extent. Now there's no exception nothing however my client simply hangs. It gets through "Looking up queue::" step and that's about it.

            It won't go any further??

            Thanks.
            Anuj

            • 3. Re: A simple JMS Client won't work - Errors with different j
              anshah1

              Sorry hit submit too fast. On the server I can see errors of this sort.

              java.net.SocketTimeoutException: Read timed out
              at java.net.SocketInputStream.socketRead0(Native Method)
              at java.net.SocketInputStream.read(SocketInputStream.java:129)
              at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
              at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
              at java.io.FilterInputStream.read(FilterInputStream.java:66)
              at org.jboss.serial.io.JBossObjectInputStream.read(JBossObjectInputStream.java:126)
              at org.jboss.remoting.transport.socket.ServerThread.readVersion(ServerThread.java:464)
              at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:381)
              at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:484)
              at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:240)
              10:12:46,350 ERROR [ServerThread] failed to process invocation.

              • 4. Re: A simple JMS Client won't work - Errors with different j
                timfox

                I don't really understand why you're including jbossall-client.jar on your classpath.

                What is it in there that you want?

                • 5. Re: A simple JMS Client won't work - Errors with different j
                  timfox

                  What version jboss messaging are you using on the server?

                  Are you running a standalone server or inside JBoss AS?

                  If inside JBoss AS what version of JBoss AS are you running?

                  Also, have you tried running the examples?

                  • 6. Re: A simple JMS Client won't work - Errors with different j
                    timfox

                    Also, can you hit CTRL-BREAK (windows), SIGQUIT (kill -3) (unix/linux), on the client to get a stack dump when it's hung, and post the relevant results.

                    • 7. Re: A simple JMS Client won't work - Errors with different j
                      anshah1

                      I am using jboss-4.0.3SP1 AS. I am not using a stand-alone messaging server. The messaging version is I am using is from JBoss Messaging 1.0.0.GA.

                      I did not find any jboss-messaging-client.jar file in this distribution so to speak. There exists a jboss-messaging-client-scoped.jar in this directory. Should I be using this one?

                      I downloaded the jboss-messaging-1.0.1.CR1 distribution and am using the jboss-messaging-client.jar file present there in.

                      I tried running examples and they went through just fine. Finally, I run my client in this manner.

                      java -cp ..\lib\jboss-messaging-client.jar;..\lib\jbossall-client.jar;C:\jboss-4.0.3SP1\client\jboss-j2ee.jar;. polygraph/PolygraphMessageProducer

                      This still hangs and here's the complete stack dump..

                      Looking up:: JBossQueue[A]
                      Full thread dump Java HotSpot(TM) Client VM (1.5.0_06-b05 mixed mode):
                      
                      "SocketServerInvoker#0-3474" prio=6 tid=0x02ec5e18 nid=0x1594 runnable [0x030ef000..0x030efa68]
                       at java.net.PlainSocketImpl.socketAccept(Native Method)
                       at java.net.PlainSocketImpl.accept(Unknown Source)
                       - locked <0x070900a8> (a java.net.SocksSocketImpl)
                       at java.net.ServerSocket.implAccept(Unknown Source)
                       at java.net.ServerSocket.accept(Unknown Source)
                       at org.jboss.remoting.transport.socket.SocketServerInvoker.run(SocketServerInvoker.java:383)
                       at java.lang.Thread.run(Unknown Source)
                      
                      "RMI ConnectionExpiration-[130.20.106.144:1098]" daemon prio=6 tid=0x02e87b98 nid=0x48c waiting on condition [0x030af000..0x030afae8]
                       at java.lang.Thread.sleep(Native Method)
                       at sun.rmi.transport.tcp.TCPChannel$Reaper.run(Unknown Source)
                       at java.lang.Thread.run(Unknown Source)
                      
                      "GC Daemon" daemon prio=2 tid=0x02dc0a58 nid=0xb0 in Object.wait() [0x0306f000..0x0306fb68]
                       at java.lang.Object.wait(Native Method)
                       - waiting on <0x07509880> (a sun.misc.GC$LatencyLock)
                       at sun.misc.GC$Daemon.run(Unknown Source)
                       - locked <0x07509880> (a sun.misc.GC$LatencyLock)
                      
                      "RMI RenewClean-[130.20.106.144:1098]" daemon prio=6 tid=0x02e01ce0 nid=0xb84 in Object.wait() [0x0302f000..0x0302fbe8]
                       at java.lang.Object.wait(Native Method)
                       - waiting on <0x07509530> (a java.lang.ref.ReferenceQueue$Lock)
                       at java.lang.ref.ReferenceQueue.remove(Unknown Source)
                       - locked <0x07509530> (a java.lang.ref.ReferenceQueue$Lock)
                       at sun.rmi.transport.DGCClient$EndpointEntry$RenewCleanThread.run(Unknown Source)
                       at java.lang.Thread.run(Unknown Source)
                      
                      "Low Memory Detector" daemon prio=6 tid=0x00b72778 nid=0x1778 runnable [0x00000000..0x00000000]
                      
                      "CompilerThread0" daemon prio=10 tid=0x00b71478 nid=0x490 waiting on condition [0x00000000..0x02cefa4c]
                      
                      "Signal Dispatcher" daemon prio=10 tid=0x00b70828 nid=0x4a0 waiting on condition [0x00000000..0x00000000]
                      
                      "Finalizer" daemon prio=8 tid=0x00b673c8 nid=0xbb8 in Object.wait() [0x02c6f000..0x02c6fa68]
                       at java.lang.Object.wait(Native Method)
                       - waiting on <0x074fab68> (a java.lang.ref.ReferenceQueue$Lock)
                       at java.lang.ref.ReferenceQueue.remove(Unknown Source)
                       - locked <0x074fab68> (a java.lang.ref.ReferenceQueue$Lock)
                       at java.lang.ref.ReferenceQueue.remove(Unknown Source)
                       at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)
                      
                      "Reference Handler" daemon prio=10 tid=0x00b65f30 nid=0x10a4 in Object.wait() [0x02c2f000..0x02c2fae8]
                       at java.lang.Object.wait(Native Method)
                       - waiting on <0x074fabe8> (a java.lang.ref.Reference$Lock)
                       at java.lang.Object.wait(Unknown Source)
                       at java.lang.ref.Reference$ReferenceHandler.run(Unknown Source)
                       - locked <0x074fabe8> (a java.lang.ref.Reference$Lock)
                      
                      "main" prio=6 tid=0x003a6950 nid=0x230 runnable [0x0007f000..0x0007fc40]
                       at java.net.SocketInputStream.socketRead0(Native Method)
                       at java.net.SocketInputStream.read(Unknown Source)
                       at java.io.BufferedInputStream.fill(Unknown Source)
                       at java.io.BufferedInputStream.read1(Unknown Source)
                       at java.io.BufferedInputStream.read(Unknown Source)
                       - locked <0x07001868> (a java.io.BufferedInputStream)
                       at java.io.FilterInputStream.read(Unknown Source)
                       at org.jboss.serial.io.JBossObjectInputStream.checkSignature(JBossObjectInputStream.java:84)
                       at org.jboss.serial.io.JBossObjectInputStream.<init>(JBossObjectInputStream.java:68)
                       at org.jboss.serial.io.JBossObjectInputStream.<init>(JBossObjectInputStream.java:57)
                       at org.jboss.remoting.serialization.impl.jboss.JBossSerializationManager.createInput(JBossSerializationManager.java:57)
                       at org.jboss.remoting.transport.socket.ClientSocketWrapper.createInputStream(ClientSocketWrapper.java:83)
                       at org.jboss.remoting.transport.socket.ClientSocketWrapper.createStreams(ClientSocketWrapper.java:76)
                       at org.jboss.remoting.transport.socket.ClientSocketWrapper.<init>(ClientSocketWrapper.java:54)
                       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                       at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
                       at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
                       at java.lang.reflect.Constructor.newInstance(Unknown Source)
                       at org.jboss.remoting.transport.socket.SocketClientInvoker.createClientSocket(SocketClientInvoker.java:583)
                       at org.jboss.remoting.transport.socket.SocketClientInvoker.getConnection(SocketClientInvoker.java:550)
                       at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:263)
                       at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:143)
                       at org.jboss.remoting.Client.invoke(Client.java:527)
                       at org.jboss.remoting.Client.addListener(Client.java:722)
                       at org.jboss.remoting.Client.addListener(Client.java:687)
                       at org.jboss.jms.client.remoting.JMSRemotingConnection.setUpConnection(JMSRemotingConnection.java:266)
                       at org.jboss.jms.client.remoting.JMSRemotingConnection.<init>(JMSRemotingConnection.java:103)
                       at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.getRemotingConnection(ClientConnectionFactoryDelegate.java:237)
                       at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.invoke(ClientConnectionFactoryDelegate.java:179)
                       - locked <0x07531b30> (a org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate)
                       at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate$getClientAOPConfig_8697532701842707646.invokeNext(ClientConnectionFactoryDelegate$getClientAOPConfig_8697532701842707646.java)
                       at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.getClientAOPConfig(ClientConnectionFactoryDelegate.java)
                       at org.jboss.jms.client.JBossConnectionFactory.ensureAOPConfigLoaded(JBossConnectionFactory.java:220)
                       - locked <0x0b2fc980> (a java.lang.Class)
                       at org.jboss.jms.client.JBossConnectionFactory.createConnectionInternal(JBossConnectionFactory.java:183)
                       at org.jboss.jms.client.JBossConnectionFactory.createQueueConnection(JBossConnectionFactory.java:105)
                       at org.jboss.jms.client.JBossConnectionFactory.createQueueConnection(JBossConnectionFactory.java:100)
                       at polygraph.PolygraphMessageProducer.main(PolygraphMessageProducer.java:31)
                      
                      "VM Thread" prio=10 tid=0x00b61d90 nid=0x16e8 runnable
                      
                      "VM Periodic Task Thread" prio=10 tid=0x00b70710 nid=0x1568 waiting on condition
                      
                      



                      Thanks,
                      Anuj


                      • 8. Re: A simple JMS Client won't work - Errors with different j
                        timfox
                        • 9. Re: A simple JMS Client won't work - Errors with different j
                          oreddy

                          Please remove All other jars from your classpath except jboss-messaging-client.jar. It will work fine

                          • 10. Re: A simple JMS Client won't work - Errors with different j
                            dv_lakshmi

                            I am facing the same problem. I get a

                            java.lang.NoSuchFieldError: doPruning

                            when I execute my jms client program. I have only jboss-messaging-client on the classpath.

                            • 11. Re: A simple JMS Client won't work - Errors with different j
                              timfox

                              How is this the same problem?

                              • 12. Re: A simple JMS Client won't work - Errors with different j
                                dv_lakshmi

                                I am able to resolve the exception i posted in the previous message reading another post which suggested placing jboss-messaging-client.jar in server/server-name/lib folder.

                                However, I have another problem looking up an XA Connection factory from a jms client.

                                Heres my configuration.
                                Iam using jboss-4.0.3SP1 with jboss-messaging-1.0.1CR2. There is a requirement in my project that I configure a JMS XAConnectionFactory. I have configured the xa connection factory using JMSRA as instructed in wiki pages. These are the entries wmxjms-ds.xml which i have placed in deploy folder.

                                <connection-factories>
                                 <tx-connection-factory>
                                 <jndi-name>WMXQueueConnectionFactory</jndi-name>
                                 <use-java-context>false</use-java-context>
                                 <xa-transaction/>
                                 <rar-name>jms-ra.rar</rar-name>
                                 <connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>
                                 <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property>
                                 <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Queue</config-property>
                                 </tx-connection-factory>
                                </connection-factories>
                                


                                At server startup I can see the prints
                                14:30:43,296 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:name=WMXQueueConnectionFactory,servic
                                e=ConnectionFactoryBinding' to JNDI name 'WMXQueueConnectionFactory'

                                So I believe, the connection factory is correctly configurred. Now, when I am trying to lookup WMXQueueConnectionFactory from a stand alone jms client, lookup returns a "null". I have only jboss-messaging-client.jar in my classpath. Is there any configuration that I have done wrong ? I read in jboss wiki that by setting <use-java-context>false</use-java-context>, a jms client program running outside the jms context can lookup using the jndi name. However I am unable to do so. Any help in resolving this issue will be greatly appreciated

                                • 13. Re: A simple JMS Client won't work - Errors with different j
                                  timfox

                                  What are you looking the connection factory up as?

                                  Have you looked at JNDI viewer to see if it is there?

                                  http://wiki.jboss.org/wiki/Wiki.jsp?page=DisplayTheJDNITreeWithTheJMXConsole

                                  • 14. Re: A simple JMS Client won't work - Errors with different j
                                    dv_lakshmi

                                    Yes. The jndi name is available in the Global namespace.

                                    +- UserTransactionSessionFactory (proxy: $Proxy12 implements interface org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory)
                                     +- MailQueue (class: org.jboss.jms.destination.JBossQueue)
                                     +- WMXQueueConnectionFactory (class: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl)
                                     +- XAConnectionFactory (class: org.jboss.jms.client.JBossConnectionFactory)
                                     +- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)
                                     +- pramati_dmq (class: org.jboss.jms.destination.JBossQueue)
                                     +- queue (class: org.jnp.interfaces.NamingContext)
                                     | +- A (class: org.jboss.jms.destination.JBossQueue)
                                     | +- testQueue (class: org.jboss.jms.destination.JBossQueue
                                    


                                    1 2 3 Previous Next