activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ayyagari, Madhav" <Madhav.Ayyag...@sabre.com>
Subject RE: Configuration of transportConnectors, persistenceAdapter beans
Date Tue, 04 Apr 2006 18:34:21 GMT
Thanks James :)

I modified activemq.xml as below (Im using RC1):

<?xml version="1.0" encoding="ISO-8859-1"?>
<beans xmlns="http://activemq.org/config/1.0">
  <bean id="configurer1"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfi
gurer">
    <property name="location">
      <value>classpath:context/server.properties</value>
    </property>
  </bean>

  <broker useJmx="true" name="JMSServer">
    <persistenceAdapter>
      <journaledJDBC journalLogFiles="5"
dataDirectory="../activemq-data"/>
    </persistenceAdapter>
    <transportConnectors>
      <transportConnector uri="tcp://${jms.server.hostname}:61616"/>
    </transportConnectors>
  </broker>
</beans>
server.properties file has the line:   jms.server.hostname=localhost

There is another xml file that has the following bean definition
  <bean id="activeMqBroker"
class="org.apache.activemq.xbean.BrokerFactoryBean">
    <property name="config" value="classpath:activemq.xml"/>
    <property name="start" value="true"/>
  </bean>

My spring beans depend on the above bean with the bean id
"activeMqBroker".

When I ran the application I got the following stack trace. I wonder
where from this 'value' class appeared.
Is spring trying to parse "tcp://${jms.server.hostname}:61616" before it
can substitute jms.server.hostname?

org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'activeMqBroker' defined in class path resource
[context/alertContext.xml]: Initialization of bean failed; nested
exception is
org.springframework.beans.factory.BeanDefinitionStoreException: Error
registering bean with name '' defined in class path resource
[context/server/activemq.xml]: Bean class [value] not found; nested
exception is java.lang.ClassNotFoundException: value
org.springframework.beans.factory.BeanDefinitionStoreException: Error
registering bean with name '' defined in class path resource
[context/server/activemq.xml]: Bean class [value] not found; nested
exception is java.lang.ClassNotFoundException: value
java.lang.ClassNotFoundException: value
	at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:242)
	at
org.springframework.util.ClassUtils.forName(ClassUtils.java:108)
	at
org.springframework.beans.factory.support.BeanDefinitionReaderUtils.crea
teBeanDefinition(BeanDefinitionReaderUtils.java:65)
	at
org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser.par
seBeanDefinitionElement(DefaultXmlBeanDefinitionParser.java:426)
	at
org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser.par
seBeanDefinitionElement(DefaultXmlBeanDefinitionParser.java:392)
	at
org.apache.xbean.spring.context.impl.XBeanXmlBeanDefinitionParser.parseB
eanDefinitionElement(XBeanXmlBeanDefinitionParser.java:705)
	at
org.apache.xbean.spring.context.impl.XBeanXmlBeanDefinitionParser.parseB
eanFromExtensionElement(XBeanXmlBeanDefinitionParser.java:135)
	at
org.apache.xbean.spring.context.impl.XBeanXmlBeanDefinitionParser.parseP
ropertySubElement(XBeanXmlBeanDefinitionParser.java:715)
	at
org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser.par
sePropertyValue(DefaultXmlBeanDefinitionParser.java:714)
	at
org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser.par
sePropertyElement(DefaultXmlBeanDefinitionParser.java:657)
	at
org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser.par
sePropertyElements(DefaultXmlBeanDefinitionParser.java:556)

-----Original Message-----
From: James Strachan [mailto:james.strachan@gmail.com] 
Sent: Friday, March 24, 2006 12:45 PM
To: activemq-users@geronimo.apache.org
Subject: Re: Configuration of transportConnectors, persistenceAdapter
beans

Under the covers we're using Spring so you should be able to use a
Spring BeanPostProcessor to resolve any properties you like - e.g. add
this to the top of your file inside <beans>

  <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfi
gurer"/>

James

On 3/24/06, Ayyagari, Madhav <Madhav.Ayyagari@sabre.com> wrote:
> Hi all,
>
> Im using activemq.xml downloaded from activemq site to start the
> activemq server when my application also starts.
> In the activemq.xml, I find the following:
>
> <beans xmlns="http://activemq.org/config/1.0">
>
>   <broker useJmx="true">
> ...
>     <transportConnectors>
>        <transportConnector uri="tcp://localhost:61616"
> discoveryUri="multicast://default"/>
>        <transportConnector uri="stomp://localhost:61617"/>
>     </transportConnectors>
> ...
>   <broker/>
> </beans>
>
> Would it be possible to use a property like jms.server.name set in
> properties file that can be read into the transportConnectors bean
> above? I couldnt use activemq.dtd or spring dtd to make that work. If
it
> works, it should look something like
>
> <beans xmlns="http://activemq.org/config/1.0">
>
>   <broker useJmx="true">
> ...
>     <transportConnectors>
>        <transportConnector uri="tcp://${jms.server.name}:61616"
> discoveryUri="multicast://default"/>
>        <transportConnector uri="stomp://${jms.server.name}:61617"/>
>     </transportConnectors>
> ...
>   <broker/>
> </beans>
>
> Any suggestions?
>
> Thanks in advance,
> Madhav
>


--

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

Mime
View raw message