Results 1 to 5 of 5

Thread: Spring Managed Struts Action

  1. #1
    Join Date
    Jun 2005
    Posts
    26

    Default 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>tim@yahoo.com</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>
    Tonte Pouncil

  2. #2
    Join Date
    Jun 2005
    Posts
    26

    Default 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.
    Tonte Pouncil

  3. #3

    Default Re: Spring Managed Struts Action

    Quote 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

  4. #4
    Join Date
    Jun 2005
    Posts
    26

    Default Okay

    Okay I will do that now...
    Tonte Pouncil

  5. #5
    Join Date
    Jun 2005
    Posts
    26

    Default It worked

    Thanks sooooo much! It works

    Thanks!
    Tonte Pouncil

Similar Threads

  1. Spring MVC Web Framework versus Struts
    By biguniverse in forum Web Flow
    Replies: 27
    Last Post: Aug 29th, 2012, 03:57 AM
  2. Replies: 3
    Last Post: Jun 4th, 2008, 06:45 PM
  3. Replies: 4
    Last Post: Aug 1st, 2005, 03:45 PM
  4. Spring managed Struts Actions
    By drc in forum Web
    Replies: 2
    Last Post: Jul 14th, 2005, 10:46 AM
  5. Replies: 14
    Last Post: Feb 21st, 2005, 05:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •