Forum Discussion

davegebhart's avatar
14 years ago

Problem building JMS Send Runner component

I am hitting a wall writing a custom runner component to send a JMS MapMessage. It doesn't help that there is very little feedback when something is amiss in the component; it just doesn't show up when you try to add it to the project, with no feedback whatsoever. At any rate, Here is what the problem is:

/**
* Runs a Test
*
* @name Test Runner
* @category runners
* @id com.mycompany.TestRunner
* @dependency org.springframework:spring-jms:3.0.4.RELEASE
* @dependency org.apache.activemq:activemq-pool:5.4.2-fuse-02-00
* @dependency javax.jms:jms:1.1
*/

import javax.jms.JMSException
import javax.jms.MapMessage
import javax.jms.Message
import javax.jms.Session

import org.springframework.jms.core.JmsTemplate
import org.springframework.jms.core.MessageCreator
import org.springframework.jms.JmsException
//import org.apache.activemq.pool.PooledConnectionFactory

import com.eviware.loadui.util.layout.DelayedFormattedString
import com.eviware.loadui.util.ReleasableUtils
import com.eviware.loadui.impl.component.categories.RunnerBase.SampleCancelledException
import com.eviware.loadui.impl.component.ActivityStrategies

import java.util.concurrent.TimeUnit


When the activemq import is uncommented, the component won't instantiate. Commented out, it shows up just fine. Any suggestions?

Thanks,

Dave
  • Hi Dave!

    Did you see the following paragraph in the Custom Components documentation? If so, did it help?
    Running loadUItest.bat instead of loadUI.bat will give you more (and more useful) error messages when your code for example doesn't parse correctly. Running loadUItest.bat currently requires you to have the JavaFX SDK installed, but we hope to be able to remove this requirement in the future.


    This is the error message that I get when running the code you provided as a loadUI component:
    08:28:46,655 DEBUG [Canvas] Component dropped at: (320.0, 522.0)
    08:28:46,659 DEBUG [Canvas] Creating ComponentItem from descriptor: com.eviware.loadui.groovy.GroovyBehaviorProvider$Scr
    iptDescriptor@16e23165 using label: Test Runner
    08:28:46,666 DEBUG [GroovyEnvironmentClassLoader] Loading dependency: org.springframework:spring-jms
    08:29:24,342 DEBUG [WorkspaceItemImpl] Ran Garbage Collection, Free Memory changed from 415302048 to 531278368, total me
    mory = 819003392
    08:29:25,183 DEBUG [GroovyEnvironmentClassLoader] Loading dependency: org.apache.activemq:activemq-pool
    08:29:27,538 ERROR [GroovyEnvironmentClassLoader] Error loading dependency: org.apache.activemq:activemq-pool using Grap
    e, fallback to manual JAR loading.
    java.lang.RuntimeException: Error grabbing Grapes -- [unresolved dependency: org.apache.activemq#activemq-pool;5.4.2-fus
    e-02-00: not found]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
    at org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke(CachedConstructor.java:71)
    at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrap.callConstructor(ConstructorSite.
    java:81)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:54)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
    at groovy.grape.GrapeIvy.getDependencies(GrapeIvy.groovy:336)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:2
    26)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:52)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:57)
    at groovy.grape.GrapeIvy.resolve(GrapeIvy.groovy:463)
    at groovy.grape.GrapeIvy$resolve$0.callCurrent(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
    at groovy.grape.GrapeIvy$resolve$0.callCurrent(Unknown Source)
    at groovy.grape.GrapeIvy.resolve(GrapeIvy.groovy:432)
    at groovy.grape.GrapeIvy$resolve.callCurrent(Unknown Source)
    at groovy.grape.GrapeIvy.grab(GrapeIvy.groovy:248)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:2
    26)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:52)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:145)
    at groovy.grape.GrapeIvy.grab(GrapeIvy.groovy:230)
    at groovy.grape.Grape.grab(Grape.java:129)
    at com.eviware.loadui.util.groovy.GroovyEnvironmentClassLoader.loadDependency(GroovyEnvironmentClassLoader.java:
    76)
    at com.eviware.loadui.util.groovy.GroovyEnvironment.init(GroovyEnvironment.java:95)
    at com.eviware.loadui.groovy.GroovyBehaviorSupport.updateScript(GroovyBehaviorSupport.java:124)
    at com.eviware.loadui.groovy.GroovyBehaviorSupport.<init>(GroovyBehaviorSupport.java:96)
    at com.eviware.loadui.groovy.categories.GroovyRunner.<init>(GroovyRunner.java:41)
    at com.eviware.loadui.groovy.GroovyBehaviorProvider.instantiateBehavior(GroovyBehaviorProvider.java:197)
    at com.eviware.loadui.groovy.GroovyBehaviorProvider.createBehavior(GroovyBehaviorProvider.java:133)
    at com.eviware.loadui.impl.component.ComponentRegistryImpl.createBehavior(ComponentRegistryImpl.java:133)
    at com.eviware.loadui.impl.model.CanvasItemImpl.createComponent(CanvasItemImpl.java:285)
    at com.eviware.loadui.fx.widgets.canvas.Canvas.createComponent(Canvas.fx:272)
    at com.eviware.loadui.fx.widgets.canvas.Canvas$1Local$80.invoke$(Canvas.fx:237)
    at com.sun.javafx.functions.Function0.invoke(Function0.java:44)
    at com.sun.javafx.functions.Function0.invoke$(Function0.java:38)
    at com.eviware.loadui.fx.async.BlockingTask$TaskRunnable.run(BlockingTask.fx:37)
    at com.eviware.loadui.fx.async.RunnableRunnableFuture.run(RunnableRunnableFuture.java:32)
    at com.sun.javafx.async.TaskImpl.run(TaskImpl.java:66)
    at com.sun.javafx.async.desktop.DesktopTaskManager$IOCallable.call(DesktopTaskManager.java:65)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    08:29:27,551 ERROR [GroovyEnvironmentClassLoader] File: C:\Users\Henrik\.loadui\.groovy\grapes\org.apache.activemq\activ
    emq-pool\jars\activemq-pool-5.4.2-fuse-02-00.jar doesn't exist, dependency loading failed.


    So, the problem is that loadUI (or rather Groovy) couldn't find that version of activemq in Maven Central (or any other repository), and you didn't provide a local jar file either. Browsing Maven Central's entry for activemq reveals that there's no such version there as 5.4.2-fuse-02-00 (but there is a regulare 5.4.2).

    So your options are to either switch to another version (maybe 5.4.2), provide a local jar-file or upload activemq-pool:5.4.2-fuse-02-00 to your own repository.

    Regards

    Henrik
    SmartBear Software