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目录下。
sqlMapConfig.xml 这里面定义 ibatis 的sql-mapping ,如果没有定义的话最多是找不到配置的ID,应该没有关系,我不知道你的这个dialect.properties实干什么用的,之前我整合的时候没有用到这个呢。
如果你的dao层继承了SqlMapClientDaoSupport,需要在applicationContext.xml中,定义下面的bean
<bean id="sqlMapClientTemplate"
class="org.springframework.orm.ibatis.SqlMapClientTemplate">
<property name="sqlMapClient">
<ref bean="sqlMapClient" />
</property>
</bean>
继承方法setExtSqlMapClientTemplate。
SqlMapExecutorDelegate not find the dialectClass in com/ibatis/ext/sqlmap/engine/dialect/dialect.properties,detail info:
null
看看是不是dialect.properties配置不完整导致的。
我之前用的是ibatis-2.3.4.jar ,不行的话,你换一个jar文件看看。
[quote]另在我在ibatis.2.3.4.8jar包中com.ibatis.ext.sqlmap.engine.dialect包下面
dialect.properties文件中,就是默认的配置,只有下面一句.
dialectClass=com.ibatis.ext.sqlmap.engine.dialect.Dialect4Oracle
是不是还有配置什么啊? [/quote]
看看jar文件是不是存在这个Dialect4Oracle。应该是 not find the dialectClass ,换成存在的dialect class
[quote]兄弟,我把工程发到你的邮箱里面你帮我看一下.可以吗?? [/quote]
好的。。
邮箱PM你了。