5 Replies Latest reply on Feb 21, 2012 1:46 PM by rimarvladimir

    Groovy script not found on classpath

    rimarvladimir

      Hello all,

       

      I'm trying to implement a Groovy message listener based on documentation found in 7.2.  Scheduling of Services under http://docs.redhat.com/docs/en-US/JBoss_Enterprise_SOA_Platform/5/html/ESB_Programmers_Guide/chap-SOA_ESB_Programmers_Guide-Advanced_Topics.html

       

      As a proof of concept, I have tried to use the sample code from documentation. My current project setup can be seen on the picture below:

      jboss-esb.PNG

       

      The files OrderLister.java and OrderListener.groovy have pretty much the same content as in the sample code from documentation. I have only changed the import in OrderListener.groovy.

       

      After deploying this on JBoss, I'm getting the following exception:

       

      Caused by: org.jboss.soa.esb.ConfigurationException: Error loading Groovy script '/com/frox/itsm/cmdb/integrator/ncinv/OrderListener.groovy' stream.

                at org.jboss.soa.esb.listeners.gateway.GroovyGateway.<init>(GroovyGateway.java:101)

                ... 100 more

      Caused by: java.io.IOException: Script '/com/frox/itsm/cmdb/integrator/ncinv/OrderListener.groovy' not found on classpath.

                at org.jboss.soa.esb.actions.scripting.GroovyActionProcessor.getScriptFromClasspath(GroovyActionProcessor.java:109)

                at org.jboss.soa.esb.listeners.gateway.GroovyGateway.<init>(GroovyGateway.java:99)

                ... 100 more



      Can someone advise me, what am I doing wrong here? Thanks for answers, I really appreciate it.

       

      Vladimir


        • 1. Re: Groovy script not found on classpath
          mimra

          Hi Vladimir

           

          I haven't tried this, so I'm guessing; but the Redhat documentation uses a starting "/" in the script attribute:

           

                      <listeners>
                          <groovy-listener name="orderJmsListener" script="/com/acme/OrderListener.groovy">
                              <property name="queueName" value="..."/>
                          </groovy-listener>
                      </listeners>

          Have you tried that?

           

          /Michael

          • 2. Re: Groovy script not found on classpath
            rimarvladimir

            Actually, I have tried with a starting "/" and also without. In both case, I'm getting the same exception

            • 3. Re: Groovy script not found on classpath
              tcunning

              I'm not sure what's going on here, but the groovy_gateway quickstart does the same exact thing.      If you want an example to compare against to see where your error may be, check that example out.

               

              What does the jar tvf <youresbname>.esb look like?

              • 4. Re: Groovy script not found on classpath
                rimarvladimir

                Hi Tom,

                 

                I have tried the sample groovy_gateway and seems to run without problems. I think there is some problem with the groovy script, the exception seems to be misleading, becasue it works correctly with MessageInjectionConsole script. I have no experience with Groovy, I will have a closer look if the syntax is correct.

                 

                import com.frox.itsm.cmdb.integrator.ncinv.OrderListener;

                 

                OrderListener orderListener = new OrderListener();

                 

                // Start the listener (passing the config)...

                orderListener.start(config);

                 

                // Wait until the Groovy Gateway is signaled to stop...

                def stopped = false;

                while(!stopped) {

                    stopped = gateway.waitUntilStopping(200);

                }

                 

                // Now stop the listener...

                orderListener.stop();

                • 5. Re: Groovy script not found on classpath
                  rimarvladimir

                  Ok, luckily I got it working ... Seems there was some problem with class loading, not sure what exaclty. I don't fully understand the groovy code, so I would like to ask the following:

                   

                  Is the connection to foreign queue permanent and every time a message is received, groovy calls onMessage?

                  OrderListener.java has also stop method, which is called from groovy. Is this necessarily? I would prefer a permanent subscription with a possibility to try and reconnect (infinite times), in case the queue is down.

                   

                   

                   

                  I'm trying to achieve the following: After server starts, it connects to a foreign JMS queue and listens for messages. If a message arrives, it transforms the message and sends it to a different system. Can you please advise me, if I need to make some changes to the groovy script.

                   

                  Thanks and regards,

                   

                  Vladimir