Announcement Announcement Module
Collapse
No announcement yet.
Urgent please help : Weblogic 9.x MDB injected Spring and ibatis Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Urgent please help : Weblogic 9.x MDB injected Spring and ibatis

    I have ejb module (an MDB) runnnig Weblogic 9 and injected spring now i do not see anything happening. Earlier without spring i was able to see the message coming. Problem is i have to use ibatis 2.3 and they are using spring DAO so i had to do it. beanRefContext.xml and businessApplicationContext.xml are in
    com.sas.oaq folder when ejb is jarred up. Please help me i have a deliverable tomorrow. When i place the message on Que I do not see it coming. I do not see any errors exceptions either when weblogic starts up.

    ejb-jar.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <ejb-jar
      xmlns="http://java.sun.com/xml/ns/j2ee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
      version="2.1">
      <enterprise-beans>
        <message-driven>
          <ejb-name>OAQXAQueueMDB</ejb-name>
          <ejb-class>com.sas.oaq.mdb.OAQMDBBean</ejb-class>
          <transaction-type>Container</transaction-type>
          <activation-config>
            <activation-config-property>
              <activation-config-property-name>destinationType</activation-config-property-name>
              <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
            </activation-config-property>
          </activation-config>
          <env-entry>
            <env-entry-name>isTransacted</env-entry-name>
            <env-entry-type>java.lang.String</env-entry-type>
            <env-entry-value>true</env-entry-value>
          </env-entry>     
          <env-entry>
            <env-entry-name>isJmsRedeliveredBroken</env-entry-name>
            <env-entry-type>java.lang.String</env-entry-type>
            <env-entry-value>false</env-entry-value>
          </env-entry>     
        </message-driven>
      </enterprise-beans>
      <assembly-descriptor>
        <container-transaction>
          <method>
            <ejb-name>OAQXAQueueMDB</ejb-name>
            <method-name>onMessage</method-name>
          </method>
          <trans-attribute>Required</trans-attribute>
        </container-transaction>
      </assembly-descriptor>
    </ejb-jar>
    weblogic-ejb-jar.xml

    Code:
    --------------------
    <weblogic-ejb-jar 
      xmlns="http://www.bea.com/ns/weblogic/90" 
      xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-ejb-jar.xsd">
       <weblogic-enterprise-bean>
         <ejb-name>OAQXAQueueMDB</ejb-name>
        <message-driven-descriptor>
          <pool>
            <max-beans-in-free-pool>10</max-beans-in-free-pool>
            <initial-beans-in-free-pool>10</initial-beans-in-free-pool>
          </pool>
          <destination-jndi-name>ORAQ_Q</destination-jndi-name>
          <connection-factory-jndi-name>AQJMS_XAQueueConnectionFactory</connection-factory-jndi-name>
        </message-driven-descriptor>
      </weblogic-enterprise-bean>
    
     </weblogic-ejb-jar>

    ----------- beanRefContext.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
    
    	<bean id="businessBeanFactory"
    		class="org.springframework.context.support.ClassPathXmlApplicationContext">
    		<constructor-arg value="businessApplicationContext.xml" />
    	</bean>
    </beans>
    ------------------------------------
    Code:
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:jee="http://www.springframework.org/schema/jee"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans         http://www.springframework.org/schem...-beans-2.0.xsd
    	http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.0.xsd">
    	
            <jee:jndi-lookup id="oracleDataSource" jndi-name="jdbc/dsTTR"/>    
    	   
    	   <bean id="transactionManager"
    		    class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    		    <property name="dataSource" ref="oracleDataSource"/>
    	   </bean>
    
    	   <bean id="qmsgdelegate" class="com.sas.oaq.mdb.qmessageorcl.delegate.QMessageDelegateImpl">
    	        <property name="qMessageDAO" ref="qMessageDAO" />
    	        <property name="dataSource" ref="oracleDataSource"/>
    	   </bean>
    	    
    	   <bean id="qMessageDAO" class="com.sas.oaq.mdb.dao.qmessageorcl.SqlMapQMessageDAO">
    	        <property name="sqlMapClient" ref="qMessageSqlmap" />
    	   </bean>
    	    
    	   <bean id="qMessageSqlmap" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
    	        <property name="configLocation"
    	            value="classpath:com/sas/oaq/mdb/qmessageorcl/dao/sqlmap/SqlMapConfig.xml" />
    	        <property name="dataSource" ref="oracleDataSource"/>
    	   </bean>
    </beans>
    When i activate the app in weblogic all i see in logs is
    Code:
    ------------------MDB ------------
    package com.sas.oaq.mdb;
    
    
    import javax.ejb.EJBException;
    import javax.ejb.MessageDrivenBean;
    import javax.ejb.MessageDrivenContext;
    import javax.jms.JMSException;
    import javax.jms.Message;
    import javax.jms.MessageListener;
    import javax.jms.TextMessage;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import org.springframework.ejb.support.*;
    import com.sas.oaq.mdb.qmessageorcl.delegate.QMessgeDelegateImpl;
    import com.sas.oaq.mdb.qmessageorcl.delegate.QMessgeDelegate;
    import org.springframework.context.access.ContextSingletonBeanFactoryLocator;
    
    public class OAQMDBBean extends AbstractJmsMessageDrivenBean
    {
    
        private QMessgeDelegate msgdelegate = null;
        private MessageDrivenContext context;
        private boolean isTransacted = false;
        private boolean isJmsRedeliveredBroken = false;
    
    
        public void setMessageDrivenContext(MessageDrivenContext context)
        {
    
    		super.setMessageDrivenContext(context);
    		setBeanFactoryLocator(ContextSingletonBeanFactoryLocator.getInstance());
    		setBeanFactoryLocatorKey("businessBeanFactory");
    
    	}
    
        public void onMessage(Message message)
        {
    
    	 System.out.println("doBusiness:  " + message.toString());
        }
    
        protected void onEjbCreate() {
    		System.out.println( " I created myself -----------------------");
            //msgdelegate = ( QMessgeDelegate ) getBeanFactory().getBean("qmsgdelegate");
    	}
    
    }

    Exception in weblogic startup
    Code:
    	java.lang.reflect.InvocationTargetException
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:585)
    	at weblogic.ejb.container.manager.MessageDrivenManager.createBean(MessageDrivenManager.java:291)
    	at weblogic.ejb.container.pool.MessageDrivenPool.createBean(MessageDrivenPool.java:165)
    	at weblogic.ejb.container.pool.Pool.createInitialBeans(Pool.java:295)
    	at weblogic.ejb.container.manager.MessageDrivenManager.start(MessageDrivenManager.java:553)
    	at weblogic.ejb.container.deployer.MessageDrivenBeanInfoImpl.mdManagerStart(MessageDrivenBeanInfoImpl.java:1132)
    	at weblogic.ejb.container.deployer.MessageDrivenBeanInfoImpl.deployMessageDrivenBeans(MessageDrivenBeanInfoImpl.java:1112)
    	at weblogic.ejb.container.deployer.EJBDeployer.deployMessageDrivenBeans(EJBDeployer.java:1603)
    	at weblogic.ejb.container.deployer.EJBDeployer.start(EJBDeployer.java:1425)
    	at weblogic.ejb.container.deployer.EJBModule.start(EJBModule.java:495)
    	at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:117)
    	at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
    	at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
    	at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
    	at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:26)
    	at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:635)
    	at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
    	at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
    	at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:154)
    	at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
    	at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:566)
    	at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:136)
    	at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:104)
    	at weblogic.deploy.internal.targetserver.operations.StartOperation.doCommit(StartOperation.java:139)
    	at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:320)
    	at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:815)
    	at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1222)
    	at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:433)
    org.springframework.beans.factory.access.BootstrapException: Unable to return specified BeanFactory instance: factory key [businessBeanFactory], from group with resource name [classpath*:beanRefContext.xml]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'businessBeanFactory' is defined
    	at
    Last edited by rs_nyuser; Mar 11th, 2010, 11:07 AM. Reason: add source code

  • #2
    Please use [ code][/code ] tags when posting code that way it remains readable.

    I suggest setting the logging to DEBUG (or at least for the spring classes) so that you see at least something.

    Another issue is you are in a JTA environment so I suggest instead of a DataSourceTransactionManager to use the JTA transactionmanager that way the jdbc stuff participates in the JTA transaction.

    Comment


    • #3
      I have added the code tags around the code and also added the exception to the code. Please help

      Comment


      • #4
        Well the stacktrace is pretty clear imho...

        The beanRefContext you are loading doesn't contain the factory you are referencing OR the beanRefContext isn't readable (i.e. it isn't in the ear/jar).

        If you enable debug logging AND post the WHOLE stacktrace it would be more informative.

        Comment

        Working...
        X