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

  • Spring Managed Struts Action

    Hello,

    I am trying to do spring managed struts action via the org.springframework.web.struts.ContextLoaderPlugIn and the org.springframework.web.struts.DelegatingActionPro xy, but I am getting an error. Here is my error msg:

    Code:
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMapClient' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.FatalBeanException: Could not instantiate class [org.springframework.orm.ibatis.SqlMapClientFactoryBean]; constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com.ibatis.sqlmap.engine.transaction.external.ExternalTransactionConfig
    org.springframework.beans.FatalBeanException: Could not instantiate class [org.springframework.orm.ibatis.SqlMapClientFactoryBean]; constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com.ibatis.sqlmap.engine.transaction.external.ExternalTransactionConfig
    java.lang.NoClassDefFoundError: com.ibatis.sqlmap.engine.transaction.external.ExternalTransactionConfig

    All of my spring config files are located:
    /WEB-INF/

    MY struts plugin, located in my struts-config.xml, looks like so:

    Code:
    <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
    		<set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml"/>
    	</plug-in>

    My applicationContext.xml looks like so:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans
    	PUBLIC "-//SPRING//DTD BEAN//EN"
        "http&#58;//www.springframework.org/dtd/spring-beans.dtd">
        
    <beans>
    	<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    	  	<property name="driverClassName">
    	  		<!-- 
    	  		com.mysql.jdbc.Driver
    	  		org.gjt.mm.mysql.Driver
    	  		//-->
    	  		<value>org.gjt.mm.mysql.Driver</value>
    	  	</property>
    	  	
    	  	<property name="url">
    	  		<value>jdbc&#58;mysql&#58;//localhost&#58;3306/spring_test</value>
    	  	</property>
    	  	
    	  	<property name="username">
    	  		<value>username</value>
    	  	</property>
    	  	
    	  	<property name="password">
    	  		<value>pw</value>
    	  	</property>
    	</bean>
    		
    	<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
    		<property name="configLocation">
    			<value>/sqlMapConfig.xml</value>
    		</property>
    	</bean>
    	
    	<bean id="testDao" class="com.pouncil.common.dao.SqlMapClientTestDao">
      		<property name="sqlMapClient"><ref local="sqlMapClient"/></property>
    	  	<property name="dataSource"><ref local="dataSource"/></property>
      	</bean>
      	
      	<bean id="customerIbatisDao" class="com.pouncil.common.dao.ibatis.CustomerSqlMapDao">
      		<property name="sqlMapClient"><ref local="sqlMapClient"/></property>
    	  	<property name="dataSource"><ref local="dataSource"/></property>	  	
      	</bean>
      	
      	<bean id="customerService" class="com.pouncil.common.service.CustomerServiceImpl">
      		<constructor-arg>
      			<ref bean="customerIbatisDao"/>
      		</constructor-arg> 		
      	</bean>
      	
      	<bean id="customer" class="com.pouncil.common.pojo.model.Customer">
       		<property name="firstName">
      			<value>Frisco</value>
      		</property>
      		
      		<property name="middleName">
      			<value>DeShawn</value>
      		</property>
      		
      		<property name="lastName">
      			<value>Pullom</value>
      		</property>
      		
      		<property name="email">
      			<value>[email protected]</value>
      		</property>
      		
      		<property name="age">
      			<value>17</value>
      		</property>
      		
      		<property name="gender">
      			<value>male</value>
      		</property>
      		
      		<property name="ethnicity">
      			<value>Black</value>
      		</property>
      		
      		<property name="createdDate">
      			<value>12/01/2003</value>
      		</property>
      		
      		<property name="lastmodifiedDate">
      			<value>05/01/2005/</value>
      		</property>
      		
      		<property name="createdBy">
      			<value>spring-injection</value>
      		</property>
      		  		
      		<property name="lastmodifiedBy">
      			<value>spring-injection</value>
      		</property>
      	</bean> 
      	
      	<bean name="/scustomer" class="com.pouncil.web.struts.actions.SpringCustomerAction">
      		<property name="customerService"><ref local="customerService"/></property>
      	</bean>
      	
      	<bean name="/cajunfamily/scustomer" class="com.pouncil.web.struts.actions.SpringCustomerAction">
      		<property name="customerService"><ref local="customerService"/></property>
      	</bean> 
    </beans>

    My slqMapConfig.xml look like this:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE sqlMapConfig 
    	PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
        "http&#58;//www.ibatis.com/dtd/sql-map-config-2.dtd">
        
    <sqlMapConfig>
    	<sqlMap resource="/WEB-INF/customer-ibatis.xml"/>
    </sqlMapConfig>

  • #2
    My question continued...

    Oh

    I forgot to say that I get this error msg as soon as tomcat starts up. I don't know why I am getting this error. Please help me if you can.

    Thanks in advance.

    Comment


    • #3
      Re: Spring Managed Struts Action

      Originally posted by etnot
      java.lang.NoClassDefFoundError: com.ibatis.sqlmap.engine.transaction.external.Exte rnalTransactionConfig
      Seems like you're missing the ibatis jarfile. Make sure that it is located in WEB-INF/lib and populated correctly.

      Simon

      Comment


      • #4
        Okay

        Okay I will do that now...

        Comment


        • #5
          It worked

          Thanks sooooo much! It works

          Thanks!

          Comment

          Working...
          X