You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Mario Siegenthaler <ms...@inventsoft.ch> on 2007/06/28 23:57:12 UTC
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) <su...@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.
>
>
Re: access to embedded broker
Posted by Mario Siegenthaler <ms...@inventsoft.ch>.
I don't know why your derby failed to start. Reasons I can think of are:
* non-writeable directory where activemq tries to create the derby
data-directory. I'd check the directory you start tomcat from and the
tomcat directory itself.
* some missing classes for derby, althought the derbydb is included in
the amq-jar, so that shouldn't happen
Could you include the complete log that's produced during the tomcat startup?
You could also try to configure your broker with an activemq.xml
(vm://localhost?brokerConfig=xbean:activemq.xml) and then specify an
explicit data directory in the xml.
Mario
On 6/29/07, Suchitha Koneru (sukoneru) <su...@cisco.com> wrote:
> I did a netstat at the command prompt and I got the following output
>
> TCP sukoneru-wxp:61716 sukoneru-wxp.amer.cisco.com:0 LISTENING
>
> There by clearly, the broker has started , but derby db did not start
> due to which a connection cannot be established to the broker.
>
> The following exception was also raised in regard to derby db
> at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java)
> at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java)
> at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java)
> at
> org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(EmbedConnecti
> on.java)
> at
> org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnection.
> java)
> at
> org.apache.derby.impl.jdbc.EmbedConnection.<init>(EmbedConnection.java)
> at
> org.apache.derby.impl.jdbc.EmbedConnection20.<init>(EmbedConnection20.ja
> va)
> at
> org.apache.derby.impl.jdbc.EmbedConnection30.<init>(EmbedConnection30.ja
> va)
> at org.apache.derby.jdbc.Driver30.getNewEmbedConnection(Driver30.java)
> at org.apache.derby.jdbc.Driver169.connect(Driver169.java)
> at
> org.apache.derby.jdbc.EmbeddedDataSource.getConnection(EmbeddedDataSourc
> e.java)
> at
> org.apache.derby.jdbc.EmbeddedDataSource.getConnection(EmbeddedDataSourc
> e.java)
>
> So is this a known error or am I missing something in the
> configuration. The derby DB did not start , when I tried to use an
> embedded broker.
> Please let me know,
> Thank you,
> Suchitha.
> -----Original Message-----
> From: Suchitha Koneru (sukoneru)
> Sent: Thursday, June 28, 2007 6:03 PM
> To: users@activemq.apache.org
> Subject: RE: access to embedded broker
>
> Thank you so much Mario for the link. I tried to use an embedded broker
> with tcp 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) <su...@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.
> >
> >
>
RE: access to embedded broker
Posted by "Suchitha Koneru (sukoneru)" <su...@cisco.com>.
I did a netstat at the command prompt and I got the following output
TCP sukoneru-wxp:61716 sukoneru-wxp.amer.cisco.com:0 LISTENING
There by clearly, the broker has started , but derby db did not start
due to which a connection cannot be established to the broker.
The following exception was also raised in regard to derby db
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java)
at
org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(EmbedConnecti
on.java)
at
org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnection.
java)
at
org.apache.derby.impl.jdbc.EmbedConnection.<init>(EmbedConnection.java)
at
org.apache.derby.impl.jdbc.EmbedConnection20.<init>(EmbedConnection20.ja
va)
at
org.apache.derby.impl.jdbc.EmbedConnection30.<init>(EmbedConnection30.ja
va)
at org.apache.derby.jdbc.Driver30.getNewEmbedConnection(Driver30.java)
at org.apache.derby.jdbc.Driver169.connect(Driver169.java)
at
org.apache.derby.jdbc.EmbeddedDataSource.getConnection(EmbeddedDataSourc
e.java)
at
org.apache.derby.jdbc.EmbeddedDataSource.getConnection(EmbeddedDataSourc
e.java)
So is this a known error or am I missing something in the
configuration. The derby DB did not start , when I tried to use an
embedded broker.
Please let me know,
Thank you,
Suchitha.
-----Original Message-----
From: Suchitha Koneru (sukoneru)
Sent: Thursday, June 28, 2007 6:03 PM
To: users@activemq.apache.org
Subject: RE: access to embedded broker
Thank you so much Mario for the link. I tried to use an embedded broker
with tcp 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) <su...@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.
>
>
RE: access to embedded broker
Posted by "Suchitha Koneru (sukoneru)" <su...@cisco.com>.
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) <su...@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.
>
>