title: Bean is not getting initialized in Spring
body: <p>Please find my codes below</p>
  
  <p>web.xml</p>
  
  <pre><code>&lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;/WEB-INF/applicationContext.xml&lt;/param-value&gt;
  &lt;/context-param&gt;
  
  &lt;listener&gt;
      &lt;listener-class&gt;
          org.springframework.web.context.ContextLoaderListener               
      &lt;/listener-class&gt;
  &lt;/listener&gt;
  </code></pre>
  
  <p>And my applicationContext.xml is here</p>
  
  <pre><code>     &lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;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"&gt;
  
  
          &lt;bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"&gt;
              &lt;property name="sessionFactory"&gt;
                  &lt;ref
  
   bean="sessionFactory" /&gt;
          &lt;/property&gt;
      &lt;/bean&gt; 
  
      &lt;!-- Hibernate SessionFactory --&gt;
      &lt;bean id="sessionFactory"
          class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&gt;
          &lt;property name="mappingResources"&gt;
              &lt;list&gt;
                  &lt;value&gt;
                      /com/qantas/cardselector/model/config/TcerConfigItem.hbm.xml
                  &lt;/value&gt;
              &lt;/list&gt;
          &lt;/property&gt;
          &lt;property name="hibernateProperties"&gt;
              &lt;props&gt;
  
                  &lt;prop key="hibernate.session_factory_name"&gt;
                      HibernateSessionFactory
                  &lt;/prop&gt;
                  &lt;prop
                      key="hibernate.transaction.manager_lookup_class"&gt;
                      org.hibernate.transaction.WeblogicTransactionManagerLookup
                  &lt;/prop&gt;
                  &lt;prop key="hibernate.transaction.factory_class"&gt;
                      org.hibernate.transaction.JTATransactionFactory
                  &lt;/prop&gt;
                  &lt;prop key="hibernate.current_session_context_class"&gt;
                      jta
                  &lt;/prop&gt;
                  &lt;prop key="hibernate.connection.datasource"&gt;
                      salesDataSource
                  &lt;/prop&gt;
                  &lt;prop key="hibernate.connection.release_mode"&gt;
                      auto
                  &lt;/prop&gt;
                  &lt;prop key="hibernate.dialect"&gt;
                      org.hibernate.dialect.OracleDialect
                  &lt;/prop&gt;
                  &lt;prop key="hibernate.show_sql"&gt;false&lt;/prop&gt;
                  &lt;prop key="hibernate.use_outer_join"&gt;true&lt;/prop&gt;
                  &lt;prop key="hibernate.query.factory_class"&gt;
                      org.hibernate.hql.classic.ClassicQueryTranslatorFactory
                  &lt;/prop&gt;
                  &lt;prop key="hibernate.cache.provider_class"&gt;
                      org.hibernate.cache.EhCacheProvider
                  &lt;/prop&gt;
                  &lt;prop key="hibernate.cache.use_query_cache"&gt;true&lt;/prop&gt;
                  &lt;prop key="hibernate.query.substitutions"&gt;
                      toLowerCase=lower,toUpperCase=upper,
                      today=TRUNC(sysdate),now=sysdate,getDate=TRUNC
                  &lt;/prop&gt;
                  &lt;prop key="hibernate.generate_statistics"&gt;true&lt;/prop&gt;
              &lt;/props&gt;
  
          &lt;/property&gt;
      &lt;/bean&gt;
  
  
      &lt;!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) --&gt;
      &lt;bean id="transactionManager"
          class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt;
          &lt;property name="sessionFactory"&gt;
              &lt;ref local="sessionFactory" /&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
  
      &lt;bean id="InitialLoad" name="/InitialLoadAction"
          class="com.qantas.cardselector.action.cardslist.CardsListAction"&gt;
          &lt;property name="cardManagementService"
              ref="cardManagementService" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="CardsList" name="/cardsList"
          class="com.qantas.cardselector.action.cardslist.CardsListAction"&gt;
          &lt;property name="cardManagementService"
              ref="cardManagementService" /&gt;
      &lt;/bean&gt;
  
  &lt;bean id="transactionProxy"
          class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
          abstract="true"&gt;
          &lt;property name="transactionManager" ref="transactionManager" /&gt;
          &lt;property name="transactionAttributes"&gt;
              &lt;props&gt;
                  &lt;prop key="*"&gt;PROPAGATION_REQUIRED&lt;/prop&gt;
              &lt;/props&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="cardManagementService" parent="transactionProxy"&gt;
          &lt;property name="target"&gt;
              &lt;bean class="com.qantas.cardselector.service.impl.CardManagementServiceImpl"&gt;
                  &lt;property name="cardManagementDAO" ref="cardManagementDAO" /&gt;
              &lt;/bean&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="cardManagementDAO" class="com.qantas.cardselector.dao.impl.CardManagementDAOimpl"&gt;
          &lt;property name="hibernateTemplate" ref="hibernateTemplate" /&gt;       
      &lt;/bean&gt;
  
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>and my action class is here </p>
  
  <pre><code> package com.qantas.cardselector.action.cardslist;
  
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  import org.apache.struts.action.Action;
  import org.apache.struts.action.ActionForm;
  import org.apache.struts.action.ActionForward;
  import org.apache.struts.action.ActionMapping;
  
  import com.qantas.cardselector.form.CardsListForm;
  import com.qantas.cardselector.service.CardManagementService;
  import com.qantas.cardselector.vo.SearchFilterVO;
  
  public class CardsListAction extends Action {
  
      public CardManagementService cardManagementService;
  
      @Override
      public ActionForward execute(ActionMapping mapping, ActionForm form,
              HttpServletRequest request, HttpServletResponse response)
              throws Exception {
          try {   
              System.out.println("action started");
              SearchFilterVO searchFilterVO =null;
              if(getCardManagementService()!=null)
              {
                  String returnvalue = getCardManagementService().retrieveParams(searchFilterVO);
                  System.out.println("returnvalue"+returnvalue);
              }
  
  
          } catch (Exception e) {
              System.out.println("Error:" + e.getMessage());
              e.printStackTrace();
          }
  
          return mapping.findForward("success");
      }
  
      public CardManagementService getCardManagementService() {
          return cardManagementService;
      }
  
      public void setCardManagementService(CardManagementService cardManagementService) {
          this.cardManagementService = cardManagementService;
      }
  
  }
  </code></pre>
  
  <p>this action class always throwing null pointer exceptions while calling service object as it shown in the code... please Can any one help...</p>