Hi,
My writer:
durin starting, application tries connect to the jmsManager but if my JMS Queues are not available then i have errors and my application doesn't work.Code:<bean id="writer_rejectedTransactionsStatus3" class="pl.bph.rafik.jobs.rejectedtransactions.writer.RejectedTransactionsSendNotificationWriter"> <property name="rejectedTransactionsManager" ref="rejectedTransactionsManager" /> <property name="jmsManager" ref="jmsManager" /> </bean>
From time to time somebody turn off server with JMS. Then we start app and received errors that JMS is unavailable:
14-02-2013 16:11:56.015 ERROR [ContextLoader]:{308line}-'Rafik'-Context initialization failed
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'pidConnectionFactory' defined in URL [file:/C:/oracle/Middleware/weblogic_10.3.6/user_projects/domains/RafikDomain/autodeploy/RafikEAR/RafikWAR/WEB-INF/classes/pl/bph/rafik/config/connector/jmsConnector.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Unable to resolve 'CAJMSFactory'. Resolved ''; remaining name 'CAJMSFactory'
we have few separate modules in this system and i want to other modules will work correctly when one module can't work becouse JMS is unavailable.
I have jmsConnector.xml :
I thought when i add lazy-init="true" it helps but it doesn't.Code:<bean id="pidJMSJndiTemplate" class="pl.bph.rafik.connector.JndiTemplate"> <!-- lazy-init="true" --> <property name="environment" > <props> <prop key="java.naming.provider.url">${jms.services.pidJMSJndiTemplate.jndi.url}</prop> <prop key="java.naming.factory.initial">${jms.services.pidJMSJndiTemplate.jndi.factory}</prop> <prop key="java.naming.security.principal">${jms.services.pidJMSJndiTemplate.jndi.principal}</prop> <prop key="java.naming.security.credentials">${jms.services.pidJMSJndiTemplate.jndi.credentials}</prop> </props> </property> </bean> <bean id="pidConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean" lazy-init="true"> <!-- lazy-init="true" --> <property name="jndiTemplate" ref="pidJMSJndiTemplate"/> <property name="jndiName" value="${jms.services.pidJMSJndiTemplate.jndi.connectionFactory}" /> <!--<property name="cache" value="false" /> --> </bean> <bean id="pidQueueDestination" class="org.springframework.jndi.JndiObjectFactoryBean" lazy-init="true"> <!-- lazy-init="true" --> <property name="jndiTemplate" ref="pidJMSJndiTemplate"/> <property name="jndiName" value="${jms.services.pidJMSJndiTemplate.jndi.queueDestination}"/> <!--<property name="cache" value="false" /> --> </bean> <bean id="pidJmsTemplate" name="pidJmsTemplate" class="org.springframework.jms.core.JmsTemplate" lazy-init="true"> <!-- lazy-init="true" --> <property name="connectionFactory" ref="pidConnectionFactory"/> <property name="defaultDestination" ref="pidQueueDestination"/> <property name="receiveTimeout" value="${jms.services.pidJMSJndiTemplate.jndi.receiveTimeout}"/> </bean>
So, what can i do to say Spring, don't load 'CAJMSFactory' when this is unavailable? And load later when we want to use JMS and reconnect?


Reply With Quote