悠悠隐于市
2010-10-14 13:44
浏览 231
已采纳

Struts + ibatis +Spring整合时,报错?请朋友们帮忙看一下.谢谢。

010-10-14 13:22:04 Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@161509b: defining beans [sqlMapClient,baseDao,StudentDaoImpl,StudentServiceImpl,/student,transactionManager,mytx,dataSource,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0]; root of factory hierarchy
2010-10-14 13:22:04 Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMapClient' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: SqlMapExecutorDelegate not find the dialectClass in com/ibatis/ext/sqlmap/engine/dialect/dialect.properties,detail info:
null
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1336)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:471)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean。

然后,我的ApplicationContext.xml文件配置如下:

    <!-- SqlMapClient的实例配置 -->
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
    <property name="configLocation"  value="classpath:sqlMapConfig.xml"></property>
    <property name="dataSource" ref="dataSource"></property>
</bean>

<!-- BaseDao的配置 -->
<bean id="baseDao" class="pack.java.demo.database.BaseDao">
    <property name="sqlMapClient" ref="sqlMapClient"></property>
</bean> 

<bean id="StudentDaoImpl" class="pack.java.demo.daoimpl.StudentDaoImpl" parent="baseDao"/>

<bean id="StudentServiceImpl" class="pack.java.demo.serviceimpl.StudentServiceImpl">
    <property name="studentDao" ref="StudentDaoImpl"></property>
</bean>

<!-- Struts Action -->
<bean name="/student" class="pack.java.demo.struts.action.StudentAction">
    <property name="studentService" ref="StudentServiceImpl"></property>
</bean>

<!-- DataSource的配置; -->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"></property>
    <property name="url" value="jdbc:oracle:thin:@localhost:1521:ORCL"></property>
    <property name="username" value="scott"></property>
    <property name="password" value="tiger"></property>
</bean>
    ...省略了,其他的事务代码的配置....

...web.xml配置如下:
<!-- 配置applicationContext.xml文件 -->

contextConfigLocation
classpath:applicationContext.xml

<!-- Listener的配置,监听器 -->

org.springframework.web.context.ContextLoaderListener

请问是哪里配置错误了啊,还是少了一个jar包? 我只有把一个.ibatis2.3.4.8.jar拷贝到WEB-INF/lib目录下。

5条回答 默认 最新

相关推荐 更多相似问题