有谁真正用Spring2.5配置HIbernate3.2.5GA事务成功的我百思不得期解,在Spring2.0下可以,一到Spring2.5就不
有谁真正用Spring2.5配置HIbernate3.2.5GA事务成功的
我百思不得期解,在Spring2.0下可以,一到Spring2.5就不行了,请各位帮忙看看。
?
User.java
package spring25.ch06;public class User {private String id;private String name;private String comment;public String getId() {return id;}public void setId(String id) {this.id = id;}public String getName() {return name;}public void setName(String name) {this.name = name;}public String getComment() {return comment;}public void setComment(String comment) {this.comment = comment;}}
?
UserDao.java
package spring25.ch06;import java.util.List;public interface UserDao {void create(User user);void update(User user);public void delete(User user);public List<User> list();}
?
UserDaoImpl.java
package spring25.ch06.hibernate;import java.util.List;import org.hibernate.Session;import org.hibernate.SessionFactory;import org.springframework.transaction.annotation.Transactional;import spring25.ch06.User;import spring25.ch06.UserDao;public class UserDaoImpl implements UserDao {private SessionFactory sessionFactory;public void setSessionFactory(SessionFactory sessionFactory) {this.sessionFactory = sessionFactory;}@Override@Transactionalpublic void create(User user) {Session session = sessionFactory.getCurrentSession();session.save(user);}@Override@Transactionalpublic void update(User user) {Session session = sessionFactory.getCurrentSession();session.update(user);}@Override@Transactionalpublic void delete(User user) {Session session = sessionFactory.getCurrentSession();session.delete(user);}@Override@SuppressWarnings("unchecked")@Transactional(readOnly=true)public List<User> list() {Session session = sessionFactory.getCurrentSession();return session.createQuery("from User u").list();}}
?
Main.java
package spring25.ch06.hibernate;import java.util.List;import org.springframework.context.ApplicationContext;import org.springframework.context.support.ClassPathXmlApplicationContext;import spring25.ch06.User;import spring25.ch06.UserDao;public class Main {private static UserDao userDao;static {ApplicationContext ctx = new ClassPathXmlApplicationContext("spring25/ch06/hibernate/config.xml");userDao = (UserDao) ctx.getBean("userDao");}public static void main(String[] args) throws Exception {listUsers();User user = new User();user.setName("juggler");user.setComment("juggler is a good boy.");userDao.create(user);listUsers();user.setName("magic");userDao.update(user);listUsers();user = new User();user.setName("Kut");user.setComment("He is a good programmer.");userDao.create(user);listUsers();userDao.delete(user);listUsers();}private static void listUsers() {List<User> users = userDao.list();for (User u : users) {System.out.println("ID: " + u.getId());System.out.println("Name: " + u.getName());System.out.println("Comment: " + u.getComment());System.out.println("---------------------------------");}System.out.println("\n");}}
?
?
hibernate.cfg.xml
<?xml version='1.0' encoding='utf-8'?><!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><hibernate-configuration><session-factory><property name="connection.driver_class">com.mysql.jdbc.Driver</property><property name="connection.url">jdbc:mysql://localhost/spring_study</property><property name="connection.username">root</property><property name="connection.password">xxxxxxx</property><property name="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property><property name="current_session_context_class">thread</property><property name="show_sql">false</property><property name="hibernate.format_sql">true</property><property name="hibernate.use_sql_comments">true</property><mapping resource="spring25/ch06/User.hbm.xml" /> </session-factory></hibernate-configuration>
?
User.hbm.xml
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE hibernate-mapping PUBLIC"-//Hibernate/Hibernate Mapping DTD 3.0//EN""http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"><hibernate-mapping package="spring25.ch06"><class name="User" table="user" dynamic-update="true"><id name="id" column="id"><generator /></id><property name="name" type="string" column="name" /><property name="comment" type="string" column="comment" /></class></hibernate-mapping>
?
config.xml
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:tx="http://www.springframework.org/schema/tx"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"><bean id="sessionFactory" value="classpath:spring25/ch06/hibernate/hibernate.cfg.xml" /></bean><bean id="userDao" ref="sessionFactory" /></bean><bean id="transactionManager" ref="sessionFactory" /></bean><tx:annotation-driven transaction-manager="transactionManager" /></beans>
?
运行出错:
Exception in thread "main" org.hibernate.HibernateException: createQuery is not valid without active transactionat org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:297)at $Proxy7.createQuery(Unknown Source)at spring25.ch06.hibernate.UserDaoImpl.list(UserDaoImpl.java:45)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at java.lang.reflect.Method.invoke(Method.java:597)at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:301)at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)at $Proxy5.list(Unknown Source)at spring25.ch06.hibernate.Main.listUsers(Main.java:44)at spring25.ch06.hibernate.Main.main(Main.java:20)
?
<property name="dataSource">
<ref local="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLInnoDBDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="mappingLocations">
<list>
<value>classpath*:com/jhlt/model/*.hbm.xml</value>
</list>
</property>
</bean>
<bean id="txManager" ref="sessionFactory" />
</bean>
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="get*" read-only="true" rollback-for="Exception" />
<tx:method name="save*" read-only="false"/>
</tx:attributes>
</tx:advice>
<aop:config proxy-target-advice-ref="txAdvice"/>
</aop:config>
<bean id="courseDao"
name="code"> <bean id="sessionFactory" > <property name="dataSource"> <ref local="dataSource" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.MySQLInnoDBDialect </prop> <prop key="hibernate.show_sql">true</prop> </props> </property> <property name="mappingLocations"> <list> <value>classpath*:com/jhlt/model/*.hbm.xml</value> </list> </property> </bean><bean id="txManager" ref="sessionFactory" /></bean> <tx:advice id="txAdvice" transaction-manager="txManager"> <tx:attributes> <tx:method name="get*" read-only="true" rollback-for="Exception" /> <tx:method name="save*" read-only="false"/> </tx:attributes> </tx:advice> <aop:config proxy-target-advice-ref="txAdvice"/> </aop:config> <bean id="courseDao" name="code"><?xml version="1.0" encoding="GBK"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"><bean id="propertyConfigurer" > <property name="dataSource"> <ref local="dataSource" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> <!-- oracle org.hibernate.dialect.Oracle10gDialect --> org.hibernate.dialect.MySQLInnoDBDialect </prop> <prop key="hibernate.show_sql">true</prop> </props> </property> <property name="mappingLocations"> <list> <value>classpath*:com/jhlt/model/*.hbm.xml</value> </list> </property> </bean><bean id="txManager" ref="sessionFactory" /></bean> <tx:advice id="txAdvice" transaction-manager="txManager"> <tx:attributes> <tx:method name="get*" read-only="true" rollback-for="Exception" /> <tx:method name="save*" read-only="false"/> </tx:attributes> </tx:advice> <aop:config proxy-target-advice-ref="txAdvice"/> </aop:config> <bean id="courseDao" advice-ref="txAdvice"/>
</aop:config>
我加了上面的
<aop:config proxy-target-encoding="UTF-8"?>
<!--
- Middle tier application context definition for the image database.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
<bean id="propertyConfigurer"
/>
</bean>
<!--
<bean id="dataSource"
value="xmleo"></property>
<property name="password" value="123456"></property>
</bean>
<bean id="sessionFactory"
/>
</property>
<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>
</bean>
-->
<bean id="sessionFactory"
/>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.PostgreSQLDialect
</prop>
<prop key="hibernate.connection.provider_class">
org.hibernate.connection.ProxoolConnectionProvider
</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.proxool.existing_pool">true</prop>
<!-- 把所有的SQL语句都输出到控制台 。true:输出到控制台-->
<prop key="hibernate.show_sql">true</prop>
<!-- Fetch Size 是设定JDBC的Statement读取数据的时候每次从数据库中取出的记录条数,我建议使用Oracle的最好将Fetch Size设到50-->
<prop key="hibernate.jdbc.fetch_size">50</prop>
<!-- atch Size是设定对数据库进行批量删除,批量更新和批量插入的时候的批次大小,我建议使用Oracle的最好将Batch Size设到30~50-->
<prop key="hibernate.jdbc.batch_size">30</prop>
<!-- 默认打开,启用cglib反射优化。cglib是用来在Hibernate中动态生成PO字节码的,打开优化可以加快字节码构造的速度 false:调试状态是最好关闭
-->
<prop key="hibernate.cglib.use_reflection_optimizer">
true
</prop>
<!-- 在SessionFactory创建后,自动输出schema创建DDL语句到数据库.和create-drop同时使用的话,数据库schema会在SessionFactory显式关闭后被drop掉。 -->
<!-- prop key="hibernate.hbm2ddl.auto">update</prop--><!--update validate-->
<!--数据库连接池,proxool 启动选项 -->
<!--<prop key="hibernate.proxool.xml">proxool.xml</prop> -->
<!--数据库连接池,proxool别名 -->
<!--<prop key="hibernate.proxool.pool_alias">proxool</prop>-->
</props>
</property>
<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>
</bean>
<!--事务 -->
<bean id="txManager" abstract="true"
ref="sessionFactory" />
</bean>
<aop:config proxy-target-/>
</aop:config>
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="get*" read-only="true"
rollback-for="Exception" />
<tx:method name="find*" read-only="true"
rollback-for="Exception" />
<tx:method name="load*" read-only="true"
rollback-for="Exception" />
<tx:method name="save*" read-only="false" />
<tx:method name="insert*" no-rollback-for="Exception" />
<tx:method name="remove*" />
<tx:method name="add*" no-rollback-for="Exception" />
<tx:method name="*" read-only="true" />
</tx:attributes>
</tx:advice>
<!-- 支持 @Transactional 标记
<tx:annotation-driven />
支持 @AspectJ 标记
<aop:aspectj-autoproxy/>-->
<bean id="jdbcTemplate"
scope="singleton" lazy-init="true" autowire="default"
dependency-check="default">
</bean>
<bean id="lobHandler"
/>
</property>
</bean>
<!--
ehcache缓存管理器.
-->
<bean id="cacheManager"
/>
<property name="shared" value="true" />
</bean>
</beans> 8 楼 Frederick 2008-03-28 我也遇到了类似的问题。不过我使用的持久层不是hibernate,而是db4o,配置也不是传统的xml,而是使用annotation。但是问题是类似的,写入数据库的数据没能找到,估计是事务失败了导致的。
我遇到的问题是,系统初始化的时候,王数据库里面写入了一些数据。然后在后面使用这些数据的时候,发现无法在数据库里面找到这些数据。系统没有报错,估计是初始化的时候事务没有提交 9 楼 lirig 2008-09-12 最好把背景换下
哈哈! 10 楼 晨星★~雨泪 2008-09-14 java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException
这个没有,加上他的依赖包,试试 11 楼 jiang117 2008-10-10 jiangzy 写道
错误信息:如下:
2008-1-21 19:40:55 org.apache.catalina.core.AprLifecycleListener init
信息: The Apache Tomcat Native library which allows optimal performance in produ
ction environments was not found on the java.library.path: D:\WorkTools\JavaTool
s\JDK6\jdk1.6.0_03\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;
C:\Python\;C:\Perl\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;D
:\WorkTools\JavaTools\JDK6\jdk1.6.0_03\bin ;C:\Program Files\Perforce;D:\WorkToo
ls\JavaTools\PHP5;C:\Program Files\SSH Communications Security\SSH Secure Shell
2008-1-21 19:40:55 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2008-1-21 19:40:55 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 574 ms
2008-1-21 19:40:55 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2008-1-21 19:40:55 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.14
2008-01-21 19:40:57,820 ERROR [org.springframework.web.context.ContextLoader] -
<Context initialization failed>
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Config
uration problem: Failed to import bean definitions from relative location [sprin
g-xml/applicationContext-DB.xml]
Offending resource: class path resource [applicationContext.xml]; nested excepti
on is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected
exception parsing XML document from class path resource [spring-xml/application
Context-DB.xml]; nested exception is java.lang.NoClassDefFoundError: org/aspectj
/weaver/reflect/ReflectionWorld$ReflectionWorldException
at org.springframework.beans.factory.parsing.FailFastProblemReporter.err
or(FailFastProblemReporter.java:68)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderC
ontext.java:85)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderC
ontext.java:76)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentRe
ader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:201)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentRe
ader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:147)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentRe
ader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:132)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentRe
ader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registe
rBeanDefinitions(XmlBeanDefinitionReader.java:488)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadB
eanDefinitions(XmlBeanDefinitionReader.java:383)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:327)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:295)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReade
r.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReade
r.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReade
r.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
at org.springframework.web.context.support.XmlWebApplicationContext.load
BeanDefinitions(XmlWebApplicationContext.java:124)
at org.springframework.web.context.support.XmlWebApplicationContext.load
BeanDefinitions(XmlWebApplicationContext.java:92)
at org.springframework.context.support.AbstractRefreshableApplicationCon
text.refreshBeanFactory(AbstractRefreshableApplicationContext.java:97)
at org.springframework.context.support.AbstractApplicationContext.obtain
FreshBeanFactory(AbstractApplicationContext.java:411)
at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:338)
at org.springframework.web.context.ContextLoader.createWebApplicationCon
text(ContextLoader.java:261)
at org.springframework.web.context.ContextLoader.initWebApplicationConte
xt(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitiali
zed(ContextLoaderListener.java:45)
at com.common.util.LocalContextLoaderListener.contextInitialized(LocalCo
ntextLoaderListener.java:30)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContex
t.java:3830)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
337)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:77
1)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.jav
a:920)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.j
ava:883)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492
)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443
)
at org.apache.catalina.core.StandardService.start(StandardService.java:5
16)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710
)
at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexp
ected exception parsing XML document from class path resource [spring-xml/applic
ationContext-DB.xml]; nested exception is java.lang.NoClassDefFoundError: org/as
pectj/weaver/reflect/ReflectionWorld$ReflectionWorldException
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadB
eanDefinitions(XmlBeanDefinitionReader.java:405)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:327)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:295)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentRe
ader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:190)
... 43 more
Caused by: java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/Reflection
World$ReflectionWorldException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at org.springframework.aop.config.ConfigBeanDefinitionParser.class$(Conf
igBeanDefinitionParser.java:209)
at org.springframework.aop.config.ConfigBeanDefinitionParser.createPoint
cutDefinition(ConfigBeanDefinitionParser.java:535)
at org.springframework.aop.config.ConfigBeanDefinitionParser.parsePointc
utProperty(ConfigBeanDefinitionParser.java:509)
at org.springframework.aop.config.ConfigBeanDefinitionParser.parseAdviso
r(ConfigBeanDefinitionParser.java:187)
at org.springframework.aop.config.ConfigBeanDefinitionParser.parse(Confi
gBeanDefinitionParser.java:146)
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(N
amespaceHandlerSupport.java:69)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.pa
rseCustomElement(BeanDefinitionParserDelegate.java:1246)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.pa
rseCustomElement(BeanDefinitionParserDelegate.java:1236)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentRe
ader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentRe
ader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registe
rBeanDefinitions(XmlBeanDefinitionReader.java:488)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadB
eanDefinitions(XmlBeanDefinitionReader.java:383)
... 46 more
2008-1-21 19:40:57 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2008-1-21 19:40:57 org.apache.catalina.core.StandardContext start
严重: Context [/xmweb] startup failed due to previous errors
2008-1-21 19:40:58 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2008-1-21 19:40:58 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2008-1-21 19:40:58 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/47 config=null
2008-1-21 19:40:58 org.apache.catalina.startup.Catalina start
信息: Server startup in 3123 ms
你这个错误是少了一个包:aspectjweaver.jar 到spring2.5原包下面去找
12 楼 jiang117 2008-10-10 终于把spring2.5 的事务配好了,记录一下
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
上面红色标记的不能少,否侧会报如下错误,俺在网上找了好久,好多人都报这样的错,但就是没人回答,而且都是
E文的,自己终于摸索出来了,哈哈。。。。。。
cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'tx:advice'.
cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'aop:config'.