当我尝试将我的web maven项目与spring4.2.2release和hibernate4.2.0Final集成时,我得到了以下数组:
严重: Servlet.service() for servlet [jsp] in context with path [/ismdhust] threw exception [Filter execution threw an exception] with root cause
java.lang.NoSuchMethodError: org.hibernate.SessionFactory.openSession()Lorg/hibernate/Session;
at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.openSession(OpenSessionInViewFilter.java:204)
at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:140)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:475)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:498)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:796)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1368)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
我搜索了很多,其中大多数人说原因是spring和hibernate之间的版本冲突。
有人可以帮我一把吗?谢谢!!!!!
以下是我的配置:
1.pom.xml:
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>${commons-dbcp.version}</version>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.2.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>4.2.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.2.10.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${servlet.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>${mockito.version}</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.unitils</groupId>
<artifactId>unitils-core</artifactId>
<version>${unitils.version}</version>
</dependency>
<dependency>
<groupId>org.unitils</groupId>
<artifactId>unitils-testng</artifactId>
<version>${unitils.version}</version>
</dependency>
<dependency>
<groupId>org.unitils</groupId>
<artifactId>unitils-spring</artifactId>
<version>${unitils.version}</version>
</dependency>
<dependency>
<groupId>org.unitils</groupId>
<artifactId>unitils-orm</artifactId>
<version>${unitils.version}</version>
</dependency>
<dependency>
<groupId>org.unitils</groupId>
<artifactId>unitils-database</artifactId>
<version>${unitils.version}</version>
</dependency>
<dependency>
<groupId>org.unitils</groupId>
<artifactId>unitils-dbmaintainer</artifactId>
<version>${unitils.version}</version>
</dependency>
<dependency>
<groupId>org.unitils</groupId>
<artifactId>unitils-dbunit</artifactId>
<version>${unitils.version}</version>
<exclusions>
<exclusion>
<groupId>org.dbunit</groupId>
<artifactId>dbunit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
<dependency>
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
<version>${aopalliance.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.6.0.GA</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>${selenium.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>${selenium.version}</version>
</dependency>
<dependency>
<groupId>com.opera</groupId>
<artifactId>operadriver</artifactId>
<version>0.8.1</version>
</dependency>
<dependency>
<groupId>org.dbunit</groupId>
<artifactId>dbunit</artifactId>
<version>${dbunit.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
<version>${selenium.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-htmlunit-driver</artifactId>
<version>${selenium.version}</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>${hamcrest.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7.2</version>
<configuration>
<forkMode>once</forkMode>
<threadCount>10</threadCount>
<argLine>-Dfile.encoding=UTF-8</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.25</version>
<configuration>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>80</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
<contextPath>/forum</contextPath>
<scanIntervalSeconds>0</scanIntervalSeconds>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<file.encoding>UTF-8</file.encoding>
<spring.version>4.2.2.RELEASE</spring.version>
<slf4j.version>1.7.5</slf4j.version>
<aspectj.version>1.8.1</aspectj.version>
<aopalliance.version>1.0</aopalliance.version>
<mysql.version>5.1.29</mysql.version>
<servlet.version>3.0-alpha-1</servlet.version>
<commons-dbcp.version>1.4</commons-dbcp.version>
<jetty.version>8.1.8.v20121106</jetty.version>
<aspectjweaver.version>1.6.8</aspectjweaver.version>
<hibernate.version>4.2.0.Final</hibernate.version>
<mockito.version>1.10.19</mockito.version>
<unitils.version>3.4.2</unitils.version>
<selenium.version>2.41.0</selenium.version>
<dbunit.version>2.5.1</dbunit.version>
<hamcrest.version>1.3</hamcrest.version>
</properties>
&#13;
2. web.xml的一部分:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<filter>
<filter-name>hibernateFilter</filter-name>
<filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class>
<init-param>
<param-name>sessionFactoryBeanName</param-name>
<param-value>sessionFactory</param-value>
</init-param>
<init-param>
<param-name>singleSession</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name> flushMode </param-name>
<param-value>AUTO </param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>hibernateFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>hibernateFilter</filter-name>
<url-pattern>*.html</url-pattern>
</filter-mapping>
&#13;
3.partContext.xml的部分:
<context:property-placeholder location="classpath:jdbc.properties" />
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close"
p:driverClassName="${jdbc.driverClassName}"
p:url="${jdbc.url}"
p:username="${jdbc.username}"
p:password="${jdbc.password}" />
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"
p:dataSource-ref="dataSource"
p:mappingDirectoryLocations="classpath:/com/ismd/domain/hbm">
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.region.factory_class">
org.hibernate.cache.ehcache.EhCacheRegionFactory
</prop>
<prop key="hibernate.cache.use_query_cache">false</prop>
</props>
</property>
</bean>
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate4.HibernateTemplate" p:sessionFactory-ref="sessionFactory" />
<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="create*" propagation="REQUIRED" read-only="false" />
<tx:method name="save*" propagation="REQUIRED" read-only="false" />
<tx:method name="reg*" propagation="REQUIRED" read-only="false" />
<tx:method name="update*" propagation="REQUIRED" read-only="false" />
<tx:method name="delete*" propagation="REQUIRED" read-only="false" />
<tx:method name="*" propagation="REQUIRED" read-only="true" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:advisor id="managerTX" advice-ref="txAdvice" pointcut="execution(* com.ismd.*.*(..))" order="1" />
</aop:config>
&#13;
4.在pom.xml中,通过ctrl + shift + t和搜索org.springframework.SessionFactory,我得到以下结果: enter image description here
在我的项目中,只包含了org.hibernate.hibernate-core \ 4.2.0.Final;
5.我的项目中的图书馆: enter image description here
6. maven dependecy tree的结果:
[INFO] +- xml-apis:xml-apis:jar:1.4.01:compile
[INFO] +- javax.servlet:jstl:jar:1.2:compile
[INFO] +- taglibs:standard:jar:1.1.2:compile
[INFO] +- org.springframework:spring-orm:jar:4.2.2.RELEASE:compile
[INFO] | \- org.springframework:spring-core:jar:4.2.2.RELEASE:compile
[INFO] +- org.springframework:spring-tx:jar:4.2.2.RELEASE:compile
[INFO] +- org.springframework:spring-test:jar:4.2.2.RELEASE:compile
[INFO] +- org.springframework:spring-web:jar:4.2.2.RELEASE:compile
[INFO] | \- org.springframework:spring-aop:jar:4.2.2.RELEASE:compile
[INFO] +- org.springframework:spring-webmvc:jar:4.2.2.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:4.2.2.RELEASE:compile
[INFO] +- org.springframework:spring-context:jar:4.2.2.RELEASE:compile
[INFO] +- org.springframework:spring-context-support:jar:4.2.2.RELEASE:compile
[INFO] +- org.springframework:spring-beans:jar:4.2.2.RELEASE:compile
[INFO] +- org.springframework:spring-jdbc:jar:4.2.2.RELEASE:compile
[INFO] +- commons-lang:commons-lang:jar:2.2:compile
[INFO] +- commons-fileupload:commons-fileupload:jar:1.3.1:compile
[INFO] | \- commons-io:commons-io:jar:2.2:compile
[INFO] +- commons-dbcp:commons-dbcp:jar:1.4:compile
[INFO] | \- commons-pool:commons-pool:jar:1.5.4:compile
[INFO] +- javax.persistence:persistence-api:jar:1.0:compile
[INFO] +- org.hibernate:hibernate-core:jar:4.3.11.Final:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile
[INFO] | +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile
[INFO] | +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.0.0.Final:compile
[INFO] | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | +- org.hibernate.common:hibernate-commons-annotations:jar:4.0.5.Final:compile
[INFO] | +- org.javassist:javassist:jar:3.18.1-GA:compile
[INFO] | +- antlr:antlr:jar:2.7.7:compile
[INFO] | \- org.jboss:jandex:jar:1.1.0.Final:compile
[INFO] +- org.hibernate:hibernate-ehcache:jar:4.3.11.Final:compile
[INFO] | \- net.sf.ehcache:ehcache-core:jar:2.4.3:compile
[INFO] +- org.hibernate:hibernate-entitymanager:jar:4.3.11.Final:compile
[INFO] +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] +- javax.servlet:servlet-api:jar:3.0-alpha-1:provided
[INFO] +- mysql:mysql-connector-java:jar:5.1.29:compile
[INFO] +- commons-beanutils:commons-beanutils:jar:1.9.1:compile
[INFO] | +- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] | \- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.5:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.7.5:compile
[INFO] | \- log4j:log4j:jar:1.2.17:compile
[INFO] +- org.mockito:mockito-all:jar:1.10.19:compile
[INFO] +- org.testng:testng:jar:6.8.7:test
[INFO] | +- junit:junit:jar:4.10:compile
[INFO] | | \- org.hamcrest:hamcrest-core:jar:1.1:compile
[INFO] | +- org.beanshell:bsh:jar:2.0b4:test
[INFO] | +- com.beust:jcommander:jar:1.27:test
[INFO] | \- org.yaml:snakeyaml:jar:1.12:test
[INFO] +- org.unitils:unitils-core:jar:3.4.2:compile
[INFO] | \- ognl:ognl:jar:2.6.9:compile
[INFO] +- org.unitils:unitils-testng:jar:3.4.2:compile
[INFO] | \- org.testng:testng:jar:jdk15:5.8:compile
[INFO] +- org.unitils:unitils-spring:jar:3.4.2:compile
[INFO] +- org.unitils:unitils-orm:jar:3.4.2:compile
[INFO] +- org.unitils:unitils-database:jar:3.4.2:compile
[INFO] +- org.unitils:unitils-dbmaintainer:jar:3.4.2:compile
[INFO] | +- org.hibernate:hibernate:jar:3.2.5.ga:compile
[INFO] | | +- net.sf.ehcache:ehcache:jar:1.2.3:compile
[INFO] | | +- asm:asm-attrs:jar:1.5.3:compile
[INFO] | | +- cglib:cglib:jar:2.1_3:compile
[INFO] | | \- asm:asm:jar:1.5.3:compile
[INFO] | \- org.slf4j:slf4j-nop:jar:1.6.4:compile
[INFO] +- org.unitils:unitils-dbunit:jar:3.4.2:compile
[INFO] | \- xmlunit:xmlunit:jar:1.2:compile
[INFO] +- org.aspectj:aspectjrt:jar:1.8.1:compile
[INFO] +- org.aspectj:aspectjweaver:jar:1.8.1:compile
[INFO] +- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.apache.poi:poi:jar:3.9:compile
[INFO] | \- commons-codec:commons-codec:jar:1.5:compile
[INFO] +- javassist:javassist:jar:3.6.0.GA:compile
[INFO] +- org.seleniumhq.selenium:selenium-chrome-driver:jar:2.41.0:compile
[INFO] | \- org.seleniumhq.selenium:selenium-remote-driver:jar:2.41.0:compile
[INFO] | +- cglib:cglib-nodep:jar:2.1_3:compile
[INFO] | +- net.java.dev.jna:jna:jar:3.4.0:compile
[INFO] | \- net.java.dev.jna:platform:jar:3.4.0:compile
[INFO] +- org.seleniumhq.selenium:selenium-firefox-driver:jar:2.41.0:compile
[INFO] | \- org.apache.commons:commons-exec:jar:1.1:compile
[INFO] +- com.opera:operadriver:jar:0.8.1:compile
[INFO] | +- com.opera:operalaunchers:jar:0.3:compile
[INFO] | +- com.google.protobuf:protobuf-java:jar:2.4.1:compile
[INFO] | +- com.google.guava:guava:jar:10.0.1:compile
[INFO] | | \- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] | \- commons-jxpath:commons-jxpath:jar:1.3:compile
[INFO] +- org.dbunit:dbunit:jar:2.5.1:compile
[INFO] | \- org.apache.poi:poi-ooxml:jar:3.11:compile
[INFO] | \- org.apache.poi:poi-ooxml-schemas:jar:3.11:compile
[INFO] | \- org.apache.xmlbeans:xmlbeans:jar:2.6.0:compile
[INFO] | \- stax:stax-api:jar:1.0.1:compile
[INFO] +- org.seleniumhq.selenium:selenium-api:jar:2.41.0:compile
[INFO] | \- org.json:json:jar:20080701:compile
[INFO] +- org.seleniumhq.selenium:selenium-htmlunit-driver:jar:2.41.0:compile
[INFO] | +- net.sourceforge.htmlunit:htmlunit:jar:2.13:compile
[INFO] | | +- xalan:xalan:jar:2.7.1:compile
[INFO] | | | \- xalan:serializer:jar:2.7.1:compile
[INFO] | | +- org.apache.commons:commons-lang3:jar:3.1:compile
[INFO] | | +- org.apache.httpcomponents:httpmime:jar:4.3.1:compile
[INFO] | | +- net.sourceforge.htmlunit:htmlunit-core-js:jar:2.13:compile
[INFO] | | +- xerces:xercesImpl:jar:2.11.0:compile
[INFO] | | +- net.sourceforge.nekohtml:nekohtml:jar:1.9.19:compile
[INFO] | | +- net.sourceforge.cssparser:cssparser:jar:0.9.11:compile
[INFO] | | | \- org.w3c.css:sac:jar:1.3:compile
[INFO] | | \- org.eclipse.jetty:jetty-websocket:jar:8.1.12.v20130726:compile
[INFO] | | +- org.eclipse.jetty:jetty-util:jar:8.1.12.v20130726:compile
[INFO] | | +- org.eclipse.jetty:jetty-io:jar:8.1.12.v20130726:compile
[INFO] | | \- org.eclipse.jetty:jetty-http:jar:8.1.12.v20130726:compile
[INFO] | \- org.apache.httpcomponents:httpclient:jar:4.3.1:compile
[INFO] | \- org.apache.httpcomponents:httpcore:jar:4.3:compile
[INFO] \- org.hamcrest:hamcrest-all:jar:1.3:compile
&#13;
答案 0 :(得分:0)
我刚刚通过你提供的快照。 jar文件版本似乎不匹配。
希望能回答你的问题!
答案 1 :(得分:0)
最后,我通过放弃使用HibernateTemplate解决了我的问题,但在我的项目中将SessionFactory应用于持久数据到数据库。 我不知道如何找到问题。但在我看来,问题的原因是HibernateTemplate在Hibernate4版本中不再受支持。