Announcement Announcement Module
Collapse
No announcement yet.
Odd behaviour when injecting TransactionTemplate Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Odd behaviour when injecting TransactionTemplate

    All,

    My application behaves as expected until I add the userService bean to my databaseContext.xml for transaction support. Once added, Tomcat appears to be in an infinite loop during startup resulting in an OutOfMemoryError. I'm using spring 1.2, Tomcat 5.0.X, JDK 1.42 and Hibernate 2.1. Any assistance would be greatly appreciated.

    Code:
    databaseContext.xml
    
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http&#58;//www.springframework.org/dtd/spring-beans.dtd">
    
    <!--
      - Application context definition for Express on Hibernate.
    	-->
    <beans>
    
    	<!-- Datasource that works in any application server
    		You could easily use J2EE data source instead if this were
    		running inside of a J2EE container.
    	 -->
    	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    		<property name="driverClassName"><value>com.mysql.jdbc.Driver</value></property>
    		<property name="url"><value>jdbc&#58;mysql&#58;//localhost&#58;3306/project</value></property>
    		<property name="username"><value>abc</value></property>
    		<property name="password"><value>123</value></property>
    	</bean>
    
    	<!-- Hibernate SessionFactory -->
    	<bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
    		<property name="dataSource"><ref local="dataSource"/></property>
    		
    		<!-- Must references all OR mapping files. -->
    		<property name="mappingResources">
    			<list>
    		        <value>com/mpom/beans/User.hbm.xml</value>
    		        <value>com/mpom/beans/PrimaryContact.hbm.xml</value>
    		        <value>com/mpom/beans/UserAddress.hbm.xml</value>
    		        <value>com/mpom/beans/BankAccount.hbm.xml</value>
    		        <value>com/mpom/beans/Bond.hbm.xml</value>
    		        <value>com/mpom/beans/Broker.hbm.xml</value>
    		        <value>com/mpom/beans/CD.hbm.xml</value>
    		        <value>com/mpom/beans/CreditCard.hbm.xml</value>
    		        <value>com/mpom/beans/Document.hbm.xml</value>
    		        <value>com/mpom/beans/Investment.hbm.xml</value>
    		        <value>com/mpom/beans/LifeInsurance.hbm.xml</value>
    		        <value>com/mpom/beans/Payment.hbm.xml</value>
    		        <value>com/mpom/beans/Authority.hbm.xml</value>
    		        <value>com/mpom/beans/Product.hbm.xml</value>
    		        <value>com/mpom/beans/LineItem.hbm.xml</value>
    		        <value>com/mpom/beans/Order.hbm.xml</value>
    		        <value>com/mpom/beans/FinancialLegalAdvisor.hbm.xml</value>
    		        <value>com/mpom/beans/ServiceInformation.hbm.xml</value>
    		        <value>com/mpom/beans/Policy.hbm.xml</value>
    		        <value>com/mpom/beans/Stock.hbm.xml</value>
    		        <value>com/mpom/beans/MutualFund.hbm.xml</value>
    		        <value>com/mpom/beans/Security.hbm.xml</value>
    		        <value>com/mpom/beans/SafetyDepositBox.hbm.xml</value>
    		        <value>com/mpom/beans/Pension.hbm.xml</value>
    		        <value>com/mpom/beans/RealEstate.hbm.xml</value>
    			</list>
    		</property>
    		
    		<!-- Set the type of database; changing this one property will port this to Oracle, 
    			 MS SQL etc. -->
    		<property name="hibernateProperties">
    			<props>
    				<prop key="hibernate.dialect">net.sf.hibernate.dialect.MySQLDialect</prop>
                    <prop key="hibernate.show_sql">true</prop>
    			</props>
    		</property>
    	</bean>
    	
    	<!-- Pass the session factory to our UserDao -->
    	<bean id="userDao" class="com.mpom.dao.HibernateUserDao">
    		<property name="sessionFactory"><ref local="sessionFactory"/></property>
    	</bean>
    	
    		<!-- Pass the session factory to our MemberProfileDao -->
    	<bean id="memberProfileDao" class="com.mpom.dao.HibernateMemberProfileDao">
    		<property name="sessionFactory"><ref local="sessionFactory"/></property>
    	</bean>
    	
    	<!-- Pass the session factory to our MemberProfileDao -->
    	<bean id="productDao" class="com.mpom.dao.HibernateProductDao">
    		<property name="sessionFactory"><ref local="sessionFactory"/></property>
    	</bean>
    	
    	<bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager">
           <property name="sessionFactory"><ref bean="sessionFactory"/></property>
        </bean>
        
        <bean id="transactionTemplate" class="org.springframework.transaction.support.TransactionTemplate">
        		<property name="transactionManager">
        			<ref bean="transactionManager"/>
        		</property>
        </bean>
        
        <bean id="userService" class="com.mpom.service.UserServiceImpl">
        		<property name="transactionTemplate">
        			<ref bean="transactionTemplate"/>
        		</property>
        </bean>
        
       
    </beans>
    Code:
    applicationContext.xml
    
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http&#58;//www.springframework.org/dtd/spring-beans.dtd">
    
    <!--
      - Application context containing authentication, channel
      - security and web URI beans.
      -
      - Only used by "filter" artifact.
      -->
    
    <beans>
        <!-- define data source -->=
       
       <!-- we want to encode the passwords -->
       <bean id="passwordEncoder" class="net.sf.acegisecurity.providers.encoding.ShaPasswordEncoder"/>
       
       <!-- use the jdbcDaoImpl provided by the acegi framework and pass an instance of the dataSource -->
       <bean id="jdbcDaoImpl" class="net.sf.acegisecurity.providers.dao.jdbc.JdbcDaoImpl">
          <property name="usersByUsernameQuery"><value>SELECT USERNAME,PASSWORD,ENABLED FROM USER WHERE USERNAME = ?</value></property>
          <property name="authoritiesByUsernameQuery"><value>SELECT USERNAME,AUTHORITY FROM AUTHORITIES WHERE USERNAME = ?</value></property>
          <property name="dataSource"><ref bean="dataSource"/></property>
       </bean>
       
       <!--  jdbc authentication should be listed as the provider -->
       <bean id="daoAuthenticationProvider" class="net.sf.acegisecurity.providers.dao.DaoAuthenticationProvider">
          <property name="authenticationDao"><ref local="jdbcDaoImpl"/></property>
          <!-- not caching credentials -->
          <!--<property name="userCache"><ref local="userCache"/></property>-->
          <!-- <property name="passwordEncoder"><ref local="passwordEncoder"/></property>-->
          
       </bean>    
       
       <!-- create authentication manager with DAO Authentication as sole provider -->
       <bean id="authenticationManager" class="net.sf.acegisecurity.providers.ProviderManager">
          <property name="providers">
             <list>
                <ref local="daoAuthenticationProvider"/>
             </list>
          </property>
       </bean>   
       
        <bean id="authenticationProcessingFilter" class="net.sf.acegisecurity.ui.webapp.AuthenticationProcessingFilter">
            <property name="authenticationManager">
                <ref bean="authenticationManager"/>
            </property>
            <property name="authenticationFailureUrl">
                <value>/index.jsp</value>
            </property>
            <property  name="defaultTargetUrl">
                <value>/home.jsp</value>
            </property>
            <property name="filterProcessesUrl">
                <value>/secure_logon</value>
            </property>
        </bean>   
    
       <!--
          - This filter is necessary because it provides the bridge between incoming
          - requests and the FilterSecurityInterceptor instance.
          -
          - http&#58;//acegisecurity.sourceforge.net/multiproject/acegi-security/apidocs/net/sf/acegisecurity/intercept/web/SecurityEnforcementFilter.html
          -->
       <bean    id="securityEnforcementFilter"
             class="net.sf.acegisecurity.intercept.web.SecurityEnforcementFilter">
    
          <property name="filterSecurityInterceptor">
               <ref bean="filterInvocationInterceptor"/>
           </property>
    
           <property name="authenticationEntryPoint">
               <ref bean="authenticationEntryPoint"/>
           </property>
       </bean>
       
      <!--
           - Used by the SecurityEnforcementFilter to commence authentication via the
           - AuthenticationProcessingFilter. This object holds the location of the login
           - form, relative to the web app context path, and is used to commence a redirect
           - to that form.
           -
          - http&#58;//acegisecurity.sourceforge.net/multiproject/acegi-security/apidocs/net/sf/acegisecurity/ui/webapp/AuthenticationProcessingFilterEntryPoint.html
          -->
       <bean    id="authenticationEntryPoint"
             class="net.sf.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint">
          
          <property name="loginFormUrl">
             <value>/index.jsp</value>
          </property>
            
          <property name="forceHttps">
             <value>false</value>
          </property>
          
          <property name="portMapper">
            <ref bean="portMapper"/>
          </property>
       </bean>
       
       <bean id="portMapper" class="net.sf.acegisecurity.util.PortMapperImpl"/>
       <!--
          - Performs security handling of HTTP resources via a filter implementation.
          -
          - http&#58;//acegisecurity.sourceforge.net/multiproject/acegi-security/apidocs/net/sf/acegisecurity/intercept/web/FilterSecurityInterceptor.html
          -->
       <bean    id="filterInvocationInterceptor"
             class="net.sf.acegisecurity.intercept.web.FilterSecurityInterceptor">
    
          <property name="authenticationManager">
               <ref bean="authenticationManager"/>
            </property>
    
           <property name="accessDecisionManager">
               <ref bean="accessDecisionManager"/>
            </property>
    
            <!-- hier kan je de patterns van de resources opgeven die gesecured moeten worden -->
           <property name="objectDefinitionSource">
               <value>
                   CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
                     PATTERN_TYPE_APACHE_ANT
                  	/secure/*=ROLE_REGISTERED_USER
                  	/memberprofile.do*=ROLE_REGISTERED_USER
                  	/home.jsp=ROLE_REGISTERED_USER
               </value>
           </property>
       </bean>
    
       <!--
          - Populates a SecureContext from the HttpSession.
          -
          - The filter will inspect the HttpSession for an attribute with the name
          - indicated by ACEGI_SECURITY_AUTHENTICATION_KEY. If that attribute contains an
          - instance of Authentication, it will be placed into the ContextHolder.
          -
          - http&#58;//acegisecurity.sourceforge.net/multiproject/acegi-security/apidocs/net/sf/acegisecurity/ui/webapp/HttpSessionIntegrationFilter.html
          -->
       <bean    id="httpSessionIntegrationFilter"
               class="net.sf.acegisecurity.ui.webapp.HttpSessionIntegrationFilter"/>
    
       <bean    id="accessDecisionManager"
             class="net.sf.acegisecurity.vote.UnanimousBased">
    
           <property name="allowIfAllAbstainDecisions">
               <value>false</value>
           </property>
    
           <property name="decisionVoters">
               <list>
                 <bean class="net.sf.acegisecurity.vote.RoleVoter"/>
               </list>
           </property>
       </bean>    
    
    </beans>
    Code:
    error message which is repeated until out of memory exception&#58;
    
    2005-07-21 11&#58;25&#58;02,360 INFO org.springframework.jdbc.support.SQLErrorCodesFactory - Database product name found in cache for DataSource &#91;org.apache.commons.dbcp.BasicDataSource@e23d66&#93;. Name is 'MySQL'.
    2005-07-21 11&#58;25&#58;02,361 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'transactionManager'
    2005-07-21 11&#58;25&#58;02,363 INFO org.springframework.orm.hibernate.HibernateTransactionManager - Using DataSource &#91;org.apache.commons.dbcp.BasicDataSource@e23d66&#93; of Hibernate SessionFactory for HibernateTransactionManager
    2005-07-21 11&#58;25&#58;02,364 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'transactionTemplate'
    2005-07-21 11&#58;25&#58;02,365 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'userService'
    2005-07-21 11&#58;25&#58;02,367 INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource &#91;databaseContext.xml&#93;
    2005-07-21 11&#58;25&#58;03,465 INFO org.springframework.context.support.ClassPathXmlApplicationContext - Bean factory for application context &#91;org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=2955762&#93;&#58; org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans &#91;dataSource,sessionFactory,userDao,memberProfileDao,productDao,transactionManager,transactionTemplate,userService&#93;; Root of BeanFactory hierarchy
    2005-07-21 11&#58;25&#58;03,467 INFO org.springframework.context.support.ClassPathXmlApplicationContext - 8 beans defined in ApplicationContext &#91;org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=2955762&#93;
    2005-07-21 11&#58;25&#58;03,469 INFO org.springframework.context.support.ClassPathXmlApplicationContext - No MessageSource found for context &#91;org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=2955762&#93;&#58; using empty default
    2005-07-21 11&#58;25&#58;03,471 INFO org.springframework.context.support.ClassPathXmlApplicationContext - No ApplicationEventMulticaster found for context &#91;org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=2955762&#93;&#58; using default
    2005-07-21 11&#58;25&#58;03,472 INFO org.springframework.context.support.ClassPathXmlApplicationContext - Refreshing listeners
    2005-07-21 11&#58;25&#58;03,474 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in factory &#91;org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans &#91;dataSource,sessionFactory,userDao,memberProfileDao,productDao,transactionManager,transactionTemplate,userService&#93;; Root of BeanFactory hierarchy&#93;
    2005-07-21 11&#58;25&#58;03,475 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'dataSource'
    2005-07-21 11&#58;25&#58;03,477 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'sessionFactory'
    2005-07-21 11&#58;25&#58;04,900 INFO org.springframework.orm.hibernate.LocalSessionFactoryBean - Building new Hibernate SessionFactory
    2005-07-21 11&#58;25&#58;06,127 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'userDao'
    2005-07-21 11&#58;25&#58;06,129 INFO org.springframework.jdbc.support.SQLErrorCodesFactory - Looking up default SQLErrorCodes for DataSource
    2005-07-21 11&#58;25&#58;06,131 INFO org.springframework.jdbc.support.SQLErrorCodesFactory - Database Product Name is MySQL
    2005-07-21 11&#58;25&#58;06,132 INFO org.springframework.jdbc.support.SQLErrorCodesFactory - Driver Version is mysql-connector-java-3.0.10-stable &#40; $Date&#58; 2004/01/13 21&#58;56&#58;18 $, $Revision&#58; 1.27.2.33 $ &#41;
    2005-07-21 11&#58;25&#58;06,134 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'memberProfileDao'
    2005-07-21 11&#58;25&#58;06,135 INFO org.springframework.jdbc.support.SQLErrorCodesFactory - Looking up default SQLErrorCodes for DataSource
    2005-07-21 11&#58;25&#58;07,225 INFO org.springframework.jdbc.support.SQLErrorCodesFactory - Database product name found in cache for DataSource &#91;org.apache.commons.dbcp.BasicDataSource@b4bc93&#93;. Name is 'MySQL'.
    2005-07-21 11&#58;25&#58;07,228 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'productDao'
    2005-07-21 11&#58;25&#58;07,230 INFO org.springframework.jdbc.support.SQLErrorCodesFactory - Looking up default SQLErrorCodes for DataSource
    2005-07-21 11&#58;25&#58;07,231 INFO org.springframework.jdbc.support.SQLErrorCodesFactory - Database product name found in cache for DataSource &#91;org.apache.commons.dbcp.BasicDataSource@b4bc93&#93;. Name is 'MySQL'.
    2005-07-21 11&#58;25&#58;07,232 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'transactionManager'
    2005-07-21 11&#58;25&#58;07,233 INFO org.springframework.orm.hibernate.HibernateTransactionManager - Using DataSource &#91;org.apache.commons.dbcp.BasicDataSource@b4bc93&#93; of Hibernate SessionFactory for HibernateTransactionManager
    2005-07-21 11&#58;25&#58;07,234 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'transactionTemplate'
    2005-07-21 11&#58;25&#58;07,235 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'userService'
    2005-07-21 11&#58;25&#58;07,237 INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource &#91;databaseContext.xml&#93;
    2005-07-21 11&#58;25&#58;07,247 INFO org.springframework.context.support.ClassPathXmlApplicationContext - Bean factory for application context &#91;org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=13131901&#93;&#58; org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans &#91;dataSource,sessionFactory,userDao,memberProfileDao,productDao,transactionManager,transactionTemplate,userService&#93;; Root of BeanFactory hierarchy
    2005-07-21 11&#58;25&#58;07,249 INFO org.springframework.context.support.ClassPathXmlApplicationContext - 8 beans defined in ApplicationContext &#91;org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=13131901&#93;
    2005-07-21 11&#58;25&#58;07,251 INFO org.springframework.context.support.ClassPathXmlApplicationContext - No MessageSource found for context &#91;org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=13131901&#93;&#58; using empty default
    2005-07-21 11&#58;25&#58;07,253 INFO org.springframework.context.support.ClassPathXmlApplicationContext - No ApplicationEventMulticaster found for context &#91;org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=13131901&#93;&#58; using default
    2005-07-21 11&#58;25&#58;07,254 INFO org.springframework.context.support.ClassPathXmlApplicationContext - Refreshing listeners
    2005-07-21 11&#58;25&#58;07,255 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in factory &#91;org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans &#91;dataSource,sessionFactory,userDao,memberProfileDao,productDao,transactionManager,transactionTemplate,userService&#93;; Root of BeanFactory hierarchy&#93;
    2005-07-21 11&#58;25&#58;07,256 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'dataSource'
    2005-07-21 11&#58;25&#58;07,258 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'sessionFactory'
    2005-07-21 11&#58;25&#58;08,710 INFO org.springframework.orm.hibernate.LocalSessionFactoryBean - Building new Hibernate SessionFactory
    2005-07-21 11&#58;25&#58;10,968 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'userDao'
    2005-07-21 11&#58;25&#58;10,971 INFO org.springframework.jdbc.support.SQLErrorCodesFactory - Looking up default SQLErrorCodes for DataSource
    2005-07-21 11&#58;25&#58;10,973 INFO org.springframework.jdbc.support.SQLErrorCodesFactory - Database Product Name is MySQL
    2005-07-21 11&#58;25&#58;10,975 INFO org.springframework.jdbc.support.SQLErrorCodesFactory - Driver Version is mysql-connector-java-3.0.10-stable &#40; $Date&#58; 2004/01/13 21&#58;56&#58;18 $, $Revision&#58; 1.27.2.33 $ &#41;
    2005-07-21 11&#58;25&#58;10,976 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'memberProfileDao'
    2005-07-21 11&#58;25&#58;10,977 INFO org.springframework.jdbc.support.SQLErrorCodesFactory - Looking up default SQLErrorCodes for DataSource
    2005-07-21 11&#58;25&#58;10,978 INFO org.springframework.jdbc.support.SQLErrorCodesFactory - Database product name found in cache for DataSource &#91;org.apache.commons.dbcp.BasicDataSource@d8e54c&#93;. Name is 'MySQL'.
    2005-07-21 11&#58;25&#58;10,979 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'productDao'
    2005-07-21 11&#58;25&#58;10,981 INFO org.springframework.jdbc.support.SQLErrorCodesFactory - Looking up default SQLErrorCodes for DataSource
    2005-07-21 11&#58;25&#58;10,982 INFO org.springframework.jdbc.support.SQLErrorCodesFactory - Database product name found in cache for DataSource &#91;org.apache.commons.dbcp.BasicDataSource@d8e54c&#93;. Name is 'MySQL'.
    2005-07-21 11&#58;25&#58;10,983 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'transactionManager'
    2005-07-21 11&#58;25&#58;10,984 INFO org.springframework.orm.hibernate.HibernateTransactionManager - Using DataSource &#91;org.apache.commons.dbcp.BasicDataSource@d8e54c&#93; of Hibernate SessionFactory for HibernateTransactionManager
    2005-07-21 11&#58;25&#58;10,985 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'transactionTemplate'
    2005-07-21 11&#58;25&#58;10,987 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'userService'
    2005-07-21 11&#58;25&#58;10,989 INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource &#91;databaseContext.xml&#93;
    2005-07-21 11&#58;25&#58;11,001 INFO org.springframework.context.support.ClassPathXmlApplicationContext - Bean factory for application context &#91;org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=11936163&#93;&#58; org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans &#91;dataSource,sessionFactory,userDao,memberProfileDao,productDao,transactionManager,transactionTemplate,userService&#93;; Root of BeanFactory hierarchy
    2005-07-21 11&#58;25&#58;11,005 INFO org.springframework.context.support.ClassPathXmlApplicationContext - 8 beans defined in ApplicationContext &#91;org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=11936163&#93;
    2005-07-21 11&#58;25&#58;11,007 INFO org.springframework.context.support.ClassPathXmlApplicationContext - No MessageSource found for context &#91;org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=11936163&#93;&#58; using empty default
    2005-07-21 11&#58;25&#58;11,009 INFO org.springframework.context.support.ClassPathXmlApplicationContext - No ApplicationEventMulticaster found for context &#91;org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=11936163&#93;&#58; using default
    2005-07-21 11&#58;25&#58;11,011 INFO org.springframework.context.support.ClassPathXmlApplicationContext - Refreshing listeners
    2005-07-21 11&#58;25&#58;11,012 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in factory &#91;org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans &#91;dataSource,sessionFactory,userDao,memberProfileDao,productDao,transactionManager,transactionTemplate,userService&#93;; Root of BeanFactory hierarchy&#93;
    2005-07-21 11&#58;25&#58;11,013 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'dataSource'
    2005-07-21 11&#58;25&#58;11,015 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'sessionFactory'
    2005-07-21 11&#58;25&#58;13,590 INFO org.springframework.orm.hibernate.LocalSessionFactoryBean - Building new Hibernate SessionFactory
    ^C2005-07-21 11&#58;25&#58;14,810 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'userDao'
    2005-07-21 11&#58;25&#58;14,812 INFO org.springframework.jdbc.support.SQLErrorCodesFactory - Looking up default SQLErrorCodes for DataSource
    2005-07-21 11&#58;25&#58;14,816 INFO org.springframework.jdbc.support.SQLErrorCodesFactory - Database Product Name is MySQL
    2005-07-21 11&#58;25&#58;14,817 INFO org.springframework.jdbc.support.SQLErrorCodesFactory - Driver Version is mysql-connector-java-3.0.10-stable &#40; $Date&#58; 2004/01/13 21&#58;56&#58;18 $, $Revision&#58; 1.27.2.33 $ &#41;
    2005-07-21 11&#58;25&#58;14,818 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'memberProfileDao'
    2005-07-21 11&#58;25&#58;14,820 INFO org.springframework.jdbc.support.SQLErrorCodesFactory - Looking up default SQLErrorCodes for DataSource
    2005-07-21 11&#58;25&#58;14,821 INFO org.springframework.jdbc.support.SQLErrorCodesFactory - Database product name found in cache for DataSource &#91;org.apache.commons.dbcp.BasicDataSource@808228&#93;. Name is 'MySQL'.
    2005-07-21 11&#58;25&#58;14,844 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'productDao'
    2005-07-21 11&#58;25&#58;14,846 INFO org.springframework.jdbc.support.SQLErrorCodesFactory - Looking up default SQLErrorCodes for DataSource
    2005-07-21 11&#58;25&#58;14,847 INFO org.springframework.jdbc.support.SQLErrorCodesFactory - Database product name found in cache for DataSource &#91;org.apache.commons.dbcp.BasicDataSource@808228&#93;. Name is 'MySQL'.
    2005-07-21 11&#58;25&#58;14,848 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'transactionManager'
    2005-07-21 11&#58;25&#58;14,849 INFO org.springframework.orm.hibernate.HibernateTransactionManager - Using DataSource &#91;org.apache.commons.dbcp.BasicDataSource@808228&#93; of Hibernate SessionFactory for HibernateTransactionManager
    2005-07-21 11&#58;25&#58;14,851 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'transactionTemplate'
    2005-07-21 11&#58;25&#58;14,852 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'userService'
    2005-07-21 11&#58;25&#58;14,863 INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource &#91;databaseContext.xml&#93;
    2005-07-21 11&#58;25&#58;14,880 INFO org.springframework.context.support.ClassPathXmlApplicationContext - Bean factory for application context &#91;org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=4295044&#93;&#58; org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans &#91;dataSource,sessionFactory,userDao,memberProfileDao,productDao,transactionManager,transactionTemplate,userService&#93;; Root of BeanFactory hierarchy
    2005-07-21 11&#58;25&#58;14,883 INFO org.springframework.context.support.ClassPathXmlApplicationContext - 8 beans defined in ApplicationContext &#91;org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=4295044&#93;
    2005-07-21 11&#58;25&#58;14,885 INFO org.springframework.context.support.ClassPathXmlApplicationContext - No MessageSource found for context &#91;org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=4295044&#93;&#58; using empty default
    2005-07-21 11&#58;25&#58;14,888 INFO org.springframework.context.support.ClassPathXmlApplicationContext - No ApplicationEventMulticaster found for context &#91;org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=4295044&#93;&#58; using default
    2005-07-21 11&#58;25&#58;14,889 INFO org.springframework.context.support.ClassPathXmlApplicationContext - Refreshing listeners
    2005-07-21 11&#58;25&#58;14,890 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in factory &#91;org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans &#91;dataSource,sessionFactory,userDao,memberProfileDao,productDao,transactionManager,transactionTemplate,userService&#93;; Root of BeanFactory hierarchy&#93;
    2005-07-21 11&#58;25&#58;14,892 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'dataSource'
    2005-07-21 11&#58;25&#58;14,894 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'sessionFactory' ....
    
    
    ERROR 2005-07-21 10&#58;57&#58;04,724 &#91;org.springframework.web.context.ContextLoader&#93;  - Context initialization failed
     org.springframework.beans.factory.BeanCreationException&#58; Error creating bean with name 'userService' defined in resource &#91;/WEB-INF/classes/databaseCon
    text.xml&#93; of ServletContext&#58; Instantiation of bean failed; nested exception is org.springframework.beans.FatalBeanException&#58; Could not instantiate clas
    s &#91;com.mpom.service.UserServiceImpl&#93;; constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException&#58; Error c
    reating bean with name 'userService' defined in class path resource &#91;databaseContext.xml&#93;&#58; Instantiation of bean failed; nested exception is org.spring
    framework.beans.FatalBeanException&#58; Could not instantiate class &#91;com.mpom.service.UserServiceImpl&#93;; constructor threw exception; nested exception is or
    g.springframework.beans.factory.BeanCreationException&#58; Error creating bean with name 'userService' defined in class path resource &#91;databaseContext.xml&#93;
    &#58; Instantiation of bean failed; nested exception is org.springframework.beans.FatalBeanException&#58; Could not instantiate class &#91;com.mpom.service.UserSer
    viceImpl&#93;; constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException&#58; Error creating bean with name 'use
    rService' defined in class path resource &#91;databaseContext.xml&#93;&#58; Instantiation of bean failed; nested exception is org.springframework.beans.FatalBeanEx
    ception&#58; Could not instantiate class &#91;com.mpom.service.UserServiceImpl&#93;; constructor threw exception; nested exception is org.springframework.beans.fac
    tory.BeanCreationException&#58; Error creating bean with name 'userService' defined in class path resource &#91;databaseContext.xml&#93;&#58; Instantiation of bean fai
    led; nested exception is org.springframework.beans.FatalBeanException&#58; Could not instantiate class &#91;com.mpom.service.UserServiceImpl&#93;; constructor thre
    w exception; nested exception is org.springframework.beans.factory.BeanCreationException&#58; Error creating bean with name 'userService' defined in class 
    path resource &#91;databaseContext.xml&#93;&#58; Instantiation of bean failed; nested exception is org.springframework.beans.FatalBeanException&#58; Could not instanti
    ate class &#91;com.mpom.service.UserServiceImpl&#93;; constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException&#58;
     Error creating bean with name 'userService' defined in class path resource &#91;databaseContext.xml&#93;&#58; Instantiation of bean failed; nested exception is or
    g.springframework.beans.FatalBeanException&#58; Could not instantiate class &#91;com.mpom.service.UserServiceImpl&#93;; constructor threw exception; nested excepti
    on is org.springframework.beans.factory.BeanCreationException&#58; Error creating bean with name 'userService' defined in class path resource &#91;databaseCont
    ext.xml&#93;&#58; Instantiation of bean failed; nested exception is org.springframework.beans.FatalBeanException&#58; Could not instantiate class &#91;com.mpom.service
    .UserServiceImpl&#93;; constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException&#58; Error creating bean with n
    ame 'userService' defined in class path resource &#91;databaseContext.xml&#93;&#58; Instantiation of bean failed; nested exception is org.springframework.beans.Fat
    alBeanException&#58; Could not instantiate class &#91;com.mpom.service.UserServiceImpl&#93;; constructor threw exception; nested exception is org.springframework.b
    eans.factory.BeanCreationException&#58; Error creating bean with name 'userService' defined in class path resource &#91;databaseContext.xml&#93;&#58; Instantiation of 
    bean failed; nested exception is org.springframework.beans.FatalBeanException&#58; Could not instantiate class &#91;com.mpom.service.UserServiceImpl&#93;; ...

  • #2
    You need to show us the source of com.mpom.service.UserServiceImpl.

    Comment


    • #3
      Here is the UserServiceImpl source:

      Code:
      /*
       * Created on Mar 29, 2005
       *
       * TODO To change the template for this generated file go to
       * Window - Preferences - Java - Code Style - Code Templates
       */
      package com.mpom.service;
      
      import org.apache.commons.logging.Log;
      import org.apache.commons.logging.LogFactory;
      import org.springframework.context.ApplicationContext;
      import org.springframework.context.support.ClassPathXmlApplicationContext;
      import org.springframework.transaction.support.*;
      import org.springframework.transaction.*;
      
      import com.mpom.beans.*;
      import com.mpom.dao.*;
      import com.mpom.security.PFProJava;
      import com.mpom.util.MailManager;
      import com.mpom.util.MailManagerImpl;
      
      import com.mpom.action.ex.*;
      
      import java.util.*;
      
      
      public class UserServiceImpl implements UserService &#123;
      	
          protected static Log log = LogFactory.getLog&#40;UserServiceImpl.class&#41;;
          private ApplicationContext context = new ClassPathXmlApplicationContext&#40;"databaseContext.xml"&#41;;
          //MemberProfileDao memberDao = &#40;MemberProfileDao&#41; context.getBean&#40;"memberProfileDao"&#41;;
          //UserDao userDao = &#40;UserDao&#41; context.getBean&#40;"userDao"&#41;;
          //ProductDao productDao = &#40;ProductDao&#41; context.getBean&#40;"productDao"&#41;;
          private ProductDao productDao;
          private MemberProfileDao memberDao;
          private UserDao userDao;
          private TransactionTemplate transactionTemplate;
          
      	public boolean createUser&#40;final User user, final Order order, final Map map&#41; &#123;
      		boolean success = true;
              
              transactionTemplate.execute&#40;
                      new TransactionCallback&#40;&#41; &#123;
                          public Object doInTransaction&#40;TransactionStatus ts&#41; &#123;
                              try &#123;
                                  userDao.store&#40;user, order&#41;;
                                  log.debug&#40;new Date&#40;&#41;+"Before Credit card processing."&#41;;
                                  if &#40;!PFProJava.processCreditCard&#40;map&#41;&#41; &#123;
                                      log.debug&#40;new Date&#40;&#41;+"Credit card is declined"&#41;;
                                      throw new Exception&#40;"Credit Card Declined"&#41;;
                                  &#125;
                                  log.debug&#40;new Date&#40;&#41;+"After Credit card processing."&#41;;
                                  MailManager cm = new MailManagerImpl&#40;&#41;;
                                  cm.sendEmail&#40;user.getUsername&#40;&#41;, "Welcome to peaceofmind message soon to come.", "Contact Us","[email protected]"&#41;;
                                  
                              &#125; catch &#40;Exception e&#41; &#123;
                                  ts.setRollbackOnly&#40;&#41;;
                              &#125;
                              
                              return null;
                          &#125;
                      &#125;
                      &#41;;
              
      		return success;
      	&#125;
      	
      	public User findByUsername&#40;String username&#41; &#123;
      		User user = null;
      		user = userDao.findByUsername&#40;username&#41;;
      		return user;
      	&#125;
          
          public User findUserById&#40;Long id&#41; &#123;
              User user = userDao.findUserById&#40;id&#41;;
              return user;
          &#125;
          
          public UserAddress findAddressByType&#40;long uid, String type&#41; &#123;
              UserAddress ua = userDao.findAddressByType&#40;uid,type&#41;;
              return ua;
          &#125;
      	
      	// Bank account
      	public void insertBankAccount&#40;BankAccount b&#41; &#123;
      		memberDao.insertBankAccount&#40;b&#41;;
      	&#125;
      	
      	public List findBankAccountsByUserId&#40;int id&#41; &#123;
      		List list = null;
      		list = memberDao.findBankAccountsByUserId&#40;new Integer&#40;id&#41;&#41;;
      		return list;
      	&#125;
      	
      	public BankAccount findBankAccountByUserIdAccountId&#40;int userId, int accountId&#41; &#123;
      		BankAccount ba = memberDao.findBankAccountByUserIdAccountId&#40;new Integer&#40;userId&#41;, new Integer&#40;accountId&#41;&#41;;
      		return ba;
      	&#125;
      	
          public void removeBankAccount&#40;int userId, int bondId&#41; &#123;
          	BankAccount bond = findBankAccountByUserIdAccountId&#40;userId,bondId&#41;;  
              
              try &#123;
                  if &#40;bond == null&#41; &#123;
                   throw new ItemDoesNotExistException&#40;&#41;;   
                  &#125;
                      memberDao.removeBankAccount&#40;bond&#41;;   
              &#125; catch&#40;Exception ex&#41; &#123;
                  ex.printStackTrace&#40;&#41;;
              &#125;
          &#125;
      	
      	//Bonds
      	public void insertBond&#40;Bond b&#41; &#123;
      		memberDao.insertBond&#40;b&#41;;
      	&#125;
      	
      	public List findBondByUserId&#40;int id&#41; &#123;
      		List list = null;
      		list = memberDao.findBondsByUserId&#40;new Integer&#40;id&#41;&#41;;
      		return list;
      	&#125;
      	
      	public Bond findBondByUserIdBondId&#40;int userId, int bondId&#41; &#123;
      		Bond bond = memberDao.findBondByUserIdBondId&#40;new Integer&#40;userId&#41;, new Integer&#40;bondId&#41;&#41;;
      		return bond;
      	&#125;
          
          public void removeBond&#40;int userId, int bondId&#41; &#123;
              Bond bond = findBondByUserIdBondId&#40;userId,bondId&#41;;  
              
              try &#123;
                  if &#40;bond == null&#41; &#123;
                      throw new ItemDoesNotExistException&#40;&#41;;
                  &#125; 
                  memberDao.removeBond&#40;bond&#41;;
              &#125; catch &#40;Exception ex&#41; &#123;
                  ex.printStackTrace&#40;&#41;;
              &#125;
              
          &#125;
      
      	//Brokers
      	public void insertBroker&#40;Broker b&#41; &#123;
      		memberDao.insertBroker&#40;b&#41;;
      	&#125;
      	
      	public List findBrokerByUserId&#40;int id&#41; &#123;
      		List list = null;
      		list = memberDao.findBrokersByUserId&#40;new Integer&#40;id&#41;&#41;;
      		return list;
      	&#125;
      	
      	public Broker findBrokerByUserIdBrokerId&#40;int userId, int bondId&#41; &#123;
      		Broker broker = memberDao.findBrokerByUserIdBrokerId&#40;new Integer&#40;userId&#41;, new Integer&#40;bondId&#41;&#41;;
      		return broker;
      	&#125;
          
          public void removeBroker&#40;int userId, int brokerId&#41; &#123;
              Broker b = findBrokerByUserIdBrokerId&#40;userId,brokerId&#41;;  
              
              try &#123;
                  if &#40;b == null&#41; &#123;
                      throw new ItemDoesNotExistException&#40;&#41;;
                  &#125;
                  memberDao.removeBroker&#40;b&#41;;
              &#125; catch &#40;Exception ex&#41; &#123;
                  ex.printStackTrace&#40;&#41;;
              &#125;
          &#125;
      	
      	//Cd's
      	public void insertCD&#40;CD c&#41; &#123;
      		memberDao.insertCD&#40;c&#41;;
      	&#125;
      	
      	public List findCDByUserId&#40;int id&#41; &#123;
      		List list = null;
      		list = memberDao.findCDByUserId&#40;new Integer&#40;id&#41;&#41;;
      		return list;
      	&#125;
      	
      	public CD findCDByUserIdCDId&#40;int userId, int cdId&#41; &#123;
      		CD cd = memberDao.findCDByUserIdCDId&#40;new Integer&#40;userId&#41;, new Integer&#40;cdId&#41;&#41;;
      		return cd;
      	&#125;
      	
          public void removeCD&#40;int userId, int sId&#41; &#123;
          	CD sdb = findCDByUserIdCDId&#40;userId,sId&#41;;  
              
              try &#123;
                  if &#40;sdb == null&#41; &#123;
                      throw new ItemDoesNotExistException&#40;&#41;;
                  &#125;
                  memberDao.removeCD&#40;sdb&#41;;
              &#125; catch &#40;Exception ex&#41; &#123;
                  ex.printStackTrace&#40;&#41;;
              &#125;
               
              
          &#125;
      	
      	//Stocks
      	public void insertStock&#40;Stock s&#41; &#123;
      		memberDao.insertStock&#40;s&#41;;
      	&#125;
      	
      	public List findStockByUserId&#40;int id&#41; &#123;
      		List list = null;
      		list = memberDao.findStocksByUserId&#40;new Integer&#40;id&#41;&#41;;
      		return list;
      	&#125;
      	
      	public Stock findStockByUserIdStockId&#40;int userId, int sId&#41; &#123;
      		Stock s = memberDao.findStockByUserIdStockId&#40;new Integer&#40;userId&#41;, new Integer&#40;sId&#41;&#41;;
      		return s;
      	&#125;
      	
          public void removeStock&#40;int userId, int sId&#41; &#123;
          	Stock sdb = findStockByUserIdStockId&#40;userId,sId&#41;;  
              
              try &#123;
                  if &#40;sdb == null&#41; &#123;
                      throw new ItemDoesNotExistException&#40;&#41;;
                  &#125;
                  memberDao.removeStock&#40;sdb&#41;;
              &#125; catch&#40;Exception ex&#41; &#123;
                  ex.printStackTrace&#40;&#41;;
              &#125;
              
          &#125;
      
          //CC's
          public void insertCreditCard&#40;CreditCard c&#41; &#123;
              memberDao.insertCreditCard&#40;c&#41;;
          &#125;
          
          public List findCreditCardByUserId&#40;int id&#41; &#123;
              List list = null;
              list = memberDao.findCreditCardByUserId&#40;new Integer&#40;id&#41;&#41;;
              return list;
          &#125;
        
          public CreditCard findCreditCardByUserIdCreditCardId&#40;int userId, int ccId&#41; &#123;
              CreditCard cc = memberDao.findCreditCardByUserIdCreditCardId&#40;new Integer&#40;userId&#41;, new Integer&#40;ccId&#41;&#41;;
              return cc;
          &#125;
          
          public void removeCreditCard&#40;int userId, int sId&#41; &#123;
          	CreditCard sdb = findCreditCardByUserIdCreditCardId&#40;userId,sId&#41;;  
              
              try &#123;
                  if &#40;sdb == null&#41; &#123;
                      throw new ItemDoesNotExistException&#40;&#41;;
                  &#125;
                  memberDao.removeCreditCard&#40;sdb&#41;;
                  
              &#125; catch &#40;Exception ex&#41; &#123;
                  ex.printStackTrace&#40;&#41;;
              &#125;
              
          &#125;
          
          //Document's
          public void insertDocument&#40;Document c&#41; &#123;
              memberDao.insertDocument&#40;c&#41;;
          &#125;
          
          public List findDocumentByUserId&#40;int id&#41; &#123;
              List list = null;
              list = memberDao.findDocumentByUserId&#40;new Integer&#40;id&#41;&#41;;
              return list;
          &#125;
        
          public Document findDocumentByUserIdDocumentId&#40;int userId, int ccId&#41; &#123;
              Document cc = memberDao.findDocumentByUserIdDocumentId&#40;new Integer&#40;userId&#41;, new Integer&#40;ccId&#41;&#41;;
              return cc;
          &#125;
      	
          public void removeDocument&#40;int userId, int sId&#41; &#123;
          	Document sdb = findDocumentByUserIdDocumentId&#40;userId,sId&#41;;  
              
              try &#123;
                  if &#40;sdb == null&#41; &#123;
                      throw new ItemDoesNotExistException&#40;&#41;;
                  &#125;
                  
                  memberDao.removeDocument&#40;sdb&#41;;
              &#125; catch &#40;Exception ex&#41; &#123;
                  ex.printStackTrace&#40;&#41;;
              &#125;
              
          &#125;
          
          //Investments
          public void insertInvestment&#40;Investment c&#41; &#123;
              memberDao.insertInvestment&#40;c&#41;;
          &#125;
          
          public List findInvestmentsByUserId&#40;int id&#41; &#123;
              List list = null;
              list = memberDao.findInvestmentByUserId&#40;new Integer&#40;id&#41;&#41;;
              return list;
          &#125;
        
          public Investment findInvestmentByUserIdInvestmentId&#40;int userId, int ccId&#41; &#123;
              Investment cc = memberDao.findInvestmentByUserIdInvestmentId&#40;new Integer&#40;userId&#41;, new Integer&#40;ccId&#41;&#41;;
              return cc;
          &#125;
          
          public void removeInvestment&#40;int userId, int sId&#41; &#123;
          	Investment sdb = findInvestmentByUserIdInvestmentId&#40;userId,sId&#41;;  
              
              try &#123;
                  if &#40;sdb == null&#41; &#123;
                      throw new ItemDoesNotExistException&#40;&#41;;
                  &#125;
                  memberDao.removeInvestment&#40;sdb&#41;;
              &#125; catch &#40;Exception ex&#41; &#123;
                  ex.printStackTrace&#40;&#41;;
              &#125;
              
          &#125;
      	
          
          //LifeIns
          public void insertLifeInsurance&#40;LifeInsurance c&#41; &#123;
              memberDao.insertLifeInsurance&#40;c&#41;;
          &#125;
          
          public List findLifeInsuranceByUserId&#40;int id&#41; &#123;
              List list = null;
              list = memberDao.findLifeInsuranceByUserId&#40;new Integer&#40;id&#41;&#41;;
              return list;
          &#125;
        
          public LifeInsurance findLifeInsuranceByUserIdLifeInsuranceId&#40;int userId, int ccId&#41; &#123;
              LifeInsurance cc = memberDao.findLifeInsuranceByUserIdLifeInsuranceId&#40;new Integer&#40;userId&#41;, new Integer&#40;ccId&#41;&#41;;
              return cc;
          &#125;
          
          public void removeLifeInsurance&#40;int userId, int sId&#41; &#123;
          	LifeInsurance sdb = findLifeInsuranceByUserIdLifeInsuranceId&#40;userId,sId&#41;; 
              
              try &#123;
                  if &#40;sdb == null&#41; &#123;
                      throw new ItemDoesNotExistException&#40;&#41;;
                  &#125;
                  memberDao.removeLifeInsurance&#40;sdb&#41;;
              &#125; catch &#40;Exception ex&#41; &#123;
                  ex.printStackTrace&#40;&#41;;
              &#125;
          &#125;
      	
          
          //Payment
          public void insertPayment&#40;Payment c&#41; &#123;
              memberDao.insertPayment&#40;c&#41;;
          &#125;
          
          public List findPaymentByUserId&#40;int id&#41; &#123;
              List list = null;
              list = memberDao.findPaymentByUserId&#40;new Integer&#40;id&#41;&#41;;
              return list;
          &#125;
        
          public Payment findPaymentByUserIdPaymentId&#40;int userId, int ccId&#41; &#123;
              Payment cc = memberDao.findPaymentByUserIdPaymentId&#40;new Integer&#40;userId&#41;, new Integer&#40;ccId&#41;&#41;;
              return cc;
          &#125;
          
          public void removePayment&#40;int userId, int sId&#41; &#123;
          	Payment sdb = findPaymentByUserIdPaymentId&#40;userId,sId&#41;;  
              
              try &#123;
                  if &#40;sdb == null&#41; &#123;
                      throw new ItemDoesNotExistException&#40;&#41;;
                  &#125;
                  memberDao.removePayment&#40;sdb&#41;;
                  
              &#125; catch &#40;Exception ex&#41; &#123;
                  ex.printStackTrace&#40;&#41;;
              &#125;
              
          &#125;
          
          //Advisor
          public void insertAdvisor&#40;FinancialLegalAdvisor a&#41; &#123;
              memberDao.insertAdvisor&#40;a&#41;;
          &#125;
          
          public FinancialLegalAdvisor findAdvisorByUserIdAdvisorId&#40;int userId, int advisorId&#41; &#123;
              FinancialLegalAdvisor advisor = memberDao.findAdvisorByUserIdAdvisorId&#40;new Integer&#40;userId&#41;, new Integer&#40;advisorId&#41;&#41;;
              return advisor;
          &#125;
          
          public List findAdvisorsByUserId&#40;int id&#41; &#123;
              return  memberDao.findAdvisorsByUserId&#40;new Integer&#40;id&#41;&#41;;
          &#125;
          
          public void removeAdvisor&#40;int userId, int advisorId&#41; &#123;
              FinancialLegalAdvisor advisor = null;
              advisor = findAdvisorByUserIdAdvisorId&#40;userId,advisorId&#41;;  
              
              try &#123;
                  
                  if &#40;advisor == null&#41; &#123;
                      throw new ItemDoesNotExistException&#40;&#41;;
                  &#125;
                  
                  memberDao.removeAdvisor&#40;advisor&#41;;
                  
              &#125; catch&#40;Exception ex&#41; &#123;
                  ex.printStackTrace&#40;&#41;;
              &#125;
      
          &#125;
          
          
          //Services and products
          public List findAllServices&#40;&#41; &#123;
              List list = null;
              list = productDao.findAllServices&#40;&#41;;
              return list;
          &#125;
          
          public Product findProductById&#40;int id&#41; &#123;
              return productDao.findByProductId&#40;id&#41;;
          &#125;
          
          public List findAllProducts&#40;&#41; &#123;
              List list = null;
              list = productDao.findAllProducts&#40;&#41;;
              return list;
          &#125;
          
          public List findAllPolicies&#40;&#41; &#123;
              List list = null;
              list = productDao.findAllPolicies&#40;&#41;;
              return list;
          &#125;
          
          public ServiceInformation findServiceInformationById&#40;int id&#41; &#123;
              ServiceInformation si = productDao.findServiceInformationById&#40;id&#41;;
              return si;
          &#125;
          
          public Policy findPolicyById&#40;int id&#41; &#123;
              Policy p = productDao.findPolicyById&#40;id&#41;;
              return p;
          &#125;
      	
      	public String findProductPriceById&#40;int id&#41; &#123;
      		Product p = productDao.findByProductId&#40;id&#41;;
      		return  p.getPrice&#40;&#41;.toString&#40;&#41;;
      	&#125;
      	
      	//Mutual Fund
      	
          public void insertMutualFund&#40;MutualFund a&#41; &#123;
              memberDao.insertMutualFund&#40;a&#41;;
          &#125;
          
          public MutualFund findMutualFundByUserIdMutualFundId&#40;int userId, int mfId&#41; &#123;
          	MutualFund fund = memberDao.findMutualFundByUserIdMutualFundId&#40;new Integer&#40;userId&#41;, new Integer&#40;mfId&#41;&#41;;
              return fund;
          &#125;
          
          public List findMutualFundsByUserId&#40;int id&#41; &#123;
              return  memberDao.findMutualFundsByUserId&#40;new Integer&#40;id&#41;&#41;;
          &#125;
          
          public void removeMutualFunds&#40;int userId, int mfId&#41; &#123;
              MutualFund fund = findMutualFundByUserIdMutualFundId&#40;userId,mfId&#41;; 
              
              try &#123;
                  if &#40;fund == null&#41; &#123;
                      throw new ItemDoesNotExistException&#40;&#41;;
                  &#125;
                  memberDao.removeMutualFund&#40;fund&#41;;
              &#125; catch &#40;Exception ex&#41; &#123;
                  ex.printStackTrace&#40;&#41;;
              &#125;
              
          &#125;
          
          // Security
          
          public void insertSecurity&#40;Security a&#41; &#123;
              memberDao.insertSecurity&#40;a&#41;;
          &#125;
          
          public Security findSecurityByUserIdSecurityId&#40;int userId, int sId&#41; &#123;
          	Security security = memberDao.findSecurityByUserIdSecurityId&#40;new Integer&#40;userId&#41;, new Integer&#40;sId&#41;&#41;;
              return security;
          &#125;
          
          public List findSecuritiesByUserId&#40;int id&#41; &#123;
              return  memberDao.findSecuritiesByUserId&#40;new Integer&#40;id&#41;&#41;;
          &#125;
          
          public void removeSecurity&#40;int userId, int sId&#41; &#123;
          	Security security = findSecurityByUserIdSecurityId&#40;userId,sId&#41;;  
              
              try &#123;
                  if &#40;security == null&#41; &#123;
                      throw new ItemDoesNotExistException&#40;&#41;;
                  &#125;
                  memberDao.removeSecurity&#40;security&#41;;
              &#125; catch &#40;Exception ex&#41; &#123;
                  ex.printStackTrace&#40;&#41;;
              &#125;
              
          &#125;
          
          // Safety Deposit Boxes
          
          public void insertSafetyDepositBox&#40;SafetyDepositBox s&#41; &#123;
              memberDao.insertSafetyDepositBox&#40;s&#41;;
          &#125;
          
          public SafetyDepositBox findSafetyDepositBoxByUserIdSafetyDepositBoxId&#40;int userId, int sId&#41; &#123;
          	SafetyDepositBox sdb = memberDao.findSafetyDepositBoxByUserIdSafetyDepositBoxId&#40;new Integer&#40;userId&#41;, new Integer&#40;sId&#41;&#41;;
              return sdb;
          &#125;
          
          public List findSafetyDepositBoxesByUserId&#40;int id&#41; &#123;
              return  memberDao.findSafetyDepositBoxesByUserId&#40;new Integer&#40;id&#41;&#41;;
          &#125;
          
          public void removeSafetyDepositBox&#40;int userId, int sId&#41; &#123;
          	SafetyDepositBox sdb = findSafetyDepositBoxByUserIdSafetyDepositBoxId&#40;userId,sId&#41;;  
              
              try &#123;
                  if &#40;sdb == null&#41; &#123;
                      throw new ItemDoesNotExistException&#40;&#41;;
                  &#125;
                  memberDao.removeSafetyDepositBox&#40;sdb&#41;;
              &#125; catch &#40;Exception ex&#41; &#123;
                  ex.printStackTrace&#40;&#41;;
              &#125;
              
          &#125;
          
          // Pension
          
          public void insertPension&#40;Pension s&#41; &#123;
              memberDao.insertPension&#40;s&#41;;
          &#125;
          
          public Pension findPensionByUserIdPensionId&#40;int userId, int sId&#41; &#123;
          	Pension sdb = memberDao.findPensionByUserIdPensionId&#40;new Integer&#40;userId&#41;, new Integer&#40;sId&#41;&#41;;
              return sdb;
          &#125;
          
          public List findPensionsByUserId&#40;int id&#41; &#123;
              return  memberDao.findPensionsByUserId&#40;new Integer&#40;id&#41;&#41;;
          &#125;
          
          public void removePension&#40;int userId, int sId&#41; &#123;
          	Pension sdb = findPensionByUserIdPensionId&#40;userId,sId&#41;;  
              
              try &#123;
                  if &#40;sdb == null&#41; &#123;
                      throw new ItemDoesNotExistException&#40;&#41;;
                  &#125;
                  memberDao.removePension&#40;sdb&#41;;
              &#125; catch &#40;Exception ex&#41; &#123;
                  ex.printStackTrace&#40;&#41;;
              &#125;
              
          &#125;
          
          // RealEstate
          
          public void insertRealEstate&#40;RealEstate s&#41; &#123;
              memberDao.insertRealEstate&#40;s&#41;;
          &#125;
          
          public RealEstate findRealEstateByUserIdRealEstateId&#40;int userId, int sId&#41; &#123;
          	RealEstate sdb = memberDao.findRealEstateByUserIdRealEstateId&#40;new Integer&#40;userId&#41;, new Integer&#40;sId&#41;&#41;;
              return sdb;
          &#125;
          
          public List findRealEstatesByUserId&#40;int id&#41; &#123;
              return  memberDao.findRealEstatesByUserId&#40;new Integer&#40;id&#41;&#41;;
          &#125;
          
          public void removeRealEstate&#40;int userId, int sId&#41; &#123;
          	RealEstate sdb = findRealEstateByUserIdRealEstateId&#40;userId,sId&#41;;  
              
              try &#123;
                  if &#40;sdb == null&#41; &#123;
                      throw new ItemDoesNotExistException&#40;&#41;;
                  &#125;
                  memberDao.removeRealEstate&#40;sdb&#41;;
              &#125; catch &#40;Exception ex&#41; &#123;
                  ex.printStackTrace&#40;&#41;;
              &#125;
              
          &#125;
      &#125;

      Comment


      • #4
        all,

        it was simply user error. sorry for wasting your time.

        Comment

        Working...
        X