Announcement Announcement Module
Collapse
No announcement yet.
Problem during startup system (Spring Batch) when JMS unavailable Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem during startup system (Spring Batch) when JMS unavailable

    Hi,

    My writer:
    Code:
    <bean id="writer_rejectedTransactionsStatus3" class="pl.bph.rafik.jobs.rejectedtransactions.writer.RejectedTransactionsSendNotificationWriter">
    		<property name="rejectedTransactionsManager" ref="rejectedTransactionsManager" />
    		<property name="jmsManager" ref="jmsManager" />
    </bean>
    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.

    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 :

    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>
    I thought when i add lazy-init="true" it helps but it doesn't.

    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?
    Last edited by pawelw; Feb 18th, 2013, 07:52 AM.

  • #2
    Sorry for not getting to this sooner. We are in the process of moving to StackOverflow for our forums.

    This question is probably a better candidate for StackOverflow, perhaps against the #spring-jms, #spring-batch tag.
    If you do post it there, please reply here with the link.

    Thanks!

    Comment

    Working...
    X