[
https://issues.apache.org/jira/browse/AMQ-5676?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
narayana b updated AMQ-5676:
----------------------------
Description:
=========================================
ActiveMQ and tomcat hosted on the same machine
=========================================
Unable to create ConnectionFactory from activemq web console.
==== PLEASE PROVIDE DETAILED INFORMATION, how to create queue, topic ,
connection factory which is permanent on activemq ====
http://localhost:8161
Queue - Able to create, after restart this queue removed
Topic - Able to create, after restart this queue removed
ConnectionFactory - Unable to create - no option provided
How to create ConnectionFactory in the activemq.xml?, please tell me
Im connecting from Tomcat Application to Activemq but on
i have activemq client libs in tomcat, configured conection factory, queue,
topic on tomcat resource but unable to create on activemq - ConnectionFactory
this is the issue
==========
context.xml
==========
<Resource name="jms/ConnectionFactory" auth="Container"
type="org.apache.activemq.ActiveMQConnectionFactory" description="JMS
connection factory" factory="org.apache.activemq.jndi.JNDIReferenceFactory"
brokerURL="tcp://localhost.localdomain:61616" brokerName="ActiveMQBroker"
useEmbeddedBroker="false" />
<Resource name="jms/topic/MyTopic" auth="Container"
type="org.apache.activemq.command.ActiveMQTopic"
factory="org.apache.activemq.jndi.JNDIReferenceFactory"
physicalName="APP.JMS.TOPIC" />
<Resource name="jms/queue/MyQueue" auth="Container"
type="org.apache.activemq.command.ActiveMQQueue"
factory="org.apache.activemq.jndi.JNDIReferenceFactory"
physicalName="APP.JMS.QUEUE" /
==========
web.xml
==========
<resource-ref>
<description>ConnectionFactory</description>
<res-ref-name>jms/ConnectionFactory</res-ref-name>
<res-type>org.apache.activemq.ActiveMQConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<description>Topic</description>
<res-ref-name>jms/topic/MyTopic</res-ref-name>
<res-type>javax.jms.Topic</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<description>Queue</description>
<res-ref-name>jms/queue/MyQueue</res-ref-name>
<res-type>javax.jms.Queue</res-type>
<res-auth>Container</res-auth>
</resource-ref>
=========
jmsSend.jsp
=========
<%@page import="javax.naming.*, javax.jms.*, java.util.*" %>
<%
try{
Properties props = new Properties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.apache.activemq.jndi.ActiveMQInitialContextFactory");
props.setProperty(Context.PROVIDER_URL,"tcp://127.0.0.1:61616");
InitialContext initCtx = new InitialContext(props);
Context envContext = (Context) initCtx.lookup("java:comp/env");
ConnectionFactory connectionFactory = (ConnectionFactory)
envContext.lookup("jms/ConnectionFactory");
Connection connection = connectionFactory.createConnection();
Session ss = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Destination destination = ss.createTopic("jms/topic/MyTopic");
MessageProducer producer = ss.createProducer(destination);
TextMessage msg=ss.createTextMessage();
msg.setText("Message sent");
out.println("Message sent successfully");
producer.send(msg);
}catch(Exception e){
e.printStackTrace();
}
%>
==========
tomcat - logs
===========
javax.naming.NamingException: Cannot create resource instance
was:
Unable to create ConnectionFactory from activemq web console.
==== PLEASE PROVIDE DETAILED INFORMATION, how to create queue, topic ,
connection factory which is permanent on activemq ====
http://localhost:8161
Queue - Able to create, after restart this queue removed
Topic - Able to create, after restart this queue removed
ConnectionFactory - Unable to create - no option provided
How to create ConnectionFactory in the activemq.xml?, please tell me
Im connecting from Tomcat Application to Activemq but on
i have activemq client libs in tomcat, configured conection factory, queue,
topic on tomcat resource but unable to create on activemq - ConnectionFactory
this is the issue
==========
context.xml
==========
<Resource name="jms/ConnectionFactory" auth="Container"
type="org.apache.activemq.ActiveMQConnectionFactory" description="JMS
connection factory" factory="org.apache.activemq.jndi.JNDIReferenceFactory"
brokerURL="tcp://localhost.localdomain:61616" brokerName="ActiveMQBroker"
useEmbeddedBroker="false" />
<Resource name="jms/topic/MyTopic" auth="Container"
type="org.apache.activemq.command.ActiveMQTopic"
factory="org.apache.activemq.jndi.JNDIReferenceFactory"
physicalName="APP.JMS.TOPIC" />
<Resource name="jms/queue/MyQueue" auth="Container"
type="org.apache.activemq.command.ActiveMQQueue"
factory="org.apache.activemq.jndi.JNDIReferenceFactory"
physicalName="APP.JMS.QUEUE" /
==========
web.xml
==========
<resource-ref>
<description>ConnectionFactory</description>
<res-ref-name>jms/ConnectionFactory</res-ref-name>
<res-type>org.apache.activemq.ActiveMQConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<description>Topic</description>
<res-ref-name>jms/topic/MyTopic</res-ref-name>
<res-type>javax.jms.Topic</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<description>Queue</description>
<res-ref-name>jms/queue/MyQueue</res-ref-name>
<res-type>javax.jms.Queue</res-type>
<res-auth>Container</res-auth>
</resource-ref>
=========
jmsSend.jsp
=========
<%@page import="javax.naming.*, javax.jms.*, java.util.*" %>
<%
try{
Properties props = new Properties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.apache.activemq.jndi.ActiveMQInitialContextFactory");
props.setProperty(Context.PROVIDER_URL,"tcp://127.0.0.1:61616");
InitialContext initCtx = new InitialContext(props);
Context envContext = (Context) initCtx.lookup("java:comp/env");
ConnectionFactory connectionFactory = (ConnectionFactory)
envContext.lookup("jms/ConnectionFactory");
Connection connection = connectionFactory.createConnection();
Session ss = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Destination destination = ss.createTopic("jms/topic/MyTopic");
MessageProducer producer = ss.createProducer(destination);
TextMessage msg=ss.createTextMessage();
msg.setText("Message sent");
out.println("Message sent successfully");
producer.send(msg);
}catch(Exception e){
e.printStackTrace();
}
%>
==========
tomcat - logs
===========
javax.naming.NamingException: Cannot create resource instance
> Unable to create ConnectionFactory from admin page
> --------------------------------------------------
>
> Key: AMQ-5676
> URL: https://issues.apache.org/jira/browse/AMQ-5676
> Project: ActiveMQ
> Issue Type: Bug
> Components: webconsole
> Affects Versions: 5.11.1
> Environment: Linux 32 bit centos 6.4
> oracle java 7
> Reporter: narayana b
>
> =========================================
> ActiveMQ and tomcat hosted on the same machine
> =========================================
> Unable to create ConnectionFactory from activemq web console.
> ==== PLEASE PROVIDE DETAILED INFORMATION, how to create queue, topic ,
> connection factory which is permanent on activemq ====
> http://localhost:8161
> Queue - Able to create, after restart this queue removed
> Topic - Able to create, after restart this queue removed
> ConnectionFactory - Unable to create - no option provided
> How to create ConnectionFactory in the activemq.xml?, please tell me
> Im connecting from Tomcat Application to Activemq but on
> i have activemq client libs in tomcat, configured conection factory, queue,
> topic on tomcat resource but unable to create on activemq - ConnectionFactory
> this is the issue
> ==========
> context.xml
> ==========
> <Resource name="jms/ConnectionFactory" auth="Container"
> type="org.apache.activemq.ActiveMQConnectionFactory" description="JMS
> connection factory" factory="org.apache.activemq.jndi.JNDIReferenceFactory"
> brokerURL="tcp://localhost.localdomain:61616" brokerName="ActiveMQBroker"
> useEmbeddedBroker="false" />
>
> <Resource name="jms/topic/MyTopic" auth="Container"
> type="org.apache.activemq.command.ActiveMQTopic"
> factory="org.apache.activemq.jndi.JNDIReferenceFactory"
> physicalName="APP.JMS.TOPIC" />
>
> <Resource name="jms/queue/MyQueue" auth="Container"
> type="org.apache.activemq.command.ActiveMQQueue"
> factory="org.apache.activemq.jndi.JNDIReferenceFactory"
> physicalName="APP.JMS.QUEUE" /
> ==========
> web.xml
> ==========
> <resource-ref>
> <description>ConnectionFactory</description>
> <res-ref-name>jms/ConnectionFactory</res-ref-name>
> <res-type>org.apache.activemq.ActiveMQConnectionFactory</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>
> <resource-ref>
> <description>Topic</description>
> <res-ref-name>jms/topic/MyTopic</res-ref-name>
> <res-type>javax.jms.Topic</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>
> <resource-ref>
> <description>Queue</description>
> <res-ref-name>jms/queue/MyQueue</res-ref-name>
> <res-type>javax.jms.Queue</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>
> =========
> jmsSend.jsp
> =========
> <%@page import="javax.naming.*, javax.jms.*, java.util.*" %>
> <%
> try{
> Properties props = new Properties();
> props.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.apache.activemq.jndi.ActiveMQInitialContextFactory");
> props.setProperty(Context.PROVIDER_URL,"tcp://127.0.0.1:61616");
> InitialContext initCtx = new InitialContext(props);
> Context envContext = (Context) initCtx.lookup("java:comp/env");
> ConnectionFactory connectionFactory = (ConnectionFactory)
> envContext.lookup("jms/ConnectionFactory");
> Connection connection = connectionFactory.createConnection();
> Session ss = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
> Destination destination = ss.createTopic("jms/topic/MyTopic");
> MessageProducer producer = ss.createProducer(destination);
> TextMessage msg=ss.createTextMessage();
> msg.setText("Message sent");
> out.println("Message sent successfully");
> producer.send(msg);
> }catch(Exception e){
> e.printStackTrace();
> }
> %>
> ==========
> tomcat - logs
> ===========
> javax.naming.NamingException: Cannot create resource instance
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)