11 Replies Latest reply on Jan 9, 2017 7:01 AM by mnovak

    Unable to post message from client(JDK 1.6) to Wildfly 10.1.0

    sherrifa

      Hi,

       

      We are trying to upgrade the server from JBoss 7.1.1 to Wildfly 10.1.0. The client application that we use is JDK 1.6.

      When we try to post the message to wildfly 10.1.0, the error "java.lang.NoClassDefFoundError: org/apache/activemq/artemis/api/core/TransportConfiguration" flashes.

       

      We are using the jboss-client.jar of wildfly 10.1.0.  org/apache/activemq/artemis/api/core/TransportConfiguration is not found.

       

      Am able to successfully post the message from standalone stub  which is built on jdk 1.6 to wildlfy 10.1.0. But the same cannot be posted using client application (jdk 1.6)

       

      Thanks,

      Sherrifa

        • 1. Re: Unable to post message from client(JDK 1.6) to Wildfly 10.1.0
          ctomc

          jars build for WildFly 10 and shipped with WildFly 10 *all* require JDK8 to be run on.

          • 2. Re: Unable to post message from client(JDK 1.6) to Wildfly 10.1.0
            sherrifa

            Hey Tomaz,

             

            Thanks for the reply.

             

            I had created a standalone program that is compiled using jdk 1.6 and pointed home path to java 6. Am able to post messages to wildfly10.1.0 server.

            But when I try to give request using my client application which is also built on java 6 am getting the error "java.lang.NoClassDefFoundError". This is the standalone class that I am using to post messages and this is able to post messages. I can see the message count for every time I run this program.

             

            public static void main(String[] args) {

             

            try {

                   Map<String, Object> connectionParams = new HashMap<String, Object>();

                   connectionParams.put(org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.PORT_PROP_NAME,5445);

                   TransportConfiguration transportConfiguration = new TransportConfiguration(  NettyConnectorFactory.class.getName(), connectionParams);

                   ConnectionFactory cf = ActiveMQJMSClient .createConnectionFactoryWithoutHA(JMSFactoryType.QUEUE_CF,  transportConfiguration);

                  Queue orderQueue = ActiveMQJMSClient.createQueue("TestQ");

                  Connection connection = cf .createConnection("wildfly", "wildfly10$");

                  Session session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE);

                   MessageProducer producer = session.createProducer(orderQueue);

                   connection.start();

                   TextMessage message = session.createTextMessage("This is the sceond msg");

                    producer.send(message);

                    session.close();

                   connection.close();

                  System.out.println("message posted");

                   } catch (Exception e) {

                   System.out.println("Caught: " + e);

                   e.printStackTrace();

                   }

            }

             

            Thanks,

            Sherrifa

            • 3. Re: Unable to post message from client(JDK 1.6) to Wildfly 10.1.0
              mnovak

              Hi Sherrifa,

               

              could you double check that you're having the right jboss-client.jar? Could you share your standalone...xml?

               

              I tried your code and it's working. I can send message using it.

               

              Thanks,

              Mirek

              • 4. Re: Unable to post message from client(JDK 1.6) to Wildfly 10.1.0
                sherrifa

                Hi Novak,

                 

                Thanks for the reply.

                 

                As mentioned earlier, I am able to post the message using the above code from my local (jdk 1.6) to wildlfy10.1.0 but not when merged with the client application which is built on jdk 1.6. When I try to hit the wildfly server from client application am getting the error "java.lang.NoClassDefFoundError".

                 

                 

                And I have double checked that I am using the right jboss-client jar. Here is the standalone xml which is used.

                 

                Thanks,

                Sherrifa

                • 5. Re: Unable to post message from client(JDK 1.6) to Wildfly 10.1.0
                  mnovak

                  Hi Sherrifa,

                   

                  so you can build it but when trying to execute then there is NoClassDefFoundError. Could you check your build and runtime dependencies differences? If it's in maven then mvn dependency:tree should provide those information.

                   

                  Thanks,

                  Mirek

                  • 6. Re: Unable to post message from client(JDK 1.6) to Wildfly 10.1.0
                    sherrifa

                    Hi Mirek,

                     

                    Yes. Am building and running it in 1.6 in my local and able to post successfully. But the same (compile and run it in 1.6) from my client application is not posting. And its not in Maven.

                    • 7. Re: Unable to post message from client(JDK 1.6) to Wildfly 10.1.0
                      mnovak

                      I checked the version of classes in jboss-client.jar and some have version of 50 (which is JDK 1.6) and others are newer.  Class org/apache/activemq/artemis/api/core/TransportConfiguration.class has version 51 which is JDK 1.7. This might be the reason why it's not found and NoClassDefFound is thrown when you running with JDK 1.6.

                       

                      Note that JDK 1.8 is minimum requirement for running client application with jboss-client.jar for WF10.x.x. Could you try with JDK 8?

                       

                      Thanks,

                      Mirek

                      • 8. Re: Unable to post message from client(JDK 1.6) to Wildfly 10.1.0
                        sherrifa

                        The challenge here is my client application is a legacy system which is built on 1.6. Anyways if that is the case, then the same error  "java.lang.NoClassDefFoundError" should be thrown when I post from my local as well since it is 1.6. I checked the java home in my system, it is set to 1.6 and I am compiling the standalone test program using 1.6 and my messages are posted successfully from my local. That is where I am confused.

                         

                        Thanks,

                        Sherrifa

                        • 9. Re: Unable to post message from client(JDK 1.6) to Wildfly 10.1.0
                          mnovak

                          JDK 8 is backward compatible. For sure it can execute programs built with JDK 1.6. Do you see NoClassDefFoundError when running with JDK 8?

                           

                          Thanks,

                          Mirek

                          • 10. Re: Unable to post message from client(JDK 1.6) to Wildfly 10.1.0
                            sherrifa

                            I am able to post messages from my local standalone program whose runtime is 1.8 (java home 1.8) and complied using 1.7. I am not facing any issues. From my local standalone program to wildfly I did not encounter any issue be it 1.6 or 1.8.

                             

                            Thanks,

                            Sherrifa

                            • 11. Re: Unable to post message from client(JDK 1.6) to Wildfly 10.1.0
                              mnovak

                              If local standalone program is working and legacy system is not then how do they differ? Do you have a reproducer?

                               

                              Mirek