The container (ServiceMix specific element) must only contains components.
The other beans that you defined (myQueueConnectionFactory and myJndi)
must appear
outside of the container element.
You can see the bean defined in the spring configuration in the log.
The org.springframework.beans.factory.support.DefaultListableBeanFactory
defining beans [jbi];
statement says that there is only one bean defined named jbi.
Cheers,
Guillaume Nodet
Peter Smith wrote:
Hi,
I wonder if anybody out there would like to look at this ServiceMix
1.0 configuration and tell me what I've done wrong.
This configuration is supposed to set up a JMS receiver (listening on
queue/Q1) which routes to a JMS sender (sending to queue/Q2). The
QueueConnectionFactory is queue/QCF. Another complication is I am
using my own vendor JNDI.
Externally, I have already configured Queues and JNDI and I already
have working JMS clients to sit at the fringes of this configuration.
I am kind of working from a Spring JMS configuration I found here:
http://www-128.ibm.com/developerworks/web/library/wa-spring4/?ca=drs-tp4005
but really the main problem is I am new to Spring so I was always
going to come to grief sooner or later.
BTW, is there any Spring logging I can somehow enable that will help
understand is going on?
Thanks in advance for any help.
Peter.
Here is my servicemix.xml
---------
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:my="http://servicemix.org/demo/">
<!-- the JBI container -->
<container id="jbi">
<property name="createMBeanServer" value="true"/>
<property name="dumpStats" value="true"/>
<property name="statsInterval" value="10"/>
<components>
<!-- 1st. Subscribe to a JMS destination Q1 -->
<component id="inputReceiver" service="my:inputReceiver"
class="org.servicemix.components.jms.JmsReceiverComponent"
destinationService="my:outputSender">
<property name="template">
<bean class="org.springframework.jms.core.JmsTemplate102">
<property name="connectionFactory"
ref="myQueueConnectionFactory"/>
<property name="defaultDestinationName"
value="java:comp/env/jms/queue/Q1"/>
<property name="pubSubDomain" value="false"/>
</bean>
</property>
</component>
<!-- 2nd. Publish the result to a JMS destination Q2 -->
<component id="outputSender" service="my:outputSender"
class="org.servicemix.components.jms.JmsSenderComponent">
<property name="template">
<bean class="org.springframework.jms.core.JmsTemplate102">
<property name="connectionFactory"
ref="myQueueConnectionFactory"/>
<property name="defaultDestinationName"
value="java:comp/env/jms/queue/Q2"/>
<property name="pubSubDomain" value="false"/>
<property name="explicitQosEnabled" value="true"/>
<property name="timeToLive" value="60000"/>
</bean>
</property>
</component> </components> <!-- Use our JNDI -
The JMS Administered objects are already in here -->
<bean id="myJndi" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop
key="java.naming.factory.initial">com.fujitsu.interstage.j2ee.jndi.InitialContextFactoryForClient</prop>
</props>
</property>
</bean>
<!-- The QueueConnectionFactory is in the JNDI -->
<bean id="myQueueConnectionFactory"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref="myJndi"/>
<property name="jndiName" value="java:comp/env/jms/queue/QCF"/>
</bean>
<!-- Needed for SpringJBIContainer? --> <bean
id="transactionManager"
class="org.jencks.factory.TransactionManagerFactoryBean"/>
</container>
</beans>
---------
And here are my errors:
Loading ServiceMix from file: servicemix.xml
9/11/2005 14:35:46
org.springframework.beans.factory.xml.XmlBeanDefinitionReader
loadBeanDefinitions
INFO: Loading XML bean definitions from file
[D:\starteam\j2ee14\ESB\proj-prototype\MyExample\jms-binding\servicemix.xml]
9/11/2005 14:35:56
org.springframework.context.support.AbstractRefreshableApplicationContext
refreshBeanFactory
INFO: Bean factory for application context
[org.springframework.context.support.FileSystemXmlApplicationContext;hashCode=8785225]:
org.springframework.beans.factory.support.DefaultListableBeanFactory
defining beans [jbi]; root of BeanFactory hierarchy
9/11/2005 14:35:56
org.springframework.context.support.AbstractApplicationContext refresh
INFO: 1 beans defined in application context
[org.springframework.context.support.FileSystemXmlApplicationContext;hashCode=8785225]
9/11/2005 14:35:56 org.springframework.core.CollectionFactory <clinit>
INFO: JDK 1.4+ collections available
9/11/2005 14:35:56 org.springframework.core.CollectionFactory <clinit>
INFO: Commons Collections 3.x available
9/11/2005 14:35:56
org.springframework.context.support.AbstractApplicationContext
initMessageSource
INFO: Unable to locate MessageSource with name 'messageSource': using
default
[EMAIL PROTECTED]
9/11/2005 14:35:56
org.springframework.context.support.AbstractApplicationContext
initApplicationEventMulticaster
INFO: Unable to locate ApplicationEventMulticaster with name
'applicationEventMulticaster': using default
[EMAIL PROTECTED]
9/11/2005 14:35:56
org.springframework.beans.factory.support.DefaultListableBeanFactory
preInstantiateSingletons
INFO: Pre-instantiating singletons in factory
[org.springframework.beans.factory.support.DefaultListableBeanFactory
defining beans [jbi]; root of BeanFactory hierarchy]
9/11/2005 14:35:56
org.springframework.beans.factory.support.AbstractBeanFactory getBean
INFO: Creating shared instance of singleton bean 'jbi'
9/11/2005 14:36:01
org.springframework.beans.factory.support.AbstractBeanFactory
destroySingletons
INFO: Destroying singletons in factory
{org.springframework.beans.factory.support.DefaultListableBeanFactory
defining beans [jbi]; root of BeanFactory hierarchy}
Caught: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'org.springframework.jms.core.JmsTemplate102'
defined in file
[D:\starteam\j2ee14\ESB\proj-prototype\MyExample\jms-binding\servicemix.xml]:
Can't resolve reference to bean 'myQueueConnectionFactory' while
setting property 'connectionFactory'; nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException: No
bean named 'myQueueConnectionFactory' is defined:
org.springframework.beans.factory.support.DefaultListableBeanFactory
defining beans[jbi]; root of BeanFactory hierarchy
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'org.springframework.jms.core.JmsTemplate102'
defined in file
[D:\starteam\j2ee14\ESB\proj-prototype\MyExample\jms-binding\servicemix.xml]:
Can't resolve reference to bean 'myQueueConnectionFactory' while
setting property 'connectionFactory'; nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException: No
bean named 'myQueueConnectionFactory' is defined:
org.springframework.beans.factory.support.DefaultListableBeanFactory
defining beans [jbi]; root of BeanFactory
hierarchyorg.springframework.beans.factory.NoSuchBeanDefinitionException:
No bean named 'myQueueConnectionFactory' is defined:
org.springframework.beans.factory.support.DefaultListableBeanFactory
defining beans [jbi]; root of BeanFactory hierarchy
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:351)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:640)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:176)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:105)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:920)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:731)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:340)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBeanDefinition(BeanDefinitionValueResolver.java:147)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:96)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:920)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:731)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:340)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBeanDefinition(BeanDefinitionValueResolver.java:147)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:96)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:920)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:731)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:340)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBeanDefinition(BeanDefinitionValueResolver.java:147)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:96)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:193)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:109)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:920)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:731)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:340)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:223)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:277)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:312)
at
org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:82)
at
org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:67)
at
org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:58)
at org.servicemix.Main.main(Main.java:76)
[end]