A MessageListener will not receive messages unless the connection is
started.
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/jms/Connection.html#start()
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/jms/Connection.html#stop()
The fix is to replace the existing
connection.start() in JmsReceiverComponent with lifecycle start/stop
methods
to call connection.start/stop respectively.
Cheers,
Peter.
For example, something like this:
public void start() throws javax.jbi.JBIException {
if (connection != null) {
try {
connection.start();
} catch (javax.jms.JMSException ex) {
throw new javax.jbi.JBIException(ex);
}
}
super.start();
}
public void stop() throws javax.jbi.JBIException {
if (connection != null) {
try {
connection.stop();
} catch (javax.jms.JMSException ex) {
throw new javax.jbi.JBIException(ex);
}
}
super.stop();
}
Hiram Chirino wrote:
Hi Sairam,
>From a quick review of the code it seems that the jms consumer is setup
in the afterPropertiesSet() method and it seems that method gets
executed before the jbi's component init() method. So I think that you
are just hitting the case where an asyncronous message is being
delivered quicker to the onMessage() method than the init() is being
called.
Perhaps we should move the jms consumer setup code to the init
method.
Regards,
Hiram
On Dec 16, 2005, at 1:03 PM, Sairam (sent by Nabble.com) wrote:
Version Service: 2.0.2
Tibco EMS: 4.2
I am trying to use Tibco EMS with the JMS Component.
JavaClient --> messages --> inputQueue -->ServiceMix
retreives it and outputs to and Output Queue. During startup I am
getting the following exception but after that everything works fine.
Messages are being reterived and published to the output queue. I have
attached the servicemix.xml I am using.
Could please let me know if my configuration has any errors.
thank you
Sairam
//////////// *********** EXCEPTION*************
/////////////////////////
**Exception in MessageListener**:
org.servicemix.jbi.RuntimeJBIException:
org.servicemix.jbi.NotInitialisedYetException: Cannot perform
operations on
this component until it has been initialised via init()
at
org.servicemix.components.jms.JmsInBinding.onMessage(JmsInBinding.java:74)
at
com.tibco.tibjms.TibjmsSession._submit(TibjmsSession.java:2843)
at
com.tibco.tibjms.TibjmsSession._dispatchAsyncMessage(TibjmsSession.java:1428)
at
com.tibco.tibjms.TibjmsSession$Dispatcher.run(TibjmsSession.java:2506)
Caused by: org.servicemix.jbi.NotInitialisedYetException: Cannot
perform operations on this component until it has
been initialised via init()
at
org.servicemix.components.util.PojoSupport.getDeliveryChannel(PojoSupport.java:185)
at
org.servicemix.components.jms.JmsInBinding.onMessage(JmsInBinding.java:59)
... 3 more
**Exception in MessageListener**:
org.servicemix.jbi.RuntimeJBIException:
org.servicemix.jbi.NotInitialisedYetException: Cannot perform
operations on
this component until it has been initialised via init()
at
org.servicemix.components.jms.JmsInBinding.onMessage(JmsInBinding.java:74)
at
com.tibco.tibjms.TibjmsSession._submit(TibjmsSession.java:2843)
at
com.tibco.tibjms.TibjmsSession._dispatchAsyncMessage(TibjmsSession.java:1428)
at
com.tibco.tibjms.TibjmsSession$Dispatcher.run(TibjmsSession.java:2506)
Caused by: org.servicemix.jbi.NotInitialisedYetException: Cannot
perform operations on this component until it has
been initialised via init()
at
org.servicemix.components.util.PojoSupport.getDeliveryChannel(PojoSupport.java:185)
at
org.servicemix.components.jms.JmsInBinding.onMessage(JmsInBinding.java:59)
... 3 more
///////////// *********** SERVICEMIX.XML *************
///////////////////////
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xbean.org/schemas/spring/1.0"
xmlns:spring="http://xbean.org/schemas/spring/1.0"
xmlns:sm="http://servicemix.org/config/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xbean.org/schemas/spring/1.0
../../conf/spring-beans.xsd
http://servicemix.org/config/1.0
../../conf/servicemix.xsd"
xmlns:my="http://servicemix.org/demo/">
<!-- the JBI container -->
<sm:container spring:id="jbi"
useMBeanServer="true"
createMBeanServer="true"
dumpStats="true"
statsInterval="10"
transactionManager="#transactionManager">
<sm:activationSpecs>
<sm:activationSpec componentName="inputReceiver"
service="my:inputReceiver" destinationService="my:outputSender">
<sm:component>
<bean xmlns="http://xbean.org/schemas/spring/1.0"
class="org.servicemix.components.jms.JmsReceiverComponent">
<property name="template">
<bean class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory"><ref
bean="myQueueConnectionFactory"/></property>
<property name="destinationResolver"><ref
bean="myJmsDestinationResolver"/></property>
<property name="defaultDestinationName"
value="servicemix.queue.input"/>
<property name="pubSubDomain" value="false"/>
</bean>
</property>
</bean>
</sm:component>
</sm:activationSpec>
<sm:activationSpec componentName="outputSender"
service="my:outputSender">
<sm:component>
<bean xmlns="http://xbean.org/schemas/spring/1.0"
class="org.servicemix.components.jms.JmsSenderComponent">
<property name="template">
<bean class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory"><ref
bean="myQueueConnectionFactory"/></property>
<property name="destinationResolver"><ref
bean="myJmsDestinationResolver"/></property>
<property name="defaultDestinationName"
value="servicemix.queue.output"/>
<property name="pubSubDomain" value="false"/>
</bean>
</property>
</bean>
</sm:component>
</sm:activationSpec>
</sm:activationSpecs>
</sm:container>
<!-- Use my own JNDI - The JMS objects are already binded in here
-->
<bean id="myJndi"
class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop
key="java.naming.factory.initial">com.tibco.tibjms.naming.TibjmsInitialContextFactory</prop>
<prop
key="java.naming.provider.url">tibjmsnaming://localhost:7222</prop>
</props>
</property>
</bean>
<!-- The QueueConnectionFactory is in my JNDI -->
<bean id="myQueueConnectionFactory"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref="myJndi"/>
<property name="jndiName" value="QueueConnectionFactory"/>
</bean>
<!-- The JMS Destinations are resolved by looking them up in my
JNDI -->
<bean id="myJmsDestinationResolver"
class="org.springframework.jms.support.destination.JndiDestinationResolver">
<property name="jndiTemplate" ref="myJndi"/>
</bean>
<!-- Needed for SpringJBIContainer? -->
<bean id="transactionManager"
class="org.jencks.factory.TransactionManagerFactoryBean"/>
</beans>
Sent from the servicemix
- user forum at Nabble.com:
Exception
in MessageListener
|