You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by "C. Ullenboom" <ca...@java-tutor.com> on 2006/05/15 22:35:58 UTC

ActiveMQ and Spring: configuration has no BrokerService

I’m using Spring and ActiveMQ and the BrokerService is working fine with

<bean id="broker" class="org.apache.activemq.broker.BrokerService"
init-method="start">
  <property name="persistent" value="false"/>
  <property name="transportConnectorURIs">
    <list>
     <value>http://localhost:61616</value>
    </list>
  </property>
 </bean>

But when I want to use the BrokerFactoryBean

<bean id="broker"
	class="org.apache.activemq.xbean.BrokerFactoryBean">
	<property name="config" value="classpath:broker.xml" />
	<property name="start" value="true" />
</bean>

with this config

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC  "-//ACTIVEMQ//DTD//EN"
"http://activemq.org/dtd/activemq.dtd">
<beans>

	<broker>
		<connector>
			<tcpServerTransport uri="tcp://localhost:61616"
				backlog="false" />
		</connector>

		<persistence>
			<vmPersistence />
		</persistence>
	</broker>

</beans>

I get an exception.

Exception in thread "main"
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'broker' defined in class path resource [ctx.xml]: Initialization
of bean failed; nested exception is java.lang.IllegalArgumentException: The
configuration has no BrokerService instance for resource: class path
resource [broker.xml]
java.lang.IllegalArgumentException: The configuration has no BrokerService
instance for resource: class path resource [broker.xml]
	at
org.apache.activemq.xbean.BrokerFactoryBean.afterPropertiesSet(BrokerFactoryBean.java:97)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1091)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:396)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:233)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:145)
	at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:277)
	at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:313)
	at
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:87)
	at
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:72)
	at
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:63)
	at Main.main(Main.java:15)


My understanding was that the BrokerFactoryBean is configuring this
BrokerService. Why is it complaining?

 Christian

--
View this message in context: http://www.nabble.com/ActiveMQ-and-Spring%3A-configuration-has-no-BrokerService-t1623411.html#a4398696
Sent from the ActiveMQ - User forum at Nabble.com.


Re: ActiveMQ and Spring: configuration has no BrokerService

Posted by "C. Ullenboom" <ca...@java-tutor.com>.
Thanks.

This was the answer. I'm using ActiveMQ 4.

 Christian
--
View this message in context: http://www.nabble.com/ActiveMQ-and-Spring%3A-configuration-has-no-BrokerService-t1623411.html#a4399527
Sent from the ActiveMQ - User forum at Nabble.com.


Re: ActiveMQ and Spring: configuration has no BrokerService

Posted by James Strachan <ja...@gmail.com>.
This looks like you are trying to use an old 3.x XML configuration file.

Here's an example XML configuration file to use
http://svn.apache.org/repos/asf/incubator/activemq/trunk/assembly/src/release/conf/activemq.xml



On 5/15/06, C. Ullenboom <ca...@java-tutor.com> wrote:
>
> I'm using Spring and ActiveMQ and the BrokerService is working fine with
>
> <bean id="broker" class="org.apache.activemq.broker.BrokerService"
> init-method="start">
>   <property name="persistent" value="false"/>
>   <property name="transportConnectorURIs">
>     <list>
>      <value>http://localhost:61616</value>
>     </list>
>   </property>
>  </bean>
>
> But when I want to use the BrokerFactoryBean
>
> <bean id="broker"
>         class="org.apache.activemq.xbean.BrokerFactoryBean">
>         <property name="config" value="classpath:broker.xml" />
>         <property name="start" value="true" />
> </bean>
>
> with this config
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE beans PUBLIC  "-//ACTIVEMQ//DTD//EN"
> "http://activemq.org/dtd/activemq.dtd">
> <beans>
>
>         <broker>
>                 <connector>
>                         <tcpServerTransport uri="tcp://localhost:61616"
>                                 backlog="false" />
>                 </connector>
>
>                 <persistence>
>                         <vmPersistence />
>                 </persistence>
>         </broker>
>
> </beans>
>
> I get an exception.
>
> Exception in thread "main"
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'broker' defined in class path resource [ctx.xml]: Initialization
> of bean failed; nested exception is java.lang.IllegalArgumentException: The
> configuration has no BrokerService instance for resource: class path
> resource [broker.xml]
> java.lang.IllegalArgumentException: The configuration has no BrokerService
> instance for resource: class path resource [broker.xml]
>         at
> org.apache.activemq.xbean.BrokerFactoryBean.afterPropertiesSet(BrokerFactoryBean.java:97)
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1091)
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:396)
>         at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:233)
>         at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:145)
>         at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:277)
>         at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:313)
>         at
> org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:87)
>         at
> org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:72)
>         at
> org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:63)
>         at Main.main(Main.java:15)
>
>
> My understanding was that the BrokerFactoryBean is configuring this
> BrokerService. Why is it complaining?
>
>  Christian
>
> --
> View this message in context: http://www.nabble.com/ActiveMQ-and-Spring%3A-configuration-has-no-BrokerService-t1623411.html#a4398696
> Sent from the ActiveMQ - User forum at Nabble.com.
>
>


-- 

James
-------
http://radio.weblogs.com/0112098/