I've googled on this error message, and don't know quite what to make of
it. In any event, some better code:
thufir@doge:~$
thufir@doge:~$ activemq status
INFO: Loading '/home/thufir/apache-activemq-5.11.1/bin/env'
INFO: Using java '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'
ActiveMQ not running
thufir@doge:~$
thufir@doge:~$ activemq start
INFO: Loading '/home/thufir/apache-activemq-5.11.1/bin/env'
INFO: Using java '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and
log4j.properties to get details
INFO: pidfile created :
'/home/thufir/apache-activemq-5.11.1/data/activemq.pid' (pid '18920')
thufir@doge:~$
thufir@doge:~$ activemq status
INFO: Loading '/home/thufir/apache-activemq-5.11.1/bin/env'
INFO: Using java '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'
ActiveMQ is running (pid '18920')
thufir@doge:~$
thufir@doge:~$ groovy IdeaProjects/groovy/src/jms.groovy
Caught: org.apache.activemq.ConnectionFailedException: The JMS
connection has failed: java.io.EOFException
org.apache.activemq.ConnectionFailedException: The JMS connection has
failed: java.io.EOFException
at
org.apache.activemq.ActiveMQConnection.checkClosedOrFailed(ActiveMQConnection.java:1480)
at
org.apache.activemq.ActiveMQConnection.start(ActiveMQConnection.java:523)
at net.sf.gtools.jms.JmsCategory.connect(JmsCategory.groovy:64)
at GroovyJMSExample$_sendMessage_closure1.doCall(jms.groovy:22)
at GroovyJMSExample$_sendMessage_closure1.doCall(jms.groovy)
at GroovyJMSExample.sendMessage(jms.groovy:20)
at GroovyJMSExample.main(jms.groovy:32)
Caused by: java.io.EOFException
at
org.apache.activemq.openwire.v10.BaseDataStreamMarshaller.looseUnmarshalConstByteArray(BaseDataStreamMarshaller.java:602)
at
org.apache.activemq.openwire.v10.WireFormatInfoMarshaller.looseUnmarshal(WireFormatInfoMarshaller.java:130)
at
org.apache.activemq.openwire.OpenWireFormat.doUnmarshal(OpenWireFormat.java:373)
at
org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:285)
at
org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:221)
at
org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:213)
at
org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:196)
thufir@doge:~$
thufir@doge:~$ cat IdeaProjects/groovy/src/hi.groovy
cat: IdeaProjects/groovy/src/hi.groovy: No such file or directory
thufir@doge:~$
thufir@doge:~$ cat IdeaProjects/groovy/src/jms.groovy
@Grapes([
@Grab(group = 'net.sf.gtools.jms', module = 'JmsCategory',
version = '0.2'),
@Grab(group = 'org.apache.activemq', module = 'activemq-all',
version = '5.9.0'),
@Grab(group = "junit", module = "junit", version = "4.11"),
@Grab(group = 'net.sf.gtools.jms', module = 'JmsCategory',
version = '0.2'),
@Grab(group = 'org.apache.activemq', module = 'activemq-all',
version = '5.9.0'),
@Grab(group = "junit", module = "junit", version = "4.11"),
@Grab(group = 'net.sf.gtools.jms', module = 'JmsCategory',
version = '0.2'),
@Grab(group = 'org.apache.activemq', module = 'activemq-all',
version = '5.9.0'),
@Grab(group = "junit", module = "junit", version = "4.11"),
@Grab(group = 'net.sf.gtools.jms', module = 'JmsCategory',
version = '0.2'),
@Grab(group = 'org.apache.activemq', module = 'activemq-all',
version = '5.9.0'),
@Grab(group = "junit", module = "junit", version = "4.11")
])
import net.sf.gtools.jms.JmsCategory
import org.apache.activemq.ActiveMQConnectionFactory
class GroovyJMSExample {
def static sendMessage() {
use(JmsCategory) {
def jms = new ActiveMQConnectionFactory('tcp://localhost:3700')
jms.connect { c ->
c.queue("TEST-queue") { q ->
def msg = createTextMessage("test")
q.send(msg)
}
}
}
}
static void main(String[] args) {
sendMessage()
}
}
thufir@doge:~$
adapted from:
http://stackoverflow.com/questions/19680276/