Announcement Announcement Module
Collapse
No announcement yet.
NoBeanFoundException Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • NoBeanFoundException

    Hi alll,
    mm..New to Spring..Kindly resolve me the error of NoBena FoundException..


    My Context.xml looks like this..

    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

    Code:
    <beans>
          
          <bean id="redemptionService"
    class="org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean" parent="TransactionTemplate">
    <property name="jndiEnvironment">
                        <props>
                            <prop key = "java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
                            <prop key = "java.naming.provider.url">t3://localhost:7001</prop>
                            <prop key = "java.naming.factory.url.pkgs">weblogic.jndi.factories:weblogic.corba.j2ee.naming.url</prop>
                         </props>
                    </property>    
    	<property name="jndiName" value="RedemptionWork1" />
    	<property name="businessInterface" value="com.ftindia.redemption.interfaces.RedemptionManager" />
    </bean>
    
         <bean id="JtaTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
         	<property name="userTransaction" ref="javax.transaction.UserTransaction"/>     	
         </bean>
         
        <bean id="TransactionTemplate" abstract="false" class="com.ftindia.transaction.TransactionTemplate">
         	<property name="transactionManager" ref="JtaTransactionManager"/>
        </bean>
        
    </beans>
    Code:
    Error : 
    
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redemptionService' defined in class path resource [context.xml]: Can't resolve reference to bean 'TransactionManager' while setting property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'TransactionManager' defined in class path resource [context.xml]: Can't resolve reference to bean 'javax.transaction.UserTransaction' while setting property 'userTransaction'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'javax.transaction.UserTransaction' is defined: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [redemptionService,TransactionManager,transactionTemplate]; root of BeanFactory hierarchy
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'TransactionManager' defined in class path resource [context.xml]: Can't resolve reference to bean 'javax.transaction.UserTransaction' while setting property 'userTransaction'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'javax.transaction.UserTransaction' is defined: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [redemptionService,TransactionManager,transactionTemplate]; root of BeanFactory hierarchy
    org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'javax.transaction.UserTransaction' is defined: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [redemptionService,TransactionManager,transactionTemplate]; root of BeanFactory hierarchy
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:349)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:671)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
    	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:1012)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:823)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:345)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
    	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:1012)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:823)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:345)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:269)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:318)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:81)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:66)
    	at com.ftindia.delegates.RedemptionBusinessDelegate.getRedemptionReg(RedemptionBusinessDelegate.java:22)
    	at com.ftindia.operations.redemption.action.RedemRegAction.execute(RedemRegAction.java:131)
    	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    	at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1077)
    	at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465)

    Kindly check my Code in the context.xml above If any Iam missing..
    Thanks for any help.

  • #2
    I think it's simply as the error says: do you have a bean named 'javax.transaction.UserTransaction' in your configuration ?

    Comment


    • #3
      No I dont have..but

      Ok..I have slightly Changed the Code in my Context.xml
      as like this..

      Code:
      <bean id="redemptionService"
      class="org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean" parent="TransactionTemplate">
      <property name="jndiEnvironment">
                          <props>
                              <prop key = "java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
                              <prop key = "java.naming.provider.url">t3://localhost:7001</prop>
                              <prop key = "java.naming.factory.url.pkgs">weblogic.jndi.factories:weblogic.corba.j2ee.naming.url</prop>
                           </props>
                      </property>    
      	<property name="jndiName" value="RedemptionWork1" />
      	<property name="businessInterface" value="com.ftindia.redemption.interfaces.RedemptionManager" />
      </bean>
      
         <bean id="TransactionTemplate" abstract="false" class="com.ftindia.transaction.TransactionTemplate">
           	<property name="transactionManager" value="org.springframework.transaction.jta.JtaTransactionManager"/>
          </bean>
      And the TransactionTemplate where the set and get methods for TransactionManager looks like this

      Code:
      public JtaTransactionManager getTransactionManager() {
      		return transactionManager;
      	}
      
      	public void setTransactionManager(JtaTransactionManager transactionManager) {
      		log.debug("<-----------------The TransactionManager Came here--------------> "+transactionManager);
      		this.transactionManager = transactionManager;
      	}
      and it has a property called transactionManager of type JtaTransactionManager which has the type as public..

      Code:
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redemptionService' defined in class path resource [context.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'transactionManager' of bean class [org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean]: Bean property 'transactionManager' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?
      org.springframework.beans.NotWritablePropertyException: Invalid property 'transactionManager' of bean class [org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean]: Bean property 'transactionManager' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?
      	at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:831)
      	at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:733)
      	at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:890)
      	at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapperImpl.java:917)
      	at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapperImpl.java:906)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1022)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:823)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:345)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
      	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:269)
      	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:318)
      	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:81)
      	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:66)
      	at com.ftindia.delegates.RedemptionBusinessDelegate.getRedemptionReg(RedemptionBusinessDelegate.java:22)
      	at com.ftindia.operations.redemption.action.RedemRegAction.execute(RedemRegAction.java:131)
      	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
      	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
      	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
      	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      	at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1077)
      	at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465)
      	at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:348)
      	at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:7047)
      	at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
      	at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
      	at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3902)
      	at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2773)
      	at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
      	at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)

      This is the exception it is giving..What's wrong with my Code..
      Thanks for any help..

      Comment


      • #4
        I think you are missing some basics about Spring.
        Code:
        <bean id="TransactionTemplate" abstract="false" class="com.ftindia.transaction.TransactionTemplate">
             	<property name="transactionManager" value="org.springframework.transaction.jta.JtaTransactionManager"/>
            </bean>
        the code above translates: define a bean of class com.ftindia.transaction.TransactionTemplate, being named 'TransactionTemplate' and having a property named 'transactionManager' which value is 'org.springframework.transaction.jta.JtaTransactio nManager'.

        You probably want to pass for 'transactionManager' property an instance of type 'org.springframework.transaction.jta.JtaTransactio nManager'. This is done somewhat like this:
        Code:
            <bean id="myBeanId" class="my.bean.package.MyBean">
             	<property name="myBeanProperty" ref="myBeanId2"/>
            </bean>
        
            <bean id="myBeanId2" class="my.bean.package.MyBean2" />
        I suggest reading the reference documentation.

        Comment


        • #5
          Sorry Stefan..Itz my mistake

          I should have written like this ,

          Code:
          <bean id="txManager" class="org.springframework.transaction.jta.JtaTransactionManager">   </bean>
               
              <bean id="TransactionTemplate" abstract="true" class="com.ftindia.transaction.TransactionTemplate">
               	<property name="transactionManager" ref="txManager"/>
              </bean>
          Now the issue is solved with the Transaction Management...I have used correctly the Parameters over there as a type of PlatformtransactionManager..

          Another clarification required is..
          I prefer Programmtic Transaction for my application..
          What will be the difference between the TransactionCallBack Mechanism and the present way of Setting the TransactionManager explicitly.. Will there be any benefit with the TransactioCallback Mechanism other than the Transaction Limitation case in the Call Back Mechanism..Please Brief me ..

          Comment


          • #6
            BenaCreationException:JndiName Identification Problem with weblogic

            Bean Creation Nested Exception is Coming due to the reason that JNDI Name is not getting identified with weblogic..

            I tried using jdbc/dbconnection this is the DataSource I'm using..
            The dataSourceName I'm using is com.ftindia.dbconnection
            the BindName is here dbconnection..

            Here is the Code for my beans.xml

            Code:
            <beans>
               <bean id="redemptionService" class="com.ftindia.redemption.interfaces.impl.RedmptionManagerImpl" parent="TransactionTemplate">
            		<property name="redemRegDAOImpl" ref="RedemRegDAOImpl"/>	
            	</bean>       
            	<bean id="RedemRegDAOImpl" parent="SpringDBAccess" class="com.ftindia.redemption.dao.impl.RedemRegDAOImpl">		
            	</bean>
            	<bean id="SpringDBAccess" class="com.ftindia.db.SpringDBAccess">	
            		<property name="dataSource">
            			<ref bean="dataSource"/>
            		</property>
            	</bean>
            	<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
            		<property name="jndiName">
            			<value>java:jdbc/dbconnection</value>			
            		</property>
            	</bean>
            	
            	<bean id="txManager" class="org.springframework.transaction.jta.JtaTransactionManager"></bean>
            
               <bean id="TransactionTemplate" abstract="true" class="com.ftindia.transaction.TransactionTemplate" singleton="false">
                 	<property name="transactionManager" ref="txManager"/>
                </bean>  
            </beans>
            Exception :

            Code:
            Cannot access remote service [RedemptionWork1]; nested exception is java.rmi.RemoteException: Error in ejbCreate:; nested exception is: 
            org.springframework.beans.factory.BeanCreationException: 
            Error creating bean with name 'redemptionService' defined in class path resource
            [com/ftindia/ejb/beans.xml]: Can't resolve reference to bean 'RedemRegDAOImpl' 
            while setting property 'redemRegDAOImpl' nested exception is org.springframework.beans.factory.BeanCreationException:
            Error creating bean with name 'RedemRegDAOImpl' defined in class path resource [com/ftindia/ejb/beans.xml]:
            Can't resolve reference to bean 'dataSource' while setting property 'dataSource';
            nested exception is org.springframework.beans.factory.BeanCreationException: 
            Error creating bean with name 'dataSource' defined in class path resource [com/ftindia/ejb/beans.xml]:
            Initialization of bean failed; nested exception is javax.naming.NameNotFoundException: 
            While trying to look up jdbc/dbconnection in /app/ejb/redemption.jar#RedemptionReg.
            Can you please findout the error..

            Comment

            Working...
            X