You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by jamo <ja...@gmail.com> on 2006/08/08 01:01:49 UTC
Spring Embedded broker Journal already opened error
I'm getting the following error when trying to start an embedded broker in my
Spring web app (spring 2.0rc2 & activemq 4.0.1):
BrokerService] Failed to start ActiveMQ JMS Message Broker. Reason:
java.io.IOException: Journal is already opened by this application.
According to a couple of posts that I've found (
http://goopen.org/confluence/display/ACTIVEMQ/Journal+is+already+opened+by+this+application
&
http://www.activemq.org/site/vm-transport-reference.html ),
with an embedded broker, the connection factory can start before the broker
creating 2 instances of activemq (and the error). But, as I understand it,
I'm creating the broker and connection factory in the same bean, so I don't
see how to seperate the two and add the suggested "depends-on"???
Can you explain how to work around the problem given the following config:
<!-- JMS ConnectionFactory to use - ActiveMQ -->
<bean id="jmsFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="vm://localhost" />
</bean>
<!-- Spring JMS Template (used by queueEmailService)-->
<bean id="bizLinxJmsTemplate"
class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="jmsFactory" />
<property name="defaultDestination" ref="destination" />
</bean>
<!-- Queue to use-->
<bean id="destination"
class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg value="bizLinxEmail" />
</bean>
<!-- QueueEmailService: the email queuer service - queues email to jms -->
<bean id="queueEmailService"
class="com.xxxx.dist.bizlinx.server.service.impl.QueueEmailService">
<property name="jmsTemplate" ref="bizLinxJmsTemplate" />
</bean>
<!-- SendEmailService: the email sender service - receives jms messages and
sends to SMTP -->
<bean id="sendEmailService"
class="com.xxxx.dist.bizlinx.server.service.impl.SendEmailService">
</bean>
<!-- JMS Listener Container - routes JMS Messages to SendEmailService -->
<bean id="listenerContainer"
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="jmsFactory" />
<property name="destination" ref="destination" />
<property name="messageListener" ref="sendEmailService" />
</bean>
Thanks
--
View this message in context: http://www.nabble.com/Spring-Embedded-broker-Journal-already-opened-error-tf2069517.html#a5697521
Sent from the ActiveMQ - User forum at Nabble.com.
Re: Spring Embedded broker Journal already opened error
Posted by James Strachan <ja...@gmail.com>.
When using web apps then you will get a broker created in each WAR as
they are in separate class loaders even if its a singleton in a
spring.xml.
Either add ActiveMQ to the global classpath, create a broker in just
one of your WARs or run the broker elsewhere.
On 8/8/06, jamo <ja...@gmail.com> wrote:
>
> No, the config section below is the only broker that's defined. But, I did
> notice from the Tomcat log that Spring is apparently creating the first
> broker in a different (app root) web context and then it trys to create a
> second broker for the app web context (which of course generates the error).
> Not sure why this occurring, but I'm going to take a look at the Spring
> options for creating the broker as a singleton.
> --
> View this message in context: http://www.nabble.com/Spring-Embedded-broker-Journal-already-opened-error-tf2069517.html#a5706315
> Sent from the ActiveMQ - User forum at Nabble.com.
>
>
--
James
-------
http://radio.weblogs.com/0112098/
Re: Spring Embedded broker Journal already opened error
Posted by jamo <ja...@gmail.com>.
No, the config section below is the only broker that's defined. But, I did
notice from the Tomcat log that Spring is apparently creating the first
broker in a different (app root) web context and then it trys to create a
second broker for the app web context (which of course generates the error).
Not sure why this occurring, but I'm going to take a look at the Spring
options for creating the broker as a singleton.
--
View this message in context: http://www.nabble.com/Spring-Embedded-broker-Journal-already-opened-error-tf2069517.html#a5706315
Sent from the ActiveMQ - User forum at Nabble.com.
Re: Spring Embedded broker Journal already opened error
Posted by James Strachan <ja...@gmail.com>.
Are you also explicitly creating an embedded broker yourself? If so
add a depens-on in the connection factory to the broker
On 8/8/06, jamo <ja...@gmail.com> wrote:
>
> I'm getting the following error when trying to start an embedded broker in my
> Spring web app (spring 2.0rc2 & activemq 4.0.1):
> BrokerService] Failed to start ActiveMQ JMS Message Broker. Reason:
> java.io.IOException: Journal is already opened by this application.
>
> According to a couple of posts that I've found (
> http://goopen.org/confluence/display/ACTIVEMQ/Journal+is+already+opened+by+this+application
> &
> http://www.activemq.org/site/vm-transport-reference.html ),
> with an embedded broker, the connection factory can start before the broker
> creating 2 instances of activemq (and the error). But, as I understand it,
> I'm creating the broker and connection factory in the same bean, so I don't
> see how to seperate the two and add the suggested "depends-on"???
>
> Can you explain how to work around the problem given the following config:
>
> <!-- JMS ConnectionFactory to use - ActiveMQ -->
> <bean id="jmsFactory"
> class="org.apache.activemq.ActiveMQConnectionFactory">
> <property name="brokerURL" value="vm://localhost" />
> </bean>
>
> <!-- Spring JMS Template (used by queueEmailService)-->
> <bean id="bizLinxJmsTemplate"
> class="org.springframework.jms.core.JmsTemplate">
> <property name="connectionFactory" ref="jmsFactory" />
> <property name="defaultDestination" ref="destination" />
> </bean>
>
> <!-- Queue to use-->
> <bean id="destination"
> class="org.apache.activemq.command.ActiveMQQueue">
> <constructor-arg value="bizLinxEmail" />
> </bean>
>
> <!-- QueueEmailService: the email queuer service - queues email to jms -->
> <bean id="queueEmailService"
> class="com.xxxx.dist.bizlinx.server.service.impl.QueueEmailService">
> <property name="jmsTemplate" ref="bizLinxJmsTemplate" />
> </bean>
>
> <!-- SendEmailService: the email sender service - receives jms messages and
> sends to SMTP -->
> <bean id="sendEmailService"
> class="com.xxxx.dist.bizlinx.server.service.impl.SendEmailService">
> </bean>
>
> <!-- JMS Listener Container - routes JMS Messages to SendEmailService -->
> <bean id="listenerContainer"
> class="org.springframework.jms.listener.DefaultMessageListenerContainer">
> <property name="connectionFactory" ref="jmsFactory" />
> <property name="destination" ref="destination" />
> <property name="messageListener" ref="sendEmailService" />
> </bean>
>
> Thanks
>
> --
> View this message in context: http://www.nabble.com/Spring-Embedded-broker-Journal-already-opened-error-tf2069517.html#a5697521
> Sent from the ActiveMQ - User forum at Nabble.com.
>
>
--
James
-------
http://radio.weblogs.com/0112098/