Skip to content

ActiveMQ setup – Unable to send the message to Queue (error – Unknown data type: 47)

I have installed ActiveMQ and could access the url at – http://localhost:8161/admin/queues.jsp. When I try to drop a message to a queue I am getting the below error.

The sample code is given below:

public class MessageReceiver {
    public static void main(String[] args) throws JMSException {
          ApplicationContext context = new ClassPathXmlApplicationContext("spring-beans.xml");
          JmsTemplate jmsTemplate=(JmsTemplate) context.getBean("jmsTemplate");
                new MessageCreator() {
                      public ObjectMessage  createMessage(Session session) throws JMSException {
                          ObjectMessage message = session.createObjectMessage();
                          message.setObject("My first Message");                      
                           return message;

    }  );

      System.out.println("MESSAGE SENT TO myMessageQueue");
      Message receivedMessage=jmsTemplate.receive("queue");
      ObjectMessage msg = (ObjectMessage)receivedMessage;
      System.out.println("Message Received :"+msg.getObject().toString());


Spring xml is:

<bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
    <property name="brokerURL">
    <property name="userName">
    <property name="password">
<bean id="destination" class="org.apache.activemq.command.ActiveMQQueue">
    <constructor-arg value="queue" />
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory" ref="connectionFactory" />
    <property name="defaultDestination" ref="destination" />

Error is:

log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardEnvironment).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See for more info.
Exception in thread "main" org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is javax.jms.JMSException: Unknown data type: 47
    at org.springframework.jms.core.JmsTemplate.execute(
    at org.springframework.jms.core.JmsTemplate.send(
    at org.springframework.jms.core.JmsTemplate.send(
    at com.example.example.MessageReceiver.main(
Caused by: javax.jms.JMSException: Unknown data type: 47
    at org.apache.activemq.util.JMSExceptionSupport.create(
    at org.apache.activemq.ActiveMQConnection.syncSendPacket(
    at org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(
    at org.apache.activemq.ActiveMQConnection.createSession(
    at org.springframework.jms.core.JmsTemplate.execute(
    ... 3 more
Caused by: Unknown data type: 47
    at org.apache.activemq.openwire.OpenWireFormat.doUnmarshal(
    at org.apache.activemq.openwire.OpenWireFormat.unmarshal(
    at org.apache.activemq.transport.tcp.TcpTransport.readCommand(
    at org.apache.activemq.transport.tcp.TcpTransport.doRun(


The ‘Unknown data type: 47’ error is due to the configuration you are using for the following broker URL:


The problem is that the port number is incorrect. Port 8161 is where the embedded ActiveMQ web server runs, and therefore where you can access the web console. This explains the error message and stack trace that you’re seeing. Whenever you visit the web console for the broker at this address (*:8161) the exception is thrown.

To fix the problem, change the port number to the port on which the ActiveMQ TCP transport is listening. I hazard a guess that it is probably the default port number of 61616.