Thank you so much Mario for the link. I tried to use an embedded broker
with top connector.
An Exception was raised stating that
Could not connect to broker URL: vm:(broker:(tcp://localhost:61716)).
Reason: java.io.IOException: Failed to start database 'derbydb', see the
next exception for details.
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.
java:32)
org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(A
ctiveMQConnectionFactory.java:252)
org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(A
ctiveMQConnectionFactory.java:211)
org.apache.activemq.ActiveMQConnectionFactory.createTopicConnection(Acti
veMQConnectionFactory.java:188)
com.cisco.cpnm.common.messaging.jms.JmsEventSender.getConn(JmsEventSende
r.java:249)
The Context.xml has Active MQ connection Factory defined as follows
<Resource
name="jms/ConnectionFactory"
auth="Container"
type="org.apache.activemq.ActiveMQConnectionFactory"
description="JMS Connection Factory"
factory="org.apache.activemq.jndi.JNDIReferenceFactory"
brokerURL="vm:(broker:(tcp://localhost:61716))"
brokerName="LocalActiveMQBroker"
useEmbeddedBroker="true"
/>
The code for creating the Topic Connection is as follows :
private TopicConnection getConn() {
TopicConnectionFactory Herbiefactory = null;
javax.jms.TopicConnection HerbieTopic=null;
try{
Herbiefactory =
(TopicConnectionFactory)envContext.lookup("jms/ConnectionFactory");
// TopicConnection for subscribing and receiving events
HerbieTopic = Herbiefactory.createTopicConnection(); //
exception occurs at this line, I think the Herbie Factory is null , and
hence the exception
}
catch(Exception e){
logger.error("error in creating topic
ocnnection method "+e.getMessage());
}
return HerbieTopic;
}
I am not using activemq.xml , I would like mention all the broker
related configuration in the broker URI. The context.xml is present in
Tomcat/conf directory. Iam using active mq 4.0 is embedded broker
supported in this version ?
Any idea as to why the factory is becoming null ?
Thank you,
Suchitha.
-----Original Message-----
From: Mario Siegenthaler [mailto:msiegenthaler@inventsoft.ch]
Sent: Thursday, June 28, 2007 2:57 PM
To: users@activemq.apache.org
Subject: Re: access to embedded broker
Did you check the "Sharing embedded broker across webapp
contexts"-thread (last week)? This was the exact same problem and
serveral possible solutions (at least one of them I tested personally).
Easy way: put the activemq in the common/lib and just let the to webapps
connect to vm://localhost. Ways you can add a tcp-Connector to this
broker are described in the other thread or in the vm-tp-reference
(http://activemq.apache.org/vm-transport-reference.html)
Mario
On 6/28/07, Suchitha Koneru (sukoneru) <sukoneru@cisco.com> wrote:
>
> I also observed that when configuring an embedded broker Tomcat
> automatically starts the embedded broker when "vm" transport is used
> and not for "tcp " transport.
>
> Thanks,
> Suchitha.
> -----Original Message-----
> From: Suchitha Koneru (sukoneru)
> Sent: Thursday, June 28, 2007 12:45 PM
> To: users@activemq.apache.org
> Subject: access to embedded broker
>
> Hello Active Mq users ,
> Can an external java process get access to an
> embedded broker ? In our application we have
> Tomcat server with two Web apps , Web App A and Web app B. These
two
> web apps exchange messages via the embedded broker.
>
> Is the embedded broker confined only to the JVM in which it is
> started ?? in our case the embedded broker is started within the JVM
> of Tomcat.Can an external java process connect to the embedded broker
> and sent messages to these two web apps ? This process is entirely in
> a different JVM .
>
> Please let me know, Based on your response I will have to decide if I
> have use an embedded broker with "VM" transport or an external broker
> with "TCP" transport.
>
> thank you so much,
> Suchitha.
>
>
|