hibernate+struts连接数据库报错WARN: SQL Error: 102, SQLState: S0001怎么解决?

请问一下这种是哪里出问题了,数据库在test driver那里可以连接上,映射文件是直接生成的没有改动过,这个错到底是哪里产生的啊……QAQ
5月 09, 2019 4:17:27 下午 org.hibernate.hql.internal.QueryTranslatorFactoryInitiator initiateService
INFO: HHH000397: Using ASTQueryTranslatorFactory
5月 09, 2019 4:17:27 下午 org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
WARN: SQL Error: 102, SQLState: S0001
5月 09, 2019 4:17:27 下午 org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
ERROR: “@P0”附近有语法错误。
5月 09, 2019 4:17:27 下午 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [jsp] in context with path [/bookstore] threw exception [org.hibernate.exception.SQLGrammarException: could not extract ResultSet] with root cause
com.microsoft.sqlserver.jdbc.SQLServerException: “@P0”附近有语法错误。
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:217)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1655)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:440)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:385)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7505)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2445)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:191)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:166)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:297)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:70)
at org.hibernate.loader.Loader.getResultSet(Loader.java:2115)
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1898)
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1874)
at org.hibernate.loader.Loader.doQuery(Loader.java:919)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:336)
at org.hibernate.loader.Loader.doList(Loader.java:2610)
at org.hibernate.loader.Loader.doList(Loader.java:2593)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2422)
at org.hibernate.loader.Loader.list(Loader.java:2417)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:501)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:371)
at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:216)
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1339)
at org.hibernate.internal.QueryImpl.list(QueryImpl.java:87)
at org.apache.jsp.MyJsp_jsp._jspService(MyJsp_jsp.java:187)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
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:200)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:668)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:844)

3个回答

能贴下你的配置文件看看吗

这不是连接问题,数据已经连上了,应该是你的sql语句有问题

QueryTranslatorImpl.java:371 这个是你自己写的类吧 371行是啥 贴出来看看

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
hibernate+struts连接数据库报错WARN: SQL Error: 102, SQLState: S0001怎么解决?

请问一下这种是哪里出问题了,数据库在test driver那里可以连接上,映射文件是直接生成的没有改动过,这个错到底是哪里产生的啊……QAQ 5月 09, 2019 4:17:27 下午 org.hibernate.hql.internal.QueryTranslatorFactoryInitiator initiateService INFO: HHH000397: Using ASTQueryTranslatorFactory 5月 09, 2019 4:17:27 下午 org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions WARN: SQL Error: 102, SQLState: S0001 5月 09, 2019 4:17:27 下午 org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions ERROR: “@P0”附近有语法错误。 5月 09, 2019 4:17:27 下午 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet [jsp] in context with path [/bookstore] threw exception [org.hibernate.exception.SQLGrammarException: could not extract ResultSet] with root cause com.microsoft.sqlserver.jdbc.SQLServerException: “@P0”附近有语法错误。 at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:217) at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1655) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:440) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:385) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7505) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2445) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:191) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:166) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:297) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:70) at org.hibernate.loader.Loader.getResultSet(Loader.java:2115) at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1898) at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1874) at org.hibernate.loader.Loader.doQuery(Loader.java:919) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:336) at org.hibernate.loader.Loader.doList(Loader.java:2610) at org.hibernate.loader.Loader.doList(Loader.java:2593) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2422) at org.hibernate.loader.Loader.list(Loader.java:2417) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:501) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:371) at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:216) at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1339) at org.hibernate.internal.QueryImpl.list(QueryImpl.java:87) at org.apache.jsp.MyJsp_jsp._jspService(MyJsp_jsp.java:187) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329) at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) 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:200) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:668) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.base/java.lang.Thread.run(Thread.java:844)

Hibernate 报错:SQL Error: 923, SQLState: 42000

今天在写注册界面时,添加用户数据报错: # WARN[org.hibernate.util.JDBCExceptionReporter] - SQL Error: 923, SQLState: 42000 # ERROR [org.hibernate.util.JDBCExceptionReporter] - ORA-00923: 未找到要求的 FROM 关键字 抛出的异常为: ## org.springframework.dao.InvalidDataAccessResourceUsageException: could not retrieve GUID; nested exception is org.hibernate.exception.SQLGrammarException: could not retrieve GUID org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:630) org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412) org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424) org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374) org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:694) com.is.clut.dao.support.hibernate.EntityDaoHibernateImpl.add(EntityDaoHibernateImpl.java:21) com.is.clut.service.support.EntityServiceImpl.add(EntityServiceImpl.java:34) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:606) org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) com.sun.proxy.$Proxy6.add(Unknown Source) com.is.clut.web.action.system.RegistAction.regist(RegistAction.java:49) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:606) com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441) com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243) com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252) org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488) org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) 查了好半天,不知道是什么问题。小白刚开始ibernate学习Hibernate,求大神帮助。

SQL Error: 17008, SQLState: null

每次程序运行一段时间以后,就报此错 08-08-17 09:55:29 WARN JDBCExceptionReporter:71 - SQL Error: 17008, SQLState: null 08-08-17 09:55:29 ERROR JDBCExceptionReporter:72 - 关闭的连接 08-08-17 09:55:29 WARN JDBCExceptionReporter:71 - SQL Error: 17008, SQLState: null 08-08-17 09:55:29 ERROR JDBCExceptionReporter:72 - 关闭的连接 org.hibernate.exception.GenericJDBCException: could not execute query Caused by: java.sql.SQLException: 关闭的连接 我的的struts2 +hibernate3 dao是 public Userinfo checkUserinfo(String name, String pwd) { Session session = HibernateSessionFactory.getSession(); Transaction ta = session.beginTransaction(); Userinfo userinfo = (Userinfo) session.createCriteria(Userinfo.class) .add(Expression.eq("userinfoName", name)).add( Expression.eq("userinfoPassword", pwd)).uniqueResult(); ta.commit(); HibernateSessionFactory.closeSession(); return userinfo; } [b]问题补充:[/b] package com.shop.hibernate.util; import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.cfg.Configuration; /** * Configures and provides access to Hibernate sessions, tied to the * current thread of execution. Follows the Thread Local Session * pattern, see {@link http://hibernate.org/42.html }. */ public class HibernateSessionFactory { /** * Location of hibernate.cfg.xml file. * Location should be on the classpath as Hibernate uses * #resourceAsStream style lookup for its configuration file. * The default classpath location of the hibernate config file is * in the default package. Use #setConfigFile() to update * the location of the configuration file for the current session. */ private static String CONFIG_FILE_LOCATION = "/hibernate.cfg.xml"; private static final ThreadLocal<Session> threadLocal = new ThreadLocal<Session>(); private static Configuration configuration = new Configuration(); private static org.hibernate.SessionFactory sessionFactory; private static String configFile = CONFIG_FILE_LOCATION; static { try { configuration.configure(configFile); sessionFactory = configuration.buildSessionFactory(); } catch (Exception e) { System.err .println("%%%% Error Creating SessionFactory %%%%"); e.printStackTrace(); } } private HibernateSessionFactory() { } /** * Returns the ThreadLocal Session instance. Lazy initialize * the <code>SessionFactory</code> if needed. * * @return Session * @throws HibernateException */ public static Session getSession() throws HibernateException { Session session = (Session) threadLocal.get(); if (session == null || !session.isOpen()) { if (sessionFactory == null) { rebuildSessionFactory(); } session = (sessionFactory != null) ? sessionFactory.openSession() : null; threadLocal.set(session); } return session; } /** * Rebuild hibernate session factory * */ public static void rebuildSessionFactory() { try { configuration.configure(configFile); sessionFactory = configuration.buildSessionFactory(); } catch (Exception e) { System.err .println("%%%% Error Creating SessionFactory %%%%"); e.printStackTrace(); } } /** * Close the single hibernate session instance. * * @throws HibernateException */ public static void closeSession() throws HibernateException { Session session = (Session) threadLocal.get(); threadLocal.set(null); if (session != null) { session.close(); } } /** * return session factory * */ public static org.hibernate.SessionFactory getSessionFactory() { return sessionFactory; } /** * return session factory * * session factory will be rebuilded in the next call */ public static void setConfigFile(String configFile) { HibernateSessionFactory.configFile = configFile; sessionFactory = null; } /** * return hibernate configuration * */ public static Configuration getConfiguration() { return configuration; } } 这是自动生成的 [b]问题补充:[/b] ------------------------------------------------------ Caused by: java.sql.SQLException: 关闭的连接 at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269) at oracle.jdbc.driver.OracleConnection.privatePrepareStatement(OracleConnection.java:895) at oracle.jdbc.driver.OracleConnection.prepareStatement(OracleConnection.java:802) at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:396) at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:334) at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:88) at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1162) at org.hibernate.loader.Loader.doQuery(Loader.java:390) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218) at org.hibernate.loader.Loader.doList(Loader.java:1593) ... 122 more

紧急求救,在线等,hibernate插入更新数据报错

各位好: hibernate报错麻烦各位看一下,在本地和测试环境都没有问题。提到生产上后,就一直报这个错 2016-05-07 12:16:08:WARN http-8888-3 org.hibernate.util.JDBCExceptionReporter - SQL Error: 1, SQLState: 23000 2016-05-07 12:16:08:ERROR http-8888-3 org.hibernate.util.JDBCExceptionReporter - ORA-00001: unique constraint (POSBOSS.SYS_C00134274) violated 2016-05-07 12:16:08:WARN http-8888-3 org.hibernate.util.JDBCExceptionReporter - SQL Error: 1, SQLState: 23000 2016-05-07 12:16:08:ERROR http-8888-3 org.hibernate.util.JDBCExceptionReporter - ORA-00001: unique constraint (POSBOSS.SYS_C00134274) violated 2016-05-07 12:16:08:ERROR http-8888-3 org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:202) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985) at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:333) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106) at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:655) at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:732) at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:701) at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:321) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy45.getShrTranFlow(Unknown Source) at com.hkrt.app.offlinepos.action.ShaFeeAction.agentShaTranFlowRun(ShaFeeAction.java:172) 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 com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450) at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:289) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252) at com.hkrt.app.offlinepos.interceptor.ActionParamInterceptor.intercept(ActionParamInterceptor.java:28) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.hkrt.app.offlinepos.interceptor.AuthorityInterceptor.intercept(AuthorityInterceptor.java:77) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265) at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:252) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:161) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:563) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.hkrt.app.offlinepos.interceptor.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:127) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:662) Caused by: java.sql.BatchUpdateException: ORA-00001: unique constraint (POSBOSS.SYS_C00134274) violated at oracle.jdbc.dbaccess.DBError.throwBatchUpdateException(DBError.java:458) at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:3907) at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:294)

idea 搭建ssh框架,配置的数据库ip地址为远程ip,结果请求了本地IP地址,什么原因

用idea整合ssh框架,spring管理hibernate配置文件,数据库配置ip地址为远程服务的IP地址,结果jdbc连接时请求了本地ip地址,具体异常日志如下:09-Jul-2017 09:36:10.193 WARN [RMI TCP Connection(3)-127.0.0.1] org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService HHH000342: Could not obtain connection to query metadata : Access denied for user 'root '@'1.180.235.69' (using password: YES) 09-Jul-2017 09:39:34.591 WARN [http-nio-8080-exec-2] org.hibernate.engine.jdbc.spi.SqlExceptionHelper.logExceptions SQL Error: 1045, SQLState: 28000 09-Jul-2017 09:39:34.592 ERROR [http-nio-8080-exec-2] org.hibernate.engine.jdbc.spi.SqlExceptionHelper.logExceptions Access denied for user 'root '@'1.180.235.69' (using password: YES) 09-Jul-2017 09:39:34.598 严重 [http-nio-8080-exec-2] org.apache.struts2.dispatcher.DefaultDispatcherErrorHandler.error Exception occurred during processing request: org.hibernate.exception.GenericJDBCException: Unable to acquire JDBC Connection javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Unable to acquire JDBC Connection at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:147) at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:155) at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1419) at cn.hz.area.dao.TestDao.save(TestDao.java:16) at cn.hz.area.service.TestService.save(TestService.java:16) at cn.hz.area.action.TestAction.execute(TestAction.java:16) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) 。。。什么原因!好几天时间找不到问题原因。spring配置hibernate信息如下![图片说明](https://img-ask.csdn.net/upload/201707/09/1499564518_832713.png)

could not execute query是什么原因导致的啊?

There is no Action mapped for namespace / and action name LoginAction_login. - [unknown location] at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:177) at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61) at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39) at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:619) Hibernate: select administra0_.id as id0_, administra0_.administrator_id as administ6_0_, administra0_.email as email0_, administra0_.name as name0_, administra0_.password as password0_, administra0_.realname as realname0_ from Administrator administra0_ where 1=1 and ( lower(administra0_.name) like 'admin' ) and administra0_.password='123456' 17:26:22,465 WARN org.hibernate.util.JDBCExceptionReporter:100 - SQL Error: 1054, SQLState: 42S22 17:26:22,466 ERROR org.hibernate.util.JDBCExceptionReporter:101 - Unknown column 'administra0_.administrator_id' in 'field list' 在控制台出现以下语句是什么意思 Hibernate: select administra0_.id as id0_, administra0_.administrator_id as administ6_0_, administra0_.email as email0_, administra0_.name as name0_, administra0_.password as password0_, administra0_.realname as realname0_ from Administrator administra0_ where 1=1 20:48:32,118 WARN org.hibernate.util.JDBCExceptionReporter:100 - SQL Error: 1054, SQLState: 42S22 20:48:32,126 ERROR org.hibernate.util.JDBCExceptionReporter:101 - Unknown column 'administra0_.administrator_id' in 'field list' Hibernate: select administra0_.id as id0_, administra0_.administrator_id as administ6_0_, administra0_.email as email0_, administra0_.name as name0_, administra0_.password as password0_, administra0_.realname as realname0_ from Administrator administra0_ where 1=1 20:48:37,948 WARN org.hibernate.util.JDBCExceptionReporter:100 - SQL Error: 1054, SQLState: 42S22 20:48:37,949 ERROR org.hibernate.util.JDBCExceptionReporter:101 - Unknown column 'administra0_.administrator_id' in 'field list'

struts2+hibernate+spring+proxool性能问题

项目已经跑了2个多月了,今天突然出现不能访问的问题。 第一开始是访问一直刷不出页面,但是tomcat控制台却一下一下的在执行,(很慢的执行,很久才输出一条hibernate的语句) 之后将所有的应用重启了一次, 依然访问不了网站。 一直让他持续连接就会给我报错。 [code="java"] 2009-09-24 11:47:12 [org.logicalcobwebs.proxool.BESTVDB]-[WARN] #0008 was active for 1939871 milliseconds and has been removed automaticaly. The Thread responsible was named 'http-8080-Processor45', and the last SQL it performed is 'select iptvaction0_.action_id as action1_, iptvaction0_.uid as uid11_, iptvaction0_.username as username11_, iptvaction0_.con as con11_, iptvaction0_.cat as cat11_, iptvaction0_.friend_id as friend6_11_, iptvaction0_.friendname as friendname11_, iptvaction0_.code as code11_, iptvaction0_.state_id as state9_11_, iptvaction0_.remark as remark11_, iptvaction0_.datetime as datetime11_, iptvaction0_.allowed as allowed11_, iptvaction0_.visable as visable11_, iptvaction0_.action_place as action14_11_ from iptv_action iptvaction0_ where iptvaction0_.uid in (select iptvmyfrie1_.friendid from iptv_myfriends iptvmyfrie1_ where iptvmyfrie1_.uid=723) order by iptvaction0_.datetime desc limit 3; '. 2009-09-24 11:47:12 [org.hibernate.transaction.JDBCTransaction]-[ERROR] Could not toggle autocommit com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.Util.getInstance(Util.java:381) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:985) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927) at com.mysql.jdbc.ConnectionImpl.checkClosed(ConnectionImpl.java:1113) at com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4790) at sun.reflect.GeneratedMethodAccessor126.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.logicalcobwebs.proxool.WrappedConnection.invoke(WrappedConnection.java:162) at org.logicalcobwebs.proxool.WrappedConnection.intercept(WrappedConnection.java:87) at com.mysql.jdbc.Connection$$EnhancerByProxool$$6a89ac94.setAutoCommit(<generated>) at org.hibernate.transaction.JDBCTransaction.toggleAutoCommit(JDBCTransaction.java:174) at org.hibernate.transaction.JDBCTransaction.commitAndResetAutoCommit(JDBCTransaction.java:122) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:95) at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:578) at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:662) at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:632) [/code] [code="java"] javax.servlet.ServletException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionException: JDBC begin failed: org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515) org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419) org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:99) org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75) root cause org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionException: JDBC begin failed: org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:541) org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:350) root cause org.hibernate.TransactionException: JDBC begin failed: org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:58) org.hibernate.transaction.JDBCTransactionFactory.beginTransaction(JDBCTransactionFactory.java:24) org.hibernate.jdbc.JDBCContext.beginTransaction(JDBCContext.java:271) org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1079) org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:510) root cause java.sql.SQLException: Couldn't perform the operation getAutoCommit: You can't perform any operations on this connection. It has been automatically closed by Proxool for some reason (see logs). org.logicalcobwebs.proxool.WrappedConnection.invoke(WrappedConnection.java:207) org.logicalcobwebs.proxool.WrappedConnection.intercept(WrappedConnection.java:87) com.mysql.jdbc.ConnectionProperties$$EnhancerByProxool$$9313bf3c.getAutoCommit(<generated>) org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:49) org.hibernate.transaction.JDBCTransactionFactory.beginTransaction(JDBCTransactionFactory.java:24) org.hibernate.jdbc.JDBCContext.beginTransaction(JDBCContext.java:271) [/code] 异常信息大概如上所示。 找不到头绪。 不知道该如何下手去优化?还是? 我该如何做? 这是我的第一个项目。还希望各位前辈给出指点!谢谢!

SSH项目删除用户时出错Cannot delete or update

# struts2:2.3.20 # spring:4.1.5 # hibernate:4.3.8 ## 用户与订单一对多的关系,数据库中订单表有用户这个外键。在用户映射文件中已设置cascade="delete" ## ## 项目启动无错误,在后台管理用户页面删除用户时报如下错误: 16:35:30,957 WARN SqlExceptionHelper:144 - SQL Error: 1451, SQLState: 23000 16:35:30,959 ERROR SqlExceptionHelper:146 - Cannot delete or update a parent row: a foreign key constraint fails (`mall`.`orderitem`, CONSTRAINT `FK_hth7ctygtqa5ov7kutghwa1ni` FOREIGN KEY (`uid`) REFERENCES `orders` (`oid`)) 16:35:30,961 INFO AbstractBatchImpl:208 - HHH000010: On release of batch it still contained JDBC statements 16:35:31,165 ERROR DefaultDispatcherErrorHandler:42 - Exception occurred during processing request: could not execute statement; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:163) at org.springframework.orm.hibernate4.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:730) at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:592) at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:757) at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:726) at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:521) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:291) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653) at com.lonini.mall.user.service.UserService$$EnhancerBySpringCGLIB$$3596b2ab.deleteUser(<generated>) at com.lonini.mall.user.adminaction.UserAdminAction.delete(UserAdminAction.java:55) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ...... Caused by: org.hibernate.exception.ConstraintViolationException: could not execute statement at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:129) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:112) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:211) ...... Caused by: com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`mall`.`orderitem`, CONSTRAINT `FK_hth7ctygtqa5ov7kutghwa1ni` FOREIGN KEY (`uid`) REFERENCES `orders` (`oid`)) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:931) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723) at com.mysql.jdbc.Connection.execSQL(Connection.java:3283) ...... order实体: ![order实体](https://img-ask.csdn.net/upload/201506/05/1433495761_123196.jpg) order关系映射: ![order关系映射](https://img-ask.csdn.net/upload/201506/05/1433494844_663178.jpg) user实体: ![user实体](https://img-ask.csdn.net/upload/201506/05/1433494875_943639.jpg) user关系映射: ![user关系映射](https://img-ask.csdn.net/upload/201506/05/1433494947_333542.jpg) 删除用户的JSP页面: ![删除用户的JSP页面](https://img-ask.csdn.net/upload/201506/05/1433494972_750482.jpg) 删除用户的action方法: ![删除用户的action方法](https://img-ask.csdn.net/upload/201506/05/1433495000_125389.jpg) 删除用户的Service层: ![删除用户的Service层](https://img-ask.csdn.net/upload/201506/05/1433494970_267564.jpg) 删除用户的Dao层: ![删除用户的Dao层](https://img-ask.csdn.net/upload/201506/05/1433495048_299389.jpg) 删除用户的struts2配置: ![删除用户的struts2配置](https://img-ask.csdn.net/upload/201506/05/1433495023_750724.jpg) 删除用户的spring配置(action): ![删除用户的spring配置(action)](https://img-ask.csdn.net/upload/201506/05/1433495106_936985.jpg)

JPA 实现修改的时候有问题(Could not execute JDBC batch updat)

我先从数据库查一条记录,修改的时候调用以下save方法 public String save() { if (StringUtils.isNotBlank(this.id)) { this.model = (T) this.manager.get(this.id); } if (null != this.model) { this.model = (T) this.manager.save(this.model); this.addActionMessage("save entity sucessfully!"); } else { this.addActionError("entity to save is null!"); return Action.INPUT; } return Action.SUCCESS; } [color=red]后台报错[/color] 56828 [http-8080-1] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 1062, SQLState: 23000 56828 [http-8080-1] ERROR org.hibernate.util.JDBCExceptionReporter - Duplicate entry '2009062316522976530' for key 'PRIMARY' 56828 [http-8080-1] ERROR org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167) [b]问题补充:[/b] [color=red]save调用这个方法[/color] public T save(T object) { Assert.notNull(object, "entity不能为空"); if (null == object.getId()) { object.setId(String.valueOf(PKgen.getInstance().nextPK())); } return this.jpaTemplate.merge(object); } [b]问题补充:[/b] 118235 [http-8080-6] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 1062, SQLState: 23000 118235 [http-8080-6] ERROR org.hibernate.util.JDBCExceptionReporter - Duplicate entry '2009062316522976530' for key 'PRIMARY' 118235 [http-8080-6] ERROR org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027) at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:365) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137) at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:54) at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:456) at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:732) at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:701) at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:321) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy22.save(Unknown Source) at com.ruling.base.web.struts2.action.BaseCRUDAction.save(BaseCRUDAction.java:64) 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 com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:440) at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:279) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:163) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:249) at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:148) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:93) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:128) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:104) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:148) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:128) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468) at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:112) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619) Caused by: java.sql.BatchUpdateException: Duplicate entry '2009062316522976530' for key 'PRIMARY' at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1666) at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1082) at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297) at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297) at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268) ... 85 more [ERROR] 2009-06-23 18:59:55,687 [freemarker.log.Log4JLoggerFactory$Log4JLogger.error(Log4JLoggerFactory.java:96)] Method public java.lang.String org.hibernate.exception.NestableRuntimeException.getMessage(int) threw an exception when invoked on org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update The problematic instruction: ---------- ==> ${msg[0]} [on line 68, column 29 in org/apache/struts2/dispatcher/error.ftl] ---------- Java backtrace for programmers: ---------- freemarker.template.TemplateModelException: Method public java.lang.String org.hibernate.exception.NestableRuntimeException.getMessage(int) threw an exception when invoked on org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:136) at freemarker.ext.beans.SimpleMethodModel.get(SimpleMethodModel.java:146) at freemarker.core.DynamicKeyName.dealWithNumericalKey(DynamicKeyName.java:111) at freemarker.core.DynamicKeyName._getAsTemplateModel(DynamicKeyName.java:90) at freemarker.core.Expression.getAsTemplateModel(Expression.java:89) at freemarker.core.Expression.getStringValue(Expression.java:93) at freemarker.core.DollarVariable.accept(DollarVariable.java:76) at freemarker.core.Environment.visit(Environment.java:196) at freemarker.core.MixedContent.accept(MixedContent.java:92) at freemarker.core.Environment.visit(Environment.java:196) at freemarker.core.IfBlock.accept(IfBlock.java:82) at freemarker.core.Environment.visit(Environment.java:196) at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:172) at freemarker.core.Environment.visit(Environment.java:351) at freemarker.core.IteratorBlock.accept(IteratorBlock.java:95) at freemarker.core.Environment.visit(Environment.java:196) at freemarker.core.MixedContent.accept(MixedContent.java:92) at freemarker.core.Environment.visit(Environment.java:196) at freemarker.core.IfBlock.accept(IfBlock.java:82) at freemarker.core.Environment.visit(Environment.java:196) at freemarker.core.MixedContent.accept(MixedContent.java:92) at freemarker.core.Environment.visit(Environment.java:196) at freemarker.core.Environment.process(Environment.java:176) at freemarker.template.Template.process(Template.java:232) at org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:703) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485) at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:112) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.NullPointerException at freemarker.ext.beans.BeansWrapper.unwrapArguments(BeansWrapper.java:573) at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:109) ... 42 more 2009-6-23 18:59:55 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet default threw exception java.lang.IllegalStateException at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:407) at org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:707) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485) at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:112) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619) [b]问题补充:[/b] if (StringUtils.isNotBlank(this.id)) { this.model = (T) this.manager.get(this.id); } [color=red]这里我已删除了,才报错[/color] [b]问题补充:[/b] ywbanm: [color=red]我是先get出来 在修改属性 再merge [/color] 后台老是报这个错误::::::::: [color=red]WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 1062, SQLState: 23000 783391 [http-8080-5] ERROR org.hibernate.util.JDBCExceptionReporter - Duplicate entry '2009062323162784330' for key 'PRIMARY' 783391 [http-8080-5] ERROR org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update[/color] 能有什么办法解决吗 [b]问题补充:[/b] sql 语句 为:insert 怎样做才变成update 问题补充: [DEBUG] 2009-06-26 13:26:28,640 [org.springframework.transaction.interceptor.AbstractFallbackTransactionAttributeSource.getTransactionAttribute(AbstractFallbackTransactionAttributeSource.java:107)] Adding transactional method [save] with attribute [PROPAGATION_REQUIRED,ISOLATION_DEFAULT] Hibernate: insert into T_MODULE (DATECREATED, DATEMODIFED, DELETED, NAME, REMARK, OPTLOCK, HREF, HREFTARGET, LEAF, LEVEL, PARENTID, QTIP, TEXT, UIPROVIDER, DESCRIPTION, MODULENAME, URL, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 114829 [http-8080-6] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 1062, SQLState: 23000 114829 [http-8080-6] ERROR org.hibernate.util.JDBCExceptionReporter - Duplicate entry '2009062611061317130' for key 'PRIMARY' 114829 [http-8080-6] ERROR org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)

这个错误是出在哪里?是实体层有问题吗

Error creating bean with name 'basDictAction' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'basDictService' while setting bean property 'basDictService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'basDictService' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'basDictDao' while setting bean property 'basdictdao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'basDictDao' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Repeated column in mapping for entity: com.hr.entity.CstCustomer column: cust_level (should be mapped with insert="false" update="false")

求助!!!http500的问题

主要的问题是希望有高手能解答一下,谢谢了。最好能快一点和通俗一点。 <!-- 配置数据源 -使用c3p0连接池 --> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="com.mysql.jdbc.Driver" /><!-- 数据库驱动 --> <property name="jdbcUrl" value="jdbc:mysql://127.0.0.1:3306/depot" /> <!-- 连接URL --> <property name="user" value="root" /> <!-- 数据库用户名 --> <property name="password" value="123456" /> <!-- 数据库密码 --> <!-- c3p0连接池参数配置 --> <property name="initialPoolSize" value="3" /><!-- 初始化连接数 --> <property name="minPoolSize" value="2" /><!-- 最小连接数 --> <property name="maxPoolSize" value="10" /><!-- 连接池中保留的最大连接数 --> <property name="maxIdleTime" value="28000" /><!-- 连接的过期时间(秒) --> <property name="idleConnectionTestPeriod" value="3600" /><!-- 检查连接池中的空闲连接间隔时间(秒) --> </bean> 这是数据库连接 数据库的url是 jdbc:mysql://127.0.0.1:3306/Mysql 报错的全部信息在这里。 HTTP Status 500 - Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Unable to acquire JDBC Connection 。 type Exception report message Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Unable to acquire JDBC Connection description The server encountered an internal error that prevented it from fulfilling this request. exception org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Unable to acquire JDBC Connection org.springframework.orm.hibernate5.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:542) org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373) org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:447) org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:277) org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:656) com.service.UserService$$EnhancerBySpringCGLIB$$49abd10c.getUser(<generated>) com.action.UserAction.login(UserAction.java:42) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:894) ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1539) ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:68) com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethodWithDebugInfo(XWorkMethodAccessor.java:96) com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethod(XWorkMethodAccessor.java:88) ognl.OgnlRuntime.callMethod(OgnlRuntime.java:1615) ognl.ASTMethod.getValueBody(ASTMethod.java:91) ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212) ognl.SimpleNode.getValue(SimpleNode.java:258) ognl.Ognl.getValue(Ognl.java:467) ognl.Ognl.getValue(Ognl.java:431) com.opensymphony.xwork2.ognl.OgnlUtil$3.execute(OgnlUtil.java:351) com.opensymphony.xwork2.ognl.OgnlUtil.compileAndExecuteMethod(OgnlUtil.java:403) com.opensymphony.xwork2.ognl.OgnlUtil.callMethod(OgnlUtil.java:349) com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:436) com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252) org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:253) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:177) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:260) org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:73) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.doIntercept(ConversionErrorInterceptor.java:139) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:133) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:133) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:192) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:69) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.interceptor.DateTextFieldInterceptor.intercept(DateTextFieldInterceptor.java:115) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:88) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:246) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:99) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:139) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:155) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:174) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:120) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:171) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:195) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:193) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.factory.StrutsActionProxy.execute(StrutsActionProxy.java:54) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:564) org.apache.struts2.dispatcher.ExecuteOperations.executeAction(ExecuteOperations.java:81) org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:143) root cause org.hibernate.exception.GenericJDBCException: Unable to acquire JDBC Connection org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47) org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:111) org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:97) org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.acquireConnectionIfNeeded(LogicalConnectionManagedImpl.java:102) org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.getPhysicalConnection(LogicalConnectionManagedImpl.java:129) org.hibernate.internal.SessionImpl.connection(SessionImpl.java:514) org.springframework.orm.hibernate5.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:448) org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373) org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:447) org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:277) org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:656) com.service.UserService$$EnhancerBySpringCGLIB$$49abd10c.getUser(<generated>) com.action.UserAction.login(UserAction.java:42) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:894) ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1539) ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:68) com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethodWithDebugInfo(XWorkMethodAccessor.java:96) com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethod(XWorkMethodAccessor.java:88) ognl.OgnlRuntime.callMethod(OgnlRuntime.java:1615) ognl.ASTMethod.getValueBody(ASTMethod.java:91) ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212) ognl.SimpleNode.getValue(SimpleNode.java:258) ognl.Ognl.getValue(Ognl.java:467) ognl.Ognl.getValue(Ognl.java:431) com.opensymphony.xwork2.ognl.OgnlUtil$3.execute(OgnlUtil.java:351) com.opensymphony.xwork2.ognl.OgnlUtil.compileAndExecuteMethod(OgnlUtil.java:403) com.opensymphony.xwork2.ognl.OgnlUtil.callMethod(OgnlUtil.java:349) com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:436) com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252) org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:253) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:177) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:260) org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:73) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.doIntercept(ConversionErrorInterceptor.java:139) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:133) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:133) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:192) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:69) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.interceptor.DateTextFieldInterceptor.intercept(DateTextFieldInterceptor.java:115) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:88) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:246) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:99) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:139) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:155) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:174) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:120) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:171) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:195) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:193) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.factory.StrutsActionProxy.execute(StrutsActionProxy.java:54) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:564) org.apache.struts2.dispatcher.ExecuteOperations.executeAction(ExecuteOperations.java:81) org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:143) root cause java.sql.SQLException: Connections could not be acquired from the underlying database! com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:118) com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:692) com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:140) org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122) org.hibernate.internal.NonContextualJdbcConnectionAccess.obtainConnection(NonContextualJdbcConnectionAccess.java:35) org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.acquireConnectionIfNeeded(LogicalConnectionManagedImpl.java:99) org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.getPhysicalConnection(LogicalConnectionManagedImpl.java:129) org.hibernate.internal.SessionImpl.connection(SessionImpl.java:514) org.springframework.orm.hibernate5.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:448) org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373) org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:447) org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:277) org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:656) com.service.UserService$$EnhancerBySpringCGLIB$$49abd10c.getUser(<generated>) com.action.UserAction.login(UserAction.java:42) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:894) ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1539) ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:68) com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethodWithDebugInfo(XWorkMethodAccessor.java:96) com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethod(XWorkMethodAccessor.java:88) ognl.OgnlRuntime.callMethod(OgnlRuntime.java:1615) ognl.ASTMethod.getValueBody(ASTMethod.java:91) ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212) ognl.SimpleNode.getValue(SimpleNode.java:258) ognl.Ognl.getValue(Ognl.java:467) ognl.Ognl.getValue(Ognl.java:431) com.opensymphony.xwork2.ognl.OgnlUtil$3.execute(OgnlUtil.java:351) com.opensymphony.xwork2.ognl.OgnlUtil.compileAndExecuteMethod(OgnlUtil.java:403) com.opensymphony.xwork2.ognl.OgnlUtil.callMethod(OgnlUtil.java:349) com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:436) com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252) org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:253) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:177) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:260) org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:73) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.doIntercept(ConversionErrorInterceptor.java:139) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:133) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:133) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:192) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:69) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.interceptor.DateTextFieldInterceptor.intercept(DateTextFieldInterceptor.java:115) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:88) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:246) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:99) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:139) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:155) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:174) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:120) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:171) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:195) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:193) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.factory.StrutsActionProxy.execute(StrutsActionProxy.java:54) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:564) org.apache.struts2.dispatcher.ExecuteOperations.executeAction(ExecuteOperations.java:81) org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:143) root cause com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source. com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1469) com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:644) com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:554) com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutAndMarkConnectionInUse(C3P0PooledConnectionPool.java:758) com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:685) com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:140) org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122) org.hibernate.internal.NonContextualJdbcConnectionAccess.obtainConnection(NonContextualJdbcConnectionAccess.java:35) org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.acquireConnectionIfNeeded(LogicalConnectionManagedImpl.java:99) org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.getPhysicalConnection(LogicalConnectionManagedImpl.java:129) org.hibernate.internal.SessionImpl.connection(SessionImpl.java:514) org.springframework.orm.hibernate5.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:448) org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373) org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:447) org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:277) org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:656) com.service.UserService$$EnhancerBySpringCGLIB$$49abd10c.getUser(<generated>) com.action.UserAction.login(UserAction.java:42) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:894) ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1539) ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:68) com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethodWithDebugInfo(XWorkMethodAccessor.java:96) com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethod(XWorkMethodAccessor.java:88) ognl.OgnlRuntime.callMethod(OgnlRuntime.java:1615) ognl.ASTMethod.getValueBody(ASTMethod.java:91) ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212) ognl.SimpleNode.getValue(SimpleNode.java:258) ognl.Ognl.getValue(Ognl.java:467) ognl.Ognl.getValue(Ognl.java:431) com.opensymphony.xwork2.ognl.OgnlUtil$3.execute(OgnlUtil.java:351) com.opensymphony.xwork2.ognl.OgnlUtil.compileAndExecuteMethod(OgnlUtil.java:403) com.opensymphony.xwork2.ognl.OgnlUtil.callMethod(OgnlUtil.java:349) com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:436) com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252) org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:253) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:177) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:260) org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:73) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.doIntercept(ConversionErrorInterceptor.java:139) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:133) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:133) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:192) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:69) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.interceptor.DateTextFieldInterceptor.intercept(DateTextFieldInterceptor.java:115) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:88) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:246) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:99) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:139) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:155) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:174) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:120) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:171) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:195) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:193) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) org.apache.struts2.factory.StrutsActionProxy.execute(StrutsActionProxy.java:54) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:564) org.apache.struts2.dispatcher.ExecuteOperations.executeAction(ExecuteOperations.java:81) org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:143) root cause java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support. com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:127) com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:95) com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:87) com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:61) com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:71) com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:76) com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:862) com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:444) com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:230) com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:226) com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175) com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220) com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206) com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203) com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138) com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125) com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44) com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870) com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696) root cause com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support. sun.reflect.GeneratedConstructorAccessor45.newInstance(Unknown Source) sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) java.lang.reflect.Constructor.newInstance(Constructor.java:423) com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:59) com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:83) com.mysql.cj.util.TimeUtil.getCanonicalTimezone(TimeUtil.java:128) com.mysql.cj.protocol.a.NativeProtocol.configureTimezone(NativeProtocol.java:2201) com.mysql.cj.protocol.a.NativeProtocol.initServerSession(NativeProtocol.java:2225) com.mysql.cj.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:1391) com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:993) com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:852) com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:444) com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:230) com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:226) com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175) com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220) com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206) com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203) com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138) com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125) com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44) com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870) com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696) note The full stack trace of the root cause is available in the Apache Tomcat/8.5.9 logs. 是从论坛上下下来的求助挺紧的26号上午就要用 是一个有关jsp和mysql数据库的仓储管理系统我用的是myeclipsi2017 和mysql8.0 tomcat8.5

No suitable driver found for jdbc:mysql

信息: Initializing Spring root WebApplicationContext [2019-03-29 16:25:12]-[localhost-startStop-1- WARN]-[org.hibernate.util.JDBCExceptionReporter-logExceptions(100)]: SQL Error: 0, SQLState: 08001 [2019-03-29 16:25:12]-[localhost-startStop-1-ERROR]-[org.hibernate.util.JDBCExceptionReporter-logExceptions(101)]: No suitable driver found for jdbc:mysql://localhost:3306/piccweixin [2019-03-29 16:25:12]-[localhost-startStop-1- WARN]-[org.hibernate.cfg.SettingsFactory-buildSettings(144)]: Could not obtain connection metadata java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/piccweixin at java.sql.DriverManager.getConnection(DriverManager.java:596) at java.sql.DriverManager.getConnection(DriverManager.java:187) at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:174) at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:165) at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:149) at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.java:119) at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:82) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:111) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:814) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:732) at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) 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:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5181) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5704) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1018) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:994) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1296) at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2039) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) [2019-03-29 16:25:15]-[localhost-startStop-1- WARN]-[org.hibernate.util.JDBCExceptionReporter-logExceptions(100)]: SQL Error: 0, SQLState: 08001 [2019-03-29 16:25:15]-[localhost-startStop-1-ERROR]-[org.hibernate.util.JDBCExceptionReporter-logExceptions(101)]: No suitable driver found for jdbc:mysql://localhost:3306/piccweixin [2019-03-29 16:25:15]-[localhost-startStop-1- WARN]-[org.hibernate.util.JDBCExceptionReporter-logExceptions(100)]: SQL Error: 0, SQLState: 08001 [2019-03-29 16:25:15]-[localhost-startStop-1-ERROR]-[org.hibernate.util.JDBCExceptionReporter-logExceptions(101)]: No suitable driver found for jdbc:mysql://localhost:3306/piccweixin [2019-03-29 16:25:15]-[localhost-startStop-1- WARN]-[org.apache.struts.util.PropertyMessageResources-loadLocale(352)]: Resource org/apache/struts/action/ActionResources_zh_CN.properties Not Found. [2019-03-29 16:25:15]-[localhost-startStop-1- WARN]-[org.apache.struts.util.PropertyMessageResources-loadLocale(352)]: Resource org/apache/struts/action/ActionResources_zh.properties Not Found. 三月 29, 2019 4:25:15 下午 org.apache.catalina.core.ApplicationContext log 严重: action: null org.springframework.dao.DataAccessResourceFailureException: Cannot open connection; nested exception is org.hibernate.exception.JDBCConnectionException: Cannot open connection at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:627) at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412) at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424) at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:339) at com.triman.dao.impl.HibernateTemplate.findByExample(HibernateTemplate.java:27) at com.triman.dao.impl.GenericDAOImpl.findByExample(GenericDAOImpl.java:38) at com.triman.service.impl.GenericServiceImpl.findByExample(GenericServiceImpl.java:60) at com.triman.service.impl.GenericServiceImpl.findByExample(GenericServiceImpl.java:54) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) 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.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy8.findByExample(Unknown Source) at com.triman.struts.StrutsConfigPlugin.loadResource(StrutsConfigPlugin.java:180) at com.triman.struts.StrutsConfigPlugin.init(StrutsConfigPlugin.java:69) at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:871) at org.apache.struts.action.ActionServlet.init(ActionServlet.java:359) at javax.servlet.GenericServlet.init(GenericServlet.java:158) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1230) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1174) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1066) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5433) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5731) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1018) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:994) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1296) at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2039) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: org.hibernate.exception.JDBCConnectionException: Cannot open connection at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:97) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52) at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449) at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167) at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161) at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1573) at org.hibernate.loader.Loader.doQuery(Loader.java:696) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259) at org.hibernate.loader.Loader.doList(Loader.java:2228) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125) at org.hibernate.loader.Loader.list(Loader.java:2120) at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:118) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1596) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:306) at com.triman.dao.impl.HibernateTemplate$1.doInHibernate(HibernateTemplate.java:41) at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419) ... 39 more Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/piccweixin at java.sql.DriverManager.getConnection(DriverManager.java:596) at java.sql.DriverManager.getConnection(DriverManager.java:187) at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:174) at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:165) at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:149) at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.java:119) at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:82) at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446) ... 52 more 三月 29, 2019 4:25:15 下午 org.apache.catalina.core.ApplicationContext log 信息: Marking servlet action as unavailable 三月 29, 2019 4:25:15 下午 org.apache.catalina.core.StandardContext loadOnStartup 严重: Servlet [action] in web application [/piccweixin] threw load() exception javax.servlet.UnavailableException at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:880) at org.apache.struts.action.ActionServlet.init(ActionServlet.java:359) at javax.servlet.GenericServlet.init(GenericServlet.java:158) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1230) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1174) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1066) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5433) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5731) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1018) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:994) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1296) at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2039) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) ``` ```

SSH总报Orders表不存在

[b]小弟使用struts2.1.6+Spring2.5+hibernate3.3做了一个项目,在本地Windows上正常,由于项目要在Linux上运行,日志总报以下错误:[/b] :cry: [code="java"] 2009-11-16 10:03:11,307 WARN [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1146, SQLState: 42S02 2009-11-16 10:03:11,308 ERROR [org.hibernate.util.JDBCExceptionReporter] - Table 'shop.Orders' doesn't exist 2009-11-16 10:03:11,308 ERROR [com.shop.common.dao.implay.BaseDAOImplay] - 查询出错了!! org.hibernate.exception.SQLGrammarException: could not execute query at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.loader.Loader.doList(Loader.java:2235) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2129) at org.hibernate.loader.Loader.list(Loader.java:2124) at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:312) at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1723) at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165) at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:175) at com.shop.common.dao.implay.BaseDAOImplay$4.doInHibernate(BaseDAOImplay.java:285) at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419) at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:339) at com.shop.common.dao.implay.BaseDAOImplay.findSQL(BaseDAOImplay.java:275) at com.shop.order.dao.implay.OrdersDAOImplay.findOrderStatusNumDAO(OrdersDAOImplay.java:112) at com.shop.order.service.implay.OrderServiceImplay.findOrderStatusNumService(OrderServiceImplay.java:62) 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:307) 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.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'shop.Orders' doesn't exist at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.Util.getInstance(Util.java:381) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3515) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3447) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1951) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2101) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2554) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1761) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1912) at sun.reflect.GeneratedMethodAccessor145.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.logicalcobwebs.proxool.ProxyStatement.invoke(ProxyStatement.java:100) at org.logicalcobwebs.proxool.ProxyStatement.intercept(ProxyStatement.java:57) at $java.sql.Wrapper$$EnhancerByProxool$$19d445f0.executeQuery(<generated>) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208) at org.hibernate.loader.Loader.getResultSet(Loader.java:1812) at org.hibernate.loader.Loader.doQuery(Loader.java:697) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259) at org.hibernate.loader.Loader.doList(Loader.java:2232) ... 104 more [/code] [b]但是数据都能查询出来,原来名字起的是order,后来与SQL的关键字冲突,就在后面加了个s,现在变成数据能查出来,就是这个错误,而且在本地Windows上正常,Linux不正常,请大侠们指点一下.[/b] [b]问题补充:[/b] [color=orange][b]我把数据库中的改成大小的. 它提示我 Table 'shop.orders' doesn't exist 刚好和开始的不一样了,并且查询不到结果.. 报的错误是一样的.. 这个问题大家遇到过吗?虽然结果能查询出来,但是它老报找不到表,好烦人的.[/b][/color]

无法执行sql 语句 怎么回事啊?

我的项目是用struts hibernate 还有spring 组合的 可是当我执行这个事务的时候 我的sql 语句无法执行 [code="java"] public User findByEmail(String name , String password){ String hql = "from com.buat.model.User"; Query query =this.getSession().createSQLQuery(hql); List<User> list = query.list(); //这里无法执行 User user = list.get(0); return user ; } [/code] [b][color=red]这是我的控制台所报的错误[/color] [/b] 严重: Servlet.service() for servlet action threw exception com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from com.buat.model.User' at line 1 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665) at com.mysql.jdbc.Connection.execSQL(Connection.java:3124) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1149) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1262) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:92) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186) at org.hibernate.loader.Loader.getResultSet(Loader.java:1668) at org.hibernate.loader.Loader.doQuery(Loader.java:662) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224) at org.hibernate.loader.Loader.doList(Loader.java:2144) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028) at org.hibernate.loader.Loader.list(Loader.java:2023) at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289) at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695) at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142) at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150) at com.buat.service.UserManager.findByEmail(UserManager.java:20) at com.buat.service.UserManager$$FastClassByCGLIB$$3c143d2e.invoke(<generated>) at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:714) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:162) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:652) at com.buat.service.UserManager$$EnhancerByCGLIB$$684b62ee.findByEmail(<generated>) at com.buat.action.BookAction.validatorUser(BookAction.java:73) 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:585) at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270) at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:174) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:78) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:595) 2009-04-16 19:14:28,531 ERROR [/springside/bookManager.do] - <org.hibernate.exception.SQLGrammarException: could not execute query> javax.servlet.ServletException: org.hibernate.exception.SQLGrammarException: could not execute query at org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:535) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:433) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:174) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:78) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:595) Caused by: org.hibernate.exception.SQLGrammarException: could not execute query at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.loader.Loader.doList(Loader.java:2147) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028) at org.hibernate.loader.Loader.list(Loader.java:2023) at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289) at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695) at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142) at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150) at com.buat.service.UserManager.findByEmail(UserManager.java:20) at com.buat.service.UserManager$$FastClassByCGLIB$$3c143d2e.invoke(<generated>) at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:714) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:162) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:652) at com.buat.service.UserManager$$EnhancerByCGLIB$$684b62ee.findByEmail(<generated>) at com.buat.action.BookAction.validatorUser(BookAction.java:73) 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:585) at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270) at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) ... 25 more Caused by: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from com.buat.model.User' at line 1 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665) at com.mysql.jdbc.Connection.execSQL(Connection.java:3124) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1149) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1262) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:92) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186) at org.hibernate.loader.Loader.getResultSet(Loader.java:1668) at org.hibernate.loader.Loader.doQuery(Loader.java:662) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224) at org.hibernate.loader.Loader.doList(Loader.java:2144) ... 48 more [b]问题补充:[/b] 我的项目是用struts hibernate 还有spring 组合的 可是当我执行这个事务的时候 我的sql 语句无法执行 [code="java"] public User findByEmail(String name , String password){ String hql = "from com.buat.model.User"; Query query =this.getSession().createSQLQuery(hql); List<User> list = query.list(); //这里无法执行 User user = list.get(0); return user ; } [/code] [b][color=red]这是我的控制台所报的错误[/color] [/b] Hibernate: from com.buat.model.User 2009-04-16 19:28:05,709 WARN [org.hibernate.util.JDBCExceptionReporter] - <SQL Error: 1064, SQLState: 42000> 2009-04-16 19:28:05,712 ERROR [org.hibernate.util.JDBCExceptionReporter] - <You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from com.buat.model.User' at line 1> [b]问题补充:[/b] 你也没有给我解决的方案啊 、、、、

初学hibernate,简单地用了一下SSH2,出现一种难明的错误

用《开发者突击》里面的初步搭建SSH2的代码,连接sqlserver2005,出现下面提示: Hibernate: select user0_.ID as ID, user0_.username as username0_, user0_.password as password0_, user0_.email as email0_ from user user0_ where user0_.username=? WARN - SQL Error: 156, SQLState: S0001 ERROR - 关键字 'user' 附近有语法错误。 2010-12-28 22:22:11 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet default threw exception com.microsoft.sqlserver.jdbc.SQLServerException: 关键字 'user' 附近有语法错误。 数据库中我建了表 user,属性有id username password email。 applicationContext 代码如下: [code="xml"] <!-- 配置数据源 --> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"> </property> <property name="url" value="jdbc:sqlserver://localhost:1433;databaseName=DeviceManagement;"> </property> <property name="username" value="sa"></property> <property name="password" value="123456"></property> </bean> <!-- 配置Hibernate --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="mappingResources"> <list> <value>com/demo/hibernate/beans/User.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.SQLServerDialect </prop> <prop key="hibernate.show_sql">true</prop> </props> </property> </bean> <!-- 配置事务 --> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory"> <ref local="sessionFactory" /> </property> </bean> <!-- 定义DAO --> <bean id="userDAO" class="com.demo.hibernate.dao.UserDAO"> <property name="sessionFactory"> <ref local="sessionFactory" /> </property> </bean> <!-- 定义DAO代理 --> <bean id="UserDAOProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"> <ref bean="transactionManager" /> </property> <property name="target"> <ref local="userDAO" /> </property> <property name="transactionAttributes"> <props> <prop key="insert*">PROPAGATION_REQUIRED</prop> <prop key="*">PROPAGATION_REQUIRED,readOnly</prop> </props> </property> </bean> <!-- 定义Struts配置 --> <bean name="loginAction" class="com.demo.struts2.actions.LoginAction"> <property name="userDAO"> <ref local="userDAO" /> </property> </bean> <bean name="logoutAction" class="com.demo.struts2.actions.LogoutAction"> <property name="userDAO"> <ref local="userDAO" /> </property> </bean> <bean name="registerAction" class="com.demo.struts2.actions.RegisterAction"> <property name="userDAO"> <ref local="userDAO" /> </property> </bean> <!-- 配置拦截器 --> <bean name="logger" class="com.demo.spring.aop.LoggingInterceptor" /> <!-- 配置拦截器代理 --> <bean name="loggingAutoProxy" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"> <property name="beanNames"> <list> <value>/login</value> <value>/register</value> </list> </property> <property name="interceptorNames"> <list> <value>logger</value> </list> </property> </bean> [/code] [size=x-large]提示错误行在UserDao里面, [/size]UserDao [code="java"] package com.demo.hibernate.dao; import java.util.ArrayList; import java.util.List; import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.criterion.Restrictions; import org.springframework.orm.hibernate3.HibernateCallback; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; import com.demo.hibernate.beans.User; public class UserDAO extends HibernateDaoSupport implements IUserDAO { // 验证用户名和密码 public boolean isValid(final String username, final String password) { System.out.println("UserDao检验是否有效"); System.err.println("username:"+username+",password:"+password); List list = (List) getHibernateTemplate().execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { /////////////////////////////////////这里报错/////////////////////////////// List result = session.createCriteria(User.class).add( Restrictions.eq("username", username)).add( Restrictions.eq("password", password)).list(); return result; } }); if (list.size() > 0) { return true; } else { return false; } } // 判断某个用户是否存在,只需用用户名查询就可以 public boolean isExist(final String username) { System.err.println("UserDao进行查询"); List list = (List) getHibernateTemplate().execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { List result = session.createCriteria(User.class).add( Restrictions.eq("username", username)).list(); return result; } }); if (list.size() > 0) { return true; } else { return false; } } //插入新的用户对象到数据库 public void insertUser(User user) { System.err.println("UserDao插入数据"); getHibernateTemplate().saveOrUpdate(user); } //从数据库中取得用户对象 public User getUser(String userid) { System.err.println("UserDao取得对象"); return (User) getHibernateTemplate().get(User.class, new Integer(userid)); } //取得用户所有详细信息 public List getUsers() { System.err.println("UserDao取得数据"); return getHibernateTemplate().find("from User"); } //删除某个用户的所有信息 public void deleteUser(String userid) { System.err.println("UserDao删除某个用户的所有信息"); Object p = getHibernateTemplate().load(User.class, new Integer(userid)); getHibernateTemplate().delete(p); } } [/code] 请问这是为什么呢?

Struts2+Spring+hibernate问题

信息: HTMLManager: start: Starting web application at '/Lianxi' 2009-8-17 23:04:26 org.apache.catalina.loader.WebappClassLoader validateJarFile 信息: validateJarFile(C:\Program Files\Tomcat 6.0\webapps\Lianxi\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class 2009-8-17 23:04:26 org.apache.catalina.loader.WebappClassLoader validateJarFile 信息: validateJarFile(C:\Program Files\Tomcat 6.0\webapps\Lianxi\WEB-INF\lib\servlet.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class 2009-8-17 23:04:30 org.apache.catalina.core.ApplicationContext log 信息: Initializing Spring root WebApplicationContext log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader). log4j:WARN Please initialize the log4j system properly. 2009-8-17 23:04:32 org.apache.catalina.core.StandardContext listenerStart 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 2 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'. Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:76) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:351) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:280) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:131) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:147) at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124) at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92) at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:101) at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:389) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:324) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:244) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:187) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3830) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4337) at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1237) at org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:591) at org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:128) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Unknown Source) 2009-8-17 23:04:32 org.apache.catalina.core.StandardContext start 严重: Error listenerStart 2009-8-17 23:04:32 org.apache.catalina.core.StandardContext start 严重: Context [/Lianxi] startup failed due to previous errors 2009-8-17 23:04:32 org.apache.catalina.core.ApplicationContext log 信息: Closing Spring root WebApplicationContext 2009-8-17 23:04:33 org.apache.catalina.core.ApplicationContext log 信息: HTMLManager: list: Listing contexts for virtual host 'localhost' [b]问题补充:[/b] <?xml version="1.0" encoding="UTF-8"?> <beans> xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"> </property> <property name="url" value="jdbc:microsoft:sqlserver://localhost:1433"> </property> <property name="username" value="sa"></property> <property name="password" value="sa"></property> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.SQLServerDialect </prop> </props> </property> <property name="mappingResources"> <list> <value>com/ljw/vo/Liuyan.hbm.xml</value></list> </property></bean> <bean id="hibernateTransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory"> <ref local="sessionFactory" /> </property> </bean> <!-- ============================== baseTransactionProxyBean =========================== --> <bean id="baseTransactionProxyBean" lazy-init="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"> <ref bean="hibernateTransactionManager" /> </property> <property name="transactionAttributes"> <props> <prop key="*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- ============================== dbDao =========================== --> <bean id="dbDaoTarget" class="com.ljw.dao.imp.DbDaoImple"> <property name="sessionFactory"> <ref local="sessionFactory" /> </property> </bean> <bean id="dbDao" parent="baseTransactionProxyBean"> <property name="target"> <ref local="dbDaoTarget" /> </property> </bean> <bean id="ServiceImp" class="com.ljw.service.imp.ServiceImp" abstract="false" lazy-init="default" autowire="default" dependency-check="default"> <property name="dbDao"> <ref bean="dbDao"></ref> </property> </bean> </beans> [b]问题补充:[/b] 加载配置 :cry: :cry: :cry: 还是不对啊! [b]问题补充:[/b] 2009-8-18 16:19:00 org.apache.catalina.core.AprLifecycleListener init 信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\MyEclipse 6.5\bin;C:\Program Files\Tomcat 6.0\bin 2009-8-18 16:19:00 org.apache.coyote.http11.Http11Protocol init 信息: Initializing Coyote HTTP/1.1 on http-8080 2009-8-18 16:19:00 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 917 ms 2009-8-18 16:19:00 org.apache.catalina.core.StandardService start 信息: Starting service Catalina 2009-8-18 16:19:00 org.apache.catalina.core.StandardEngine start 信息: Starting Servlet Engine: Apache Tomcat/6.0.14 2009-8-18 16:19:01 org.apache.catalina.loader.WebappClassLoader validateJarFile 信息: validateJarFile(C:\Program Files\Tomcat 6.0\webapps\Lianxi\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class 2009-8-18 16:19:01 org.apache.catalina.loader.WebappClassLoader validateJarFile 信息: validateJarFile(C:\Program Files\Tomcat 6.0\webapps\Lianxi\WEB-INF\lib\servlet.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class 2009-8-18 16:19:05 org.apache.catalina.core.ApplicationContext log 信息: Initializing Spring root WebApplicationContext log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader). log4j:WARN Please initialize the log4j system properly. 2009-8-18 16:19:11 org.apache.catalina.core.StandardContext listenerStart 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V Caused by: java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V at net.sf.cglib.core.ClassEmitter.begin_class(ClassEmitter.java:77) at net.sf.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:173) at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25) at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216) at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:117) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104) at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69) at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:117) at org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:43) at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:162) at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135) at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55) at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:56) at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:295) at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434) at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109) at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:805) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:745) at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:134) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1202) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1172) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:428) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:284) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:244) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:187) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3830) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4337) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java: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(LifecycleSupport.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:516) 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(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) 2009-8-18 16:19:11 org.apache.catalina.core.StandardContext start 严重: Error listenerStart 2009-8-18 16:19:11 org.apache.catalina.core.StandardContext start 严重: Context [/Lianxi] startup failed due to previous errors 2009-8-18 16:19:11 org.apache.catalina.core.ApplicationContext log 信息: Closing Spring root WebApplicationContext log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader). log4j:WARN Please initialize the log4j system properly. 2009-8-18 16:19:16 org.apache.catalina.core.ApplicationContext log 信息: Loading Spring root WebApplicationContext 2009-8-18 16:19:23 org.apache.coyote.http11.Http11Protocol start 信息: Starting Coyote HTTP/1.1 on http-8080 2009-8-18 16:19:23 org.apache.jk.common.ChannelSocket init 信息: JK: ajp13 listening on /0.0.0.0:8009 2009-8-18 16:19:23 org.apache.jk.server.JkMain start 信息: Jk running ID=0 time=0/63 config=null 2009-8-18 16:19:23 org.apache.catalina.startup.Catalina start 信息: Server startup in 23255 ms 先谢谢您了 [b]问题补充:[/b] 朋友咱还是加QQ吧! 123698108 [b]问题补充:[/b] :idea: :idea: :idea: :idea: 2009-8-18 17:13:43 org.apache.catalina.core.AprLifecycleListener init 信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\MyEclipse 6.5\bin;C:\Program Files\Tomcat 6.0\bin 2009-8-18 17:13:43 org.apache.coyote.http11.Http11Protocol init 信息: Initializing Coyote HTTP/1.1 on http-8080 2009-8-18 17:13:43 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 962 ms 2009-8-18 17:13:43 org.apache.catalina.core.StandardService start 信息: Starting service Catalina 2009-8-18 17:13:43 org.apache.catalina.core.StandardEngine start 信息: Starting Servlet Engine: Apache Tomcat/6.0.14 2009-8-18 17:13:44 org.apache.catalina.loader.WebappClassLoader validateJarFile 信息: validateJarFile(C:\Program Files\Tomcat 6.0\webapps\Lianxi\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class 2009-8-18 17:13:44 org.apache.catalina.loader.WebappClassLoader validateJarFile 信息: validateJarFile(C:\Program Files\Tomcat 6.0\webapps\Lianxi\WEB-INF\lib\servlet.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader). log4j:WARN Please initialize the log4j system properly. 2009-8-18 17:13:46 org.apache.catalina.core.ApplicationContext log 信息: Loading Spring root WebApplicationContext log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader). log4j:WARN Please initialize the log4j system properly. 2009-8-18 17:13:58 org.apache.catalina.core.ApplicationContext log 信息: Loading Spring root WebApplicationContext 2009-8-18 17:14:05 org.apache.coyote.http11.Http11Protocol start 信息: Starting Coyote HTTP/1.1 on http-8080 2009-8-18 17:14:05 org.apache.jk.common.ChannelSocket init 信息: JK: ajp13 listening on /0.0.0.0:8009 2009-8-18 17:14:05 org.apache.jk.server.JkMain start 信息: Jk running ID=0 time=0/46 config=null 2009-8-18 17:14:05 org.apache.catalina.startup.Catalina start 信息: Server startup in 22427 ms [b]问题补充:[/b] [size=large]我加您好友可以吗[/size]

HQL 问题 !!!

HQL支持 insert into 表名1 select * from 表名2 吗 [b]问题补充:[/b] 这个是继承了org.springframework.orm.hibernate3.support.HibernateDaoSupport类 —————————————————————————————————————— s = this.getSession(); String hql = "insert into Articles select a.artiId,a.artiName,a.artiSpec,a.artiModel,a.artiMarkPrice,a.artiAssociatorPrice,a.artiInfo,a.artiFlag," + "ac.artiClassName,ab.artiBrandName,ap.artiPhotoPath " + "from Article a,Articlass ac,Artibrand ab,Artiphoto ap" + " where a.artiClassId = ac.artiClassId and a.artiBrandId = ab.artiBrandId and a.artiPhotoId = ap.artiPhotoId"; t = s.beginTransaction(); s.createQuery(hql).executeUpdate(); t.commit(); 出现问题 —————————————————————————————————— org.hibernate.hql.ast.QuerySyntaxException: expecting OPEN, found 'select' near line 1, column 22 [insert into Articles select a.artiId,a.artiName,a.artiSpec,a.artiModel,a.artiMarkPrice,a.artiAssociatorPrice,a.artiInfo,a.artiFlag,ac.artiClassName,ab.artiBrandName,ap.artiPhotoPath from com.articleweb.model.Article a,com.articleweb.model.Articlass ac,com.articleweb.model.Artibrand ab,com.articleweb.model.Artiphoto ap where a.artiClassId = ac.artiClassId and a.artiBrandId = ab.artiBrandId and a.artiPhotoId = ap.artiPhotoId] at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59) at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:244) at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:155) at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:109) at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:75) at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:54) at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71) at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133) at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112) at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1583) at com.articleweb.model.control.ArticleControl.insertArticles(ArticleControl.java:27) at com.articleweb.struts.action.ArticlesAction.showarti(ArticlesAction.java:47) 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.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280) at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216) at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:106) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689) at java.lang.Thread.run(Thread.java:619) [b]问题补充:[/b] 我是在MYSQL数据上 用SQL 试过之后才到HQL用的。 既然HQL支持的就不应该有这样的问题吧。查出来的结果结构和要导入的表结果是相同的。 [b]问题补充:[/b] Hibernate 3.1 数据库绝对支持这个方法 我试用过后才到HQL里运用的。 [b]问题补充:[/b] 要是可以用SQL的问题就不存在了。郁闷中。 [b]问题补充:[/b] 楼上的高手不是说HQL支持这个语法的吗 [b]问题补充:[/b] 这个跟关联查询有关系吗?字段和表名我都是按类对象来写的。 就是不行。 无奈了。 快背熟了 没错别字 还是不行 [b]问题补充:[/b] insert into Articles select a.artiId,a.artiName,a.artiSpec,a.artiModel,a.artiMarkPrice,a.artiAssociatorPrice,a.artiInfo,a.artiFlag," + "ac.artiClassName,ab.artiBrandName,ap.artiPhotoPath " + "from Article a,Articlass ac,Artibrand ab,Artiphoto ap" + " where a.artiClassId = ac.artiClassId and a.artiBrandId = ab.artiBrandId and a.artiPhotoId = ap.artiPhotoId [b]问题补充:[/b] String hql = "insert into Articles(artiId,artiName,artiSpec,artiModel,artiMarkPrice,artiAssociatorPrice,artiInfo,artiFlag,artiClassName,artiBrandName,artiPhotoPath)" + " select a.artiId,a.artiName,a.artiSpec,a.artiModel,a.artiMarkPrice,a.artiAssociatorPrice,a.artiInfo,a.artiFlag," + "ac.artiClassName,ab.artiBrandName,ap.artiPhotoPath " + "from Article a,Articlass ac,Artibrand ab,Artiphoto ap" + " where a.artiClassId = ac.artiClassId and a.artiBrandId = ab.artiBrandId and a.artiPhotoId = ap.artiPhotoId"; [b]问题补充:[/b] 异常变了 —————————————————————————————————————— org.hibernate.exception.ConstraintViolationException: could not execute update query at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:84) at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:334) at org.hibernate.engine.query.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:209) at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1126) at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:94) at com.articleweb.model.control.ArticleControl.insertArticles(ArticleControl.java:28) at com.articleweb.struts.action.ArticlesAction.showarti(ArticlesAction.java:47) 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.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280) at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216) at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:106) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689) at java.lang.Thread.run(Thread.java:619) Caused by: java.sql.SQLException: Duplicate entry '1' for key 1 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2921) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1570) at com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1085) at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:670) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1159) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1076) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1061) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102) at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:75) ... 33 more 16:58:21,437 DEBUG JDBCTransaction:152 - rollback 16:58:21,437 DEBUG JDBCTransaction:193 - re-enabling autocommit 16:58:21,437 DEBUG JDBCTransaction:163 - rolled back JDBC Connection 16:58:21,437 DEBUG QueryTranslatorImpl:236 - parse() - HQL: from com.articleweb.model.Articles 16:58:21,437 DEBUG ErrorCounter:68 - throwQueryException() : no errors 16:58:21,437 DEBUG HqlSqlBaseWalker:111 - select << begin [level=1, statement=select] 16:58:21,437 DEBUG FromElement:104 - FromClause{level=1} : com.articleweb.model.Articles (no alias) -> articles0_ 16:58:21,437 DEBUG HqlSqlBaseWalker:117 - select : finishing up [level=1, statement=select] 16:58:21,437 DEBUG HqlSqlWalker:511 - processQuery() : ( SELECT ( FromClause{level=1} myweb.articles articles0_ ) ) 16:58:21,453 DEBUG HqlSqlWalker:713 - Derived SELECT clause created. 16:58:21,453 DEBUG JoinProcessor:128 - Using FROM fragment [myweb.articles articles0_] 16:58:21,453 DEBUG HqlSqlBaseWalker:123 - select >> end [level=1, statement=select] 16:58:21,453 DEBUG ErrorCounter:68 - throwQueryException() : no errors 16:58:21,453 DEBUG QueryTranslatorImpl:206 - HQL: from com.articleweb.model.Articles 16:58:21,453 DEBUG QueryTranslatorImpl:207 - SQL: select articles0_.ArtiID as ArtiID11_, articles0_.ArtiName as ArtiName11_, articles0_.ArtiSpec as ArtiSpec11_, articles0_.ArtiModel as ArtiModel11_, articles0_.ArtiMarkPrice as ArtiMark5_11_, articles0_.ArtiAssociatorPrice as ArtiAsso6_11_, articles0_.ArtiInfo as ArtiInfo11_, articles0_.ArtiFlag as ArtiFlag11_, articles0_.ArtiClassName as ArtiClas9_11_, articles0_.ArtiBrandName as ArtiBra10_11_, articles0_.ArtiPhotoPath as ArtiPho11_11_ from myweb.articles articles0_ 16:58:21,453 DEBUG ErrorCounter:68 - throwQueryException() : no errors [b]问题补充:[/b] 详细异常 ————————————————————————————————————————16:58:20,703 DEBUG JDBCTransaction:54 - begin 16:58:20,718 DEBUG JDBCTransaction:59 - current autocommit status: true 16:58:20,718 DEBUG JDBCTransaction:62 - disabling autocommit 16:58:20,890 DEBUG QueryTranslatorImpl:236 - parse() - HQL: insert into Articles(artiId,artiName,artiSpec,artiModel,artiMarkPrice,artiAssociatorPrice,artiInfo,artiFlag,artiClassName,artiBrandName,artiPhotoPath) select a.artiId,a.artiName,a.artiSpec,a.artiModel,a.artiMarkPrice,a.artiAssociatorPrice,a.artiInfo,a.artiFlag,ac.artiClassName,ab.artiBrandName,ap.artiPhotoPath from com.articleweb.model.Article a,com.articleweb.model.Articlass ac,com.articleweb.model.Artibrand ab,com.articleweb.model.Artiphoto ap where a.artiClassId = ac.artiClassId and a.artiBrandId = ab.artiBrandId and a.artiPhotoId = ap.artiPhotoId 16:58:20,906 DEBUG ErrorCounter:68 - throwQueryException() : no errors 16:58:21,015 DEBUG HqlSqlBaseWalker:111 - insert << begin [level=1, statement=insert] 16:58:21,062 DEBUG HqlSqlBaseWalker:111 - select << begin [level=2, statement=insert] 16:58:21,109 DEBUG FromElement:104 - FromClause{level=1} : com.articleweb.model.Article (a) -> article0_ 16:58:21,109 DEBUG FromElement:104 - FromClause{level=1} : com.articleweb.model.Articlass (ac) -> articlass1_ 16:58:21,109 DEBUG FromElement:104 - FromClause{level=1} : com.articleweb.model.Artibrand (ab) -> artibrand2_ 16:58:21,125 DEBUG FromElement:104 - FromClause{level=1} : com.articleweb.model.Artiphoto (ap) -> artiphoto3_ 16:58:21,125 DEBUG FromReferenceNode:51 - Resolved : a -> ArtiId 16:58:21,125 DEBUG DotNode:541 - getDataType() : artiId -> org.hibernate.type.IntegerType@e1cfa7 16:58:21,125 DEBUG FromReferenceNode:51 - Resolved : a.artiId -> article0_.ArtiId 16:58:21,125 DEBUG FromReferenceNode:51 - Resolved : a -> ArtiId 16:58:21,125 DEBUG DotNode:541 - getDataType() : artiName -> org.hibernate.type.StringType@10811b5 16:58:21,125 DEBUG FromReferenceNode:51 - Resolved : a.artiName -> article0_.ArtiName 16:58:21,125 DEBUG FromReferenceNode:51 - Resolved : a -> ArtiId 16:58:21,125 DEBUG DotNode:541 - getDataType() : artiSpec -> org.hibernate.type.StringType@10811b5 16:58:21,125 DEBUG FromReferenceNode:51 - Resolved : a.artiSpec -> article0_.ArtiSpec 16:58:21,156 DEBUG FromReferenceNode:51 - Resolved : a -> ArtiId 16:58:21,156 DEBUG DotNode:541 - getDataType() : artiModel -> org.hibernate.type.StringType@10811b5 16:58:21,156 DEBUG FromReferenceNode:51 - Resolved : a.artiModel -> article0_.ArtiModel 16:58:21,156 DEBUG FromReferenceNode:51 - Resolved : a -> ArtiId 16:58:21,156 DEBUG DotNode:541 - getDataType() : artiMarkPrice -> org.hibernate.type.FloatType@1af5853 16:58:21,156 DEBUG FromReferenceNode:51 - Resolved : a.artiMarkPrice -> article0_.ArtiMarkPrice 16:58:21,156 DEBUG FromReferenceNode:51 - Resolved : a -> ArtiId 16:58:21,156 DEBUG DotNode:541 - getDataType() : artiAssociatorPrice -> org.hibernate.type.FloatType@1af5853 16:58:21,156 DEBUG FromReferenceNode:51 - Resolved : a.artiAssociatorPrice -> article0_.ArtiAssociatorPrice 16:58:21,171 DEBUG FromReferenceNode:51 - Resolved : a -> ArtiId 16:58:21,171 DEBUG DotNode:541 - getDataType() : artiInfo -> org.hibernate.type.StringType@10811b5 16:58:21,171 DEBUG FromReferenceNode:51 - Resolved : a.artiInfo -> article0_.ArtiInfo 16:58:21,171 DEBUG FromReferenceNode:51 - Resolved : a -> ArtiId 16:58:21,171 DEBUG DotNode:541 - getDataType() : artiFlag -> org.hibernate.type.IntegerType@e1cfa7 16:58:21,171 DEBUG FromReferenceNode:51 - Resolved : a.artiFlag -> article0_.ArtiFlag 16:58:21,171 DEBUG FromReferenceNode:51 - Resolved : ac -> ArtiClassId 16:58:21,171 DEBUG DotNode:541 - getDataType() : artiClassName -> org.hibernate.type.StringType@10811b5 16:58:21,171 DEBUG FromReferenceNode:51 - Resolved : ac.artiClassName -> articlass1_.ArtiClassName 16:58:21,171 DEBUG FromReferenceNode:51 - Resolved : ab -> ArtiBrandId 16:58:21,171 DEBUG DotNode:541 - getDataType() : artiBrandName -> org.hibernate.type.StringType@10811b5 16:58:21,171 DEBUG FromReferenceNode:51 - Resolved : ab.artiBrandName -> artibrand2_.ArtiBrandName 16:58:21,171 DEBUG FromReferenceNode:51 - Resolved : ap -> ArtiPhotoId 16:58:21,171 DEBUG DotNode:541 - getDataType() : artiPhotoPath -> org.hibernate.type.StringType@10811b5 16:58:21,171 DEBUG FromReferenceNode:51 - Resolved : ap.artiPhotoPath -> artiphoto3_.ArtiPhotoPath 16:58:21,218 DEBUG FromReferenceNode:51 - Resolved : a -> ArtiId 16:58:21,218 DEBUG DotNode:541 - getDataType() : artiClassId -> org.hibernate.type.IntegerType@e1cfa7 16:58:21,218 DEBUG FromReferenceNode:51 - Resolved : a.artiClassId -> article0_.ArtiClassId 16:58:21,218 DEBUG FromReferenceNode:51 - Resolved : ac -> ArtiClassId 16:58:21,218 DEBUG DotNode:541 - getDataType() : artiClassId -> org.hibernate.type.IntegerType@e1cfa7 16:58:21,218 DEBUG FromReferenceNode:51 - Resolved : ac.artiClassId -> articlass1_.ArtiClassId 16:58:21,218 DEBUG FromReferenceNode:51 - Resolved : a -> ArtiId 16:58:21,218 DEBUG DotNode:541 - getDataType() : artiBrandId -> org.hibernate.type.IntegerType@e1cfa7 16:58:21,218 DEBUG FromReferenceNode:51 - Resolved : a.artiBrandId -> article0_.ArtiBrandId 16:58:21,218 DEBUG FromReferenceNode:51 - Resolved : ab -> ArtiBrandId 16:58:21,218 DEBUG DotNode:541 - getDataType() : artiBrandId -> org.hibernate.type.IntegerType@e1cfa7 16:58:21,218 DEBUG FromReferenceNode:51 - Resolved : ab.artiBrandId -> artibrand2_.ArtiBrandId 16:58:21,218 DEBUG FromReferenceNode:51 - Resolved : a -> ArtiId 16:58:21,218 DEBUG DotNode:541 - getDataType() : artiPhotoId -> org.hibernate.type.IntegerType@e1cfa7 16:58:21,234 DEBUG FromReferenceNode:51 - Resolved : a.artiPhotoId -> article0_.ArtiPhotoId 16:58:21,234 DEBUG FromReferenceNode:51 - Resolved : ap -> ArtiPhotoId 16:58:21,234 DEBUG DotNode:541 - getDataType() : artiPhotoId -> org.hibernate.type.IntegerType@e1cfa7 16:58:21,234 DEBUG FromReferenceNode:51 - Resolved : ap.artiPhotoId -> artiphoto3_.ArtiPhotoId 16:58:21,234 DEBUG HqlSqlBaseWalker:117 - select : finishing up [level=2, statement=insert] 16:58:21,234 DEBUG HqlSqlWalker:511 - processQuery() : ( SELECT ( {select clause} ( article0_.ArtiId ArtiId artiId ) ( article0_.ArtiName ArtiId artiName ) ( article0_.ArtiSpec ArtiId artiSpec ) ( article0_.ArtiModel ArtiId artiModel ) ( article0_.ArtiMarkPrice ArtiId artiMarkPrice ) ( article0_.ArtiAssociatorPrice ArtiId artiAssociatorPrice ) ( article0_.ArtiInfo ArtiId artiInfo ) ( article0_.ArtiFlag ArtiId artiFlag ) ( articlass1_.ArtiClassName ArtiClassId artiClassName ) ( artibrand2_.ArtiBrandName ArtiBrandId artiBrandName ) ( artiphoto3_.ArtiPhotoPath ArtiPhotoId artiPhotoPath ) ) ( FromClause{level=1} myweb.article article0_ myweb.articlass articlass1_ myweb.artibrand artibrand2_ myweb.artiphoto artiphoto3_ ) ( where ( and ( and ( = ( article0_.ArtiClassId ArtiId artiClassId ) ( articlass1_.ArtiClassId ArtiClassId artiClassId ) ) ( = ( article0_.ArtiBrandId ArtiId artiBrandId ) ( artibrand2_.ArtiBrandId ArtiBrandId artiBrandId ) ) ) ( = ( article0_.ArtiPhotoId ArtiId artiPhotoId ) ( artiphoto3_.ArtiPhotoId ArtiPhotoId artiPhotoId ) ) ) ) ) 16:58:21,281 DEBUG JoinProcessor:128 - Using FROM fragment [myweb.artiphoto artiphoto3_] 16:58:21,281 DEBUG JoinProcessor:128 - Using FROM fragment [myweb.artibrand artibrand2_] 16:58:21,281 DEBUG JoinProcessor:128 - Using FROM fragment [myweb.articlass articlass1_] 16:58:21,281 DEBUG JoinProcessor:128 - Using FROM fragment [myweb.article article0_] 16:58:21,281 DEBUG HqlSqlBaseWalker:123 - select >> end [level=2, statement=insert] 16:58:21,281 DEBUG HqlSqlBaseWalker:117 - insert : finishing up [level=1, statement=insert] 16:58:21,281 DEBUG HqlSqlBaseWalker:123 - insert >> end [level=1, statement=insert] 16:58:21,281 DEBUG ErrorCounter:68 - throwQueryException() : no errors 16:58:21,328 DEBUG ErrorCounter:68 - throwQueryException() : no errors 16:58:21,437 WARN JDBCExceptionReporter:71 - SQL Error: 1062, SQLState: 23000 16:58:21,437 ERROR JDBCExceptionReporter:72 - Duplicate entry '1' for key 1 org.hibernate.exception.ConstraintViolationException: could not execute update query at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:84) at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:334) at org.hibernate.engine.query.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:209) at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1126) at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:94) at com.articleweb.model.control.ArticleControl.insertArticles(ArticleControl.java:28) at com.articleweb.struts.action.ArticlesAction.showarti(ArticlesAction.java:47) 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.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280) at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216) at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:106) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689) at java.lang.Thread.run(Thread.java:619) Caused by: java.sql.SQLException: Duplicate entry '1' for key 1 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2921) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1570) at com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1085) at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:670) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1159) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1076) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1061) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102) at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:75) ... 33 more 16:58:21,437 DEBUG JDBCTransaction:152 - rollback 16:58:21,437 DEBUG JDBCTransaction:193 - re-enabling autocommit 16:58:21,437 DEBUG JDBCTransaction:163 - rolled back JDBC Connection 16:58:21,437 DEBUG QueryTranslatorImpl:236 - parse() - HQL: from com.articleweb.model.Articles 16:58:21,437 DEBUG ErrorCounter:68 - throwQueryException() : no errors 16:58:21,437 DEBUG HqlSqlBaseWalker:111 - select << begin [level=1, statement=select] 16:58:21,437 DEBUG FromElement:104 - FromClause{level=1} : com.articleweb.model.Articles (no alias) -> articles0_ 16:58:21,437 DEBUG HqlSqlBaseWalker:117 - select : finishing up [level=1, statement=select] 16:58:21,437 DEBUG HqlSqlWalker:511 - processQuery() : ( SELECT ( FromClause{level=1} myweb.articles articles0_ ) ) 16:58:21,453 DEBUG HqlSqlWalker:713 - Derived SELECT clause created. 16:58:21,453 DEBUG JoinProcessor:128 - Using FROM fragment [myweb.articles articles0_] 16:58:21,453 DEBUG HqlSqlBaseWalker:123 - select >> end [level=1, statement=select] 16:58:21,453 DEBUG ErrorCounter:68 - throwQueryException() : no errors 16:58:21,453 DEBUG QueryTranslatorImpl:206 - HQL: from com.articleweb.model.Articles 16:58:21,453 DEBUG QueryTranslatorImpl:207 - SQL: select articles0_.ArtiID as ArtiID11_, articles0_.ArtiName as ArtiName11_, articles0_.ArtiSpec as ArtiSpec11_, articles0_.ArtiModel as ArtiModel11_, articles0_.ArtiMarkPrice as ArtiMark5_11_, articles0_.ArtiAssociatorPrice as ArtiAsso6_11_, articles0_.ArtiInfo as ArtiInfo11_, articles0_.ArtiFlag as ArtiFlag11_, articles0_.ArtiClassName as ArtiClas9_11_, articles0_.ArtiBrandName as ArtiBra10_11_, articles0_.ArtiPhotoPath as ArtiPho11_11_ from myweb.articles articles0_ 16:58:21,453 DEBUG ErrorCounter:68 - throwQueryException() : no errors

ssh配置error

tomcat启动时包了这样的错误 <br />ERROR [org.springframework.web.context.ContextLoader] - &lt;context initialization="" failed=""&gt; <br />org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml] <br />at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:349) <br />at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310) <br />at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143) <br />at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178) <br />at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149) <br />at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124) <br />at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92) <br />at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123) <br />at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423) <br />at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353) <br />at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) <br />at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) <br />at org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:81) <br />at javax.servlet.GenericServlet.init(GenericServlet.java:211) <br />at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1029) <br />at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:862) <br />at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4013) <br />at org.apache.catalina.core.StandardContext.start(StandardContext.java:4357) <br />at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823) <br />at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807) <br />at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595) <br />at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277) <br />at org.apache.catalina.core.StandardHost.install(StandardHost.java:832) <br />at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:701) <br />at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:432) <br />at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983) <br />at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349) <br />at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) <br />at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091) <br />at org.apache.catalina.core.StandardHost.start(StandardHost.java:789) <br />at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083) <br />at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478) <br />at org.apache.catalina.core.StandardService.start(StandardService.java:480) <br />at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313) <br />at org.apache.catalina.startup.Catalina.start(Catalina.java:556) <br />at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) <br />at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) <br />at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) <br />at java.lang.reflect.Method.invoke(Method.java:585) <br />at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287) <br />at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425) <br />Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml] <br />at org.springframework.web.context.support.ServletContextResource.getInputStream(ServletContextResource.java:116) <br />at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336) <br />... 40 more <br />2008-09-15 11:13:02,694 INFO [org.apache.struts.action.ActionServlet] - &lt;loading chain="" catalog="" from="" jar:file:="" c:="" program%20files="" apache%20software%20foundation="" tomcat%205.0="" webapps="" mzntdemo="" web-inf="" lib="" struts-core-1.3.8.jar!="" org="" apache="" struts="" chain="" chain-config.xml=""&gt; <br />2008-09-15 11:13:03,882 INFO [org.springframework.web.struts.ContextLoaderPlugIn] - &lt;contextloaderplugin for="" struts="" actionservlet="" 'action,="" module="" '':="" initialization="" started=""&gt; <br />2008-09-15 11:13:03,898 ERROR [org.springframework.web.struts.ContextLoaderPlugIn] - &lt;context initialization="" failed=""&gt; <br />org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml] <br />at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:349) <br />at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310) <br />at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143) <br />at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178) <br />at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149) <br />at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124) <br />at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92) <br />at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123) <br />at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423) <br />at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353) <br />at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) <br />at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) <br />at org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:81) <br />at javax.servlet.GenericServlet.init(GenericServlet.java:211) <br />at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1029) <br />at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:862) <br />at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4013) <br />at org.apache.catalina.core.StandardContext.start(StandardContext.java:4357) <br />at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823) <br />at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807) <br />at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595) <br />at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277) <br />at org.apache.catalina.core.StandardHost.install(StandardHost.java:832) <br />at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:701) <br />at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:432) <br />at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983) <br />at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349) <br />at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) <br />at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091) <br />at org.apache.catalina.core.StandardHost.start(StandardHost.java:789) <br />at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083) <br />at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478) <br />at org.apache.catalina.core.StandardService.start(StandardService.java:480) <br />at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313) <br />at org.apache.catalina.startup.Catalina.start(Catalina.java:556) <br />at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) <br />at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) <br />at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) <br />at java.lang.reflect.Method.invoke(Method.java:585) <br />at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287) <br />at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425) <br />Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml] <br />at org.springframework.web.context.support.ServletContextResource.getInputStream(ServletContextResource.java:116) <br />at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336) <br />... 40 more <br />我的applicationContext.xml是这样配置的 <br />&lt;bean id="dataSource" &lt;br=""&gt;class="org.springframework.jndi.JndiObjectFactoryBean"&gt; <br />&lt;property name="jndiName" value="java:comp/env/jdbc/mldn"&gt;&lt;/property&gt; <br />&lt;/bean&gt; <br />&lt;bean id="sessionFactory" &lt;br=""&gt;class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&gt; <br />&lt;property name="dataSource"&gt; <br />&lt;ref bean="dataSource"&gt; <br />&lt;/property&gt; <br />&lt;property name="hibernateProperties"&gt; <br />&lt;props&gt; <br />&lt;prop key="hibernate.dialect"&gt; <br />org.hibernate.dialect.MySQLDialect <br />&lt;/prop&gt; <br />&lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt; <br />&lt;prop key="hibernate.autocommit"&gt;true&lt;/prop&gt; <br />&lt;/props&gt; <br />&lt;/property&gt; <br />&lt;property name="mappingResources"&gt; <br />&lt;list&gt; <br />&lt;value&gt;com/db/mznt/vo/TUser.hbm.xml&lt;/value&gt; <br />&lt;/list&gt; <br />&lt;/property&gt; <br />&lt;/bean&gt; <br />&lt;bean id="hibernateTemplate" &lt;br=""&gt;class="org.springframework.orm.hibernate3.HibernateTemplate"&gt; <br />&lt;property name="sessionFactory"&gt; <br />&lt;ref bean="sessionFactory"&gt; <br />&lt;/property&gt; <br />&lt;/bean&gt; <br />&lt;bean id="t_userdao" class="com.db.mznt.dao.t_userDAO" &lt;br=""&gt;abstract="true"&gt; <br />&lt;/bean&gt; <br />&lt;bean id="t_userdaoimpl" class="com.db.mznt.daoimpl.t_userDAOImpl" &lt;br=""&gt;parent="t_userdao"&gt; <br />&lt;property name="hibernateTemplate"&gt; <br />&lt;ref bean="hibernateTemplate"&gt; <br />&lt;/property&gt; <br />&lt;/bean&gt; <br />&lt;bean name="/jsp/user" &lt;br=""&gt;class="com.db.mznt.struts.action.UserAction"&gt; <br />&lt;property name="t_userdao"&gt; <br />&lt;ref bean="t_userdaoimpl"&gt; <br />&lt;/property&gt; <br />&lt;/bean&gt; <br />&lt;/beans&gt;<br /><strong>问题补充:</strong><br />我在web.xml中是这样啊应该没错啊 <br />&lt;context-param&gt; <br /> &lt;param-name&gt;contxtConfigLocation&lt;/param-name&gt; <br /> &lt;param-value&gt; <br /> /WEB-INF/classes/applicationContext.xml <br /> &lt;/param-value&gt; <br /> &lt;/context-param&gt; <br /> &lt;servlet&gt; <br /> &lt;servlet-name&gt;context&lt;/servlet-name&gt; <br /> &lt;servlet-class&gt; <br /> org.springframework.web.context.ContextLoaderServlet <br /> &lt;/servlet-class&gt; <br /> &lt;load-on-startup&gt;1&lt;/load-on-startup&gt; <br /> &lt;/servlet&gt;<br /><strong>问题补充:</strong><br />做了和原来一样错误<br /><strong>问题补充:</strong><br />我是这样写的啊 <br />&lt;param-value&gt;/WEB-INF/classes/applicationContext.xml&lt;/param-value&gt;<br /><strong>问题补充:</strong><br />我是这样写的没错啊 <br />但不知道为什么报错时说我写的是/WEB-INF/applicationContext.xml <br />其实我一直是这样写的 <br />&lt;context-param&gt; <br /> &lt;param-name&gt;contxtConfigLocation&lt;/param-name&gt; <br /> &lt;param-value&gt; <br /> /WEB-INF/classes/applicationContext.xml <br /> &lt;/param-value&gt; <br /> &lt;/context-param&gt; <br /> &lt;servlet&gt; <br /> &lt;servlet-name&gt;context&lt;/servlet-name&gt; <br /> &lt;servlet-class&gt; <br /> org.springframework.web.context.ContextLoaderServlet <br /> &lt;/servlet-class&gt; <br /> &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;<br /><strong>问题补充:</strong><br />我是按你说的那样做的 <br />就是包的这个错误 <br />不知道是不是其他别的地方的错误<br /><strong>问题补充:</strong><br />按你说的做了 <br />结果是 <br />ERROR [org.springframework.web.context.ContextLoader] - &lt;context initialization="" failed=""&gt; <br />org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 5 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "bean", must match DOCTYPE root "beans". <br /> at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:404) <br /> at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342) <br /> at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310) <br /> at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143) <br /> at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178) <br /> at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149) <br /> at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124) <br /> at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92) <br /> at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123) <br /> at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423) <br /> at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353) <br /> at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) <br /> at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) <br /> at org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:81) <br /> at javax.servlet.GenericServlet.init(GenericServlet.java:211) <br /> at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1029) <br /> at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:862) <br /> at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4013) <br /> at org.apache.catalina.core.StandardContext.start(StandardContext.java:4357) <br /> at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823) <br /> at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807) <br /> at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595) <br /> at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277) <br /> at org.apache.catalina.core.StandardHost.install(StandardHost.java:832) <br /> at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:701) <br /> at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:432) <br /> at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983) <br /> at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349) <br /> at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) <br /> at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091) <br /> at org.apache.catalina.core.StandardHost.start(StandardHost.java:789) <br /> at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083) <br /> at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478) <br /> at org.apache.catalina.core.StandardService.start(StandardService.java:480) <br /> at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313) <br /> at org.apache.catalina.startup.Catalina.start(Catalina.java:556) <br /> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) <br /> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) <br /> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) <br /> at java.lang.reflect.Method.invoke(Method.java:585) <br /> at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287) <br /> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425) <br />Caused by: org.xml.sax.SAXParseException: Document root element "bean", must match DOCTYPE root "beans". <br /> at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) <br /> at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) <br /> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) <br /> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) <br /> at org.apache.xerces.impl.dtd.XMLDTDValidator.rootElementSpecified(Unknown Source) <br /> at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source) <br /> at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source) <br /> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source) <br /> at org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(Unknown Source) <br /> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) <br /> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) <br /> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) <br /> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) <br /> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) <br /> at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) <br /> at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) <br /> at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75) <br /> at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396) <br /> ... 41 more <br />2008-09-15 16:19:03,468 INFO [org.apache.struts.action.ActionServlet] - &lt;loading chain="" catalog="" from="" jar:file:="" c:="" program%20files="" apache%20software%20foundation="" tomcat%205.0="" webapps="" mzntdemo="" web-inf="" lib="" struts-core-1.3.8.jar!="" org="" apache="" struts="" chain="" chain-config.xml=""&gt; <br />2008-09-15 16:19:04,625 INFO [org.springframework.web.struts.ContextLoaderPlugIn] - &lt;contextloaderplugin for="" struts="" actionservlet="" 'action,="" module="" '':="" initialization="" started=""&gt; <br />2008-09-15 16:19:04,640 ERROR [org.springframework.web.struts.ContextLoaderPlugIn] - &lt;context initialization="" failed=""&gt; <br />org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 5 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "bean", must match DOCTYPE root "beans". <br /> at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:404) <br /> at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342) <br /> at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310) <br /> at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143) <br /> at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178) <br /> at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149) <br /> at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124) <br /> at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92) <br /> at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123) <br /> at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423) <br /> at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353) <br /> at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) <br /> at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) <br /> at org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:81) <br /> at javax.servlet.GenericServlet.init(GenericServlet.java:211) <br /> at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1029) <br /> at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:862) <br /> at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4013) <br /> at org.apache.catalina.core.StandardContext.start(StandardContext.java:4357) <br /> at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823) <br /> at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807) <br /> at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595) <br /> at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277) <br /> at org.apache.catalina.core.StandardHost.install(StandardHost.java:832) <br /> at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:701) <br /> at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:432) <br /> at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983) <br /> at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349) <br /> at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) <br /> at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091) <br /> at org.apache.catalina.core.StandardHost.start(StandardHost.java:789) <br /> at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083) <br /> at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478) <br /> at org.apache.catalina.core.StandardService.start(StandardService.java:480) <br /> at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313) <br /> at org.apache.catalina.startup.Catalina.start(Catalina.java:556) <br /> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) <br /> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) <br /> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) <br /> at java.lang.reflect.Method.invoke(Method.java:585) <br /> at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287) <br /> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425) <br />Caused by: org.xml.sax.SAXParseException: Document root element "bean", must match DOCTYPE root "beans". <br /> at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) <br /> at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) <br /> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) <br /> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) <br /> at org.apache.xerces.impl.dtd.XMLDTDValidator.rootElementSpecified(Unknown Source) <br /> at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source) <br /> at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source) <br /> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source) <br /> at org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(Unknown Source) <br /> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) <br /> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) <br /> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) <br /> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) <br /> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) <br /> at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) <br /> at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) <br /> at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75) <br /> at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396) <br /> ... 41 more <br />2008-09-15 16:19:04,656 WARN [org.apache.struts.util.PropertyMessageResources] - &lt; Resource org/apache/struts/action/ActionResources_zh_CN.properties Not Found.&gt; <br />2008-09-15 16:19:04,656 WARN [org.apache.struts.util.PropertyMessageResources] - &lt; Resource org/apache/struts/action/ActionResources_zh.properties Not Found.&gt; <br />2008-9-15 16:19:04 org.apache.catalina.core.StandardHostDeployer install<br /><strong>问题补充:</strong><br />全部是meeclipse自动运行配置的我只补充了部分内容<br /><strong>问题补充:</strong><br />我配置了问题任然存在<br /><strong>问题补充:</strong><br />刚才这个beans的问题是我刚才该了东西该错了<br /><strong>问题补充:</strong><br />这是现在的错误 <br />ERROR [org.springframework.web.context.ContextLoader] - &lt;context initialization="" failed=""&gt; <br />org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml] <br /> at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:349) <br /> at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310) <br /> at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143) <br /> at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178) <br /> at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149) <br /> at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124) <br /> at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92) <br /> at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123) <br /> at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423) <br /> at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353) <br /> at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) <br /> at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) <br /> at org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:81) <br /> at javax.servlet.GenericServlet.init(GenericServlet.java:211) <br /> at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1029) <br /> at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:862) <br /> at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4013) <br /> at org.apache.catalina.core.StandardContext.start(StandardContext.java:4357) <br /> at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823) <br /> at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807) <br /> at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595) <br /> at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277) <br /> at org.apache.catalina.core.StandardHost.install(StandardHost.java:832) <br /> at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:701) <br /> at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:432) <br /> at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983) <br /> at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349) <br /> at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) <br /> at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091) <br /> at org.apache.catalina.core.StandardHost.start(StandardHost.java:789) <br /> at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083) <br /> at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478) <br /> at org.apache.catalina.core.StandardService.start(StandardService.java:480) <br /> at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313) <br /> at org.apache.catalina.startup.Catalina.start(Catalina.java:556) <br /> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) <br /> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) <br /> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) <br /> at java.lang.reflect.Method.invoke(Method.java:585) <br /> at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287) <br /> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425) <br />Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml] <br /> at org.springframework.web.context.support.ServletContextResource.getInputStream(ServletContextResource.java:116) <br /> at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336) <br /> ... 40 more <br />2008-09-15 16:43:26,453 INFO [org.apache.struts.action.ActionServlet] - &lt;loading chain="" catalog="" from="" jar:file:="" c:="" program%20files="" apache%20software%20foundation="" tomcat%205.0="" webapps="" mzntdemo="" web-inf="" lib="" struts-core-1.3.8.jar!="" org="" apache="" struts="" chain="" chain-config.xml=""&gt; <br />2008-09-15 16:43:27,921 INFO [org.springframework.web.struts.ContextLoaderPlugIn] - &lt;contextloaderplugin for="" struts="" actionservlet="" 'action,="" module="" '':="" initialization="" started=""&gt; <br />2008-09-15 16:43:27,937 ERROR [org.springframework.web.struts.ContextLoaderPlugIn] - &lt;context initialization="" failed=""&gt; <br />org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml] <br /> at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:349) <br /> at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310) <br /> at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143) <br /> at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178) <br /> at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149) <br /> at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124) <br /> at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92) <br /> at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123) <br /> at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423) <br /> at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353) <br /> at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) <br /> at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) <br /> at org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:81) <br /> at javax.servlet.GenericServlet.init(GenericServlet.java:211) <br /> at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1029) <br /> at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:862) <br /> at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4013) <br /> at org.apache.catalina.core.StandardContext.start(StandardContext.java:4357) <br /> at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823) <br /> at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807) <br /> at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595) <br /> at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277) <br /> at org.apache.catalina.core.StandardHost.install(StandardHost.java:832) <br /> at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:701) <br /> at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:432) <br /> at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983) <br /> at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349) <br /> at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) <br /> at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091) <br /> at org.apache.catalina.core.StandardHost.start(StandardHost.java:789) <br /> at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083) <br /> at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478) <br /> at org.apache.catalina.core.StandardService.start(StandardService.java:480) <br /> at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313) <br /> at org.apache.catalina.startup.Catalina.start(Catalina.java:556) <br /> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) <br /> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) <br /> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) <br /> at java.lang.reflect.Method.invoke(Method.java:585) <br /> at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287) <br /> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425) <br />Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml] <br /> at org.springframework.web.context.support.ServletContextResource.getInputStream(ServletContextResource.java:116) <br /> at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336) <br /> ... 40 more <br />2008-09-15 16:43:27,937 WARN [org.apache.struts.util.PropertyMessageResources] - &lt; Resource org/apache/struts/action/ActionResources_zh_CN.properties Not Found.&gt; <br />2008-09-15 16:43:27,937 WARN [org.apache.struts.util.PropertyMessageResources] - &lt; Resource org/apache/struts/action/ActionResources_zh.properties Not Found.&gt; <br />2008-9-15 16:43:27 org.apache.catalina.core.StandardHostDeployer install<br /><strong>问题补充:</strong><br />这是我的web.xml <br /> <br />&lt;web-app xmlns="http://java.sun.com/xml/ns/j2ee" &lt;br=""&gt; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" <br /> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"&gt; <br /> &lt;filter&gt; <br /> &lt;filter-name&gt;encoding&lt;/filter-name&gt; <br /> &lt;filter-class&gt;com.db.mznt.filter.EncodingFilter&lt;/filter-class&gt; <br /> &lt;init-param&gt; <br /> &lt;param-name&gt;charset&lt;/param-name&gt; <br /> &lt;param-value&gt;utf-8&lt;/param-value&gt; <br /> &lt;/init-param&gt; <br /> &lt;/filter&gt; <br /> &lt;filter-mapping&gt; <br /> &lt;filter-name&gt;encoding&lt;/filter-name&gt; <br /> &lt;url-pattern&gt;/*&lt;/url-pattern&gt; <br /> &lt;/filter-mapping&gt; <br /> &lt;context-param&gt; <br /> &lt;param-name&gt;contxtConfigLocation&lt;/param-name&gt; <br /> &lt;param-value&gt; <br /> /WEB-INF/classes/applicationContext.xml <br /> &lt;/param-value&gt; <br /> &lt;/context-param&gt; <br /> &lt;context-param&gt; <br /> &lt;param-name&gt;log4jConfigLocation&lt;/param-name&gt; <br /> &lt;param-value&gt;/WEB-INF/classes/log4j.properties&lt;/param-value&gt; <br /> &lt;/context-param&gt; <br /> &lt;servlet&gt; <br /> &lt;servlet-name&gt;context&lt;/servlet-name&gt; <br /> &lt;servlet-class&gt; <br /> org.springframework.web.context.ContextLoaderServlet <br /> &lt;/servlet-class&gt; <br /> &lt;load-on-startup&gt;1&lt;/load-on-startup&gt; <br /> &lt;/servlet&gt; <br /> &lt;servlet&gt; <br /> &lt;servlet-name&gt;action&lt;/servlet-name&gt; <br /> &lt;servlet-class&gt; <br /> org.apache.struts.action.ActionServlet <br /> &lt;/servlet-class&gt; <br /> &lt;init-param&gt; <br /> &lt;param-name&gt;config&lt;/param-name&gt; <br /> &lt;param-value&gt;/WEB-INF/struts-config.xml&lt;/param-value&gt; <br /> &lt;/init-param&gt; <br /> &lt;init-param&gt; <br /> &lt;param-name&gt;debug&lt;/param-name&gt; <br /> &lt;param-value&gt;3&lt;/param-value&gt; <br /> &lt;/init-param&gt; <br /> &lt;init-param&gt; <br /> &lt;param-name&gt;detail&lt;/param-name&gt; <br /> &lt;param-value&gt;3&lt;/param-value&gt; <br /> &lt;/init-param&gt; <br /> &lt;load-on-startup&gt;0&lt;/load-on-startup&gt; <br /> &lt;/servlet&gt; <br /> &lt;servlet-mapping&gt; <br /> &lt;servlet-name&gt;action&lt;/servlet-name&gt; <br /> &lt;url-pattern&gt;*.do&lt;/url-pattern&gt; <br /> &lt;/servlet-mapping&gt; <br /> &lt;welcome-file-list&gt; <br /> &lt;welcome-file&gt;jsp/register.jsp&lt;/welcome-file&gt; <br /> &lt;/welcome-file-list&gt; <br />&lt;/web-app&gt; <br /> <br /><br /><strong>问题补充:</strong><br />这是我的applicationContext.xml <br /> <br />&lt;beans xmlns="http://www.springframework.org/schema/beans" &lt;br=""&gt; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <br /> xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"&gt; <br /> <br /> <br /> &lt;bean id="dataSource" &lt;br=""&gt; class="org.springframework.jndi.JndiObjectFactoryBean"&gt; <br /> &lt;property name="jndiName" value="java:comp/env/jdbc/mldn"&gt;&lt;/property&gt; <br /> &lt;/bean&gt; <br /> &lt;bean id="sessionFactory" &lt;br=""&gt; class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&gt; <br /> &lt;property name="dataSource"&gt; <br /> &lt;ref bean="dataSource"&gt; <br /> &lt;/property&gt; <br /> &lt;property name="hibernateProperties"&gt; <br /> &lt;props&gt; <br /> &lt;prop key="hibernate.dialect"&gt; <br /> org.hibernate.dialect.MySQLDialect <br /> &lt;/prop&gt; <br /> &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt; <br /> &lt;prop key="hibernate.connection.autocommit"&gt;true&lt;/prop&gt; <br /> &lt;/props&gt; <br /> &lt;/property&gt; <br /> &lt;property name="mappingResources"&gt; <br /> &lt;list&gt; <br /> &lt;value&gt;com/db/mznt/vo/TUser.hbm.xml&lt;/value&gt; <br /> &lt;/list&gt; <br /> &lt;/property&gt; <br /> &lt;/bean&gt; <br /> &lt;bean id="hibernateTemplate" &lt;br=""&gt; class="org.springframework.orm.hibernate3.HibernateTemplate"&gt; <br /> &lt;property name="sessionFactory"&gt; <br /> &lt;ref bean="sessionFactory"&gt; <br /> &lt;/property&gt; <br /> &lt;/bean&gt; <br /> &lt;bean id="t_userdao" class="com.db.mznt.dao.t_userDAO" &lt;br=""&gt; abstract="true"&gt; <br /> &lt;/bean&gt; <br /> &lt;bean id="t_userdaoimpl" class="com.db.mznt.daoimpl.t_userDAOImpl" &lt;br=""&gt; parent="t_userdao"&gt; <br /> &lt;property name="hibernateTemplate"&gt; <br /> &lt;ref bean="hibernateTemplate"&gt; <br /> &lt;/property&gt; <br /> &lt;/bean&gt; <br /> &lt;bean name="/jsp/user" &lt;br=""&gt; class="com.db.mznt.struts.action.UserAction"&gt; <br /> &lt;property name="t_userdao"&gt; <br /> &lt;ref bean="t_userdaoimpl"&gt; <br /> &lt;/property&gt; <br /> &lt;/bean&gt; <br />&lt;/beans&gt;<br /><strong>问题补充:</strong><br />这是我的struts-config.xml <br /> <br /> <br /> <br />&lt;struts-config&gt; <br /> &lt;form-beans&gt; <br /> &lt;form-bean name="userForm" &lt;br=""&gt; type="com.db.mznt.struts.form.UserForm" /&gt; <br /> <br /> &lt;/form-beans&gt; <br /> <br /> &lt;global-exceptions&gt; <br /> &lt;global-forwards&gt; <br /> &lt;action-mappings&gt; <br /> &lt;action attribute="userForm" input="/jsp/errors.jsp" &lt;br=""&gt; name="userForm" parameter="status" path="/jsp/user" scope="request" <br /> type="com.db.mznt.struts.action.UserAction"&gt; <br /> &lt;forward name="registersuccess" &lt;br=""&gt; path="/jsp/registerSuccess.jsp"&gt; <br /> &lt;/forward&gt; <br /> &lt;forward name="registerfalure" path="/jsp/register.jsp"&gt;&lt;/forward&gt; <br /> &lt;/action&gt; <br /> <br /> &lt;/action-mappings&gt; <br /> <br /> &lt;controller &lt;br=""&gt; processorClass="org.springframework.web.struts.DelegatingRequestProcessor"&gt; <br /> &lt;/controller&gt; <br /> &lt;message-resources &lt;br=""&gt; parameter="com.db.mznt.struts.ApplicationResources" /&gt; <br /> &lt;plug-in &lt;br=""&gt; className="org.springframework.web.struts.ContextLoaderPlugIn"&gt; <br /> &lt;set-property property="contxtConfigLocation" &lt;br=""&gt; value="/WEB-INF/classes/applicationContext.xml" /&gt; <br /> &lt;/plug-in&gt; <br /> <br />&lt;/struts-config&gt; <br /> <br /><br /><strong>问题补充:</strong><br />改了还是包那个错<br /><strong>问题补充:</strong><br />都该了<br /><strong>问题补充:</strong><br />先在错误编程了 <br />ERROR [org.springframework.web.context.ContextLoader] - &lt;context initialization="" failed=""&gt; <br />org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name jdbc is not bound in this Context <br /> at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1336)<br /><strong>问题补充:</strong><br />我这样写的好像还是有点问题 <br /> <br />&lt;context path="/mldn"&gt; <br /> &lt;resource name="java:comp/env/jdbc/mldn" type="javax.sql.DataSource" &lt;br=""&gt; username="root" password="ads" driverClassName="com.mysql.jdbc.Driver" <br /> url="jdbc:mysql://localhost:3306/mldn" maxActive="4" maxIdle="2" /&gt; <br />&lt;/context&gt; <br /><br /><strong>问题补充:</strong><br />改后怎么还是包这个错 <br />ERROR [org.springframework.web.context.ContextLoader] - &lt;context initialization="" failed=""&gt; <br />org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name jdbc is not bound in this Context<br /><strong>问题补充:</strong><br />applicationContext.xml中我用的是 <br />&lt;bean id="dataSource" &lt;br=""&gt; class="org.springframework.jndi.JndiObjectFactoryBean"&gt; <br /> &lt;property name="jndiName" value="java:comp/env/jdbc/mldn"&gt;&lt;/property&gt; <br /> &lt;/bean&gt;<br /><strong>问题补充:</strong><br />现在的问题是 <br />ERROR [org.hibernate.util.JDBCExceptionReporter] - &lt;cannot create="" jdbc="" driver="" of="" class="" ''="" for="" connect="" url="" 'null'=""&gt; <br />2008-09-15 20:37:40,015 WARN [org.hibernate.cfg.SettingsFactory] - &lt;could not="" obtain="" connection="" metadata=""&gt; <br />org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'<br /><strong>问题补充:</strong><br />这个问题一直没解决了 <br />ERROR [org.hibernate.util.JDBCExceptionReporter] - &lt;cannot create="" jdbc="" driver="" of="" class="" ''="" for="" connect="" url="" 'null'=""&gt; <br />2008-09-15 21:56:56,687 WARN [org.hibernate.cfg.SettingsFactory] - &lt;could not="" obtain="" connection="" metadata=""&gt; <br />org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'<br /><strong>问题补充:</strong><br />放进去了的,任然报这个错误。都快郁闷死了<br /><strong>问题补充:</strong><br />好的,谢谢你 <br />sxwave@163.com<br /><strong>问题补充:</strong><br />昨天的问题出在我tomcat中没有配置,但配置好后现在出现了个新问题。问题是 <br />ERROR [org.springframework.web.context.ContextLoader] - &lt;context initialization="" failed=""&gt; <br />org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V

一条HQL语句引起的异常

表结构: CREATE TABLE IF NOT EXISTS tb_cases( id int(11) NOT NULL auto_increment, cdate date default NULL, title varchar(50) default NULL, cont text, imgpath varchar(80) default NULL, apply text, PRIMARY KEY (id) )ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; Hibernate映射文件: <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name="com.base.hibernate.po.Cases" table="tb_cases"> <id name="id" type="java.lang.Integer"> <column name="id" /> <generator class="native" /> </id> <property name="cdate" type="java.util.Date"> <column name="cdate" length="10" /> </property> <property name="title" type="java.lang.String"> <column name="title" length="50" /> </property> <property name="content" type="java.lang.String"> <column name="cont" /> </property> <property name="imgpath" type="java.lang.String"> <column name="imgpath" length="50" /> </property> <property name="apply" type="java.lang.String"> <column name="apply" /> </property> </class> </hibernate-mapping> HQL语句: String FIND_CASENUM = " from Cases order by cdate desc "; 实现方法: public List<Cases> getCasesNum(final int showPage, final int pageSize){ return getHibernateTemplate().executeFind(new HibernateCallback() { public Object doInHibernate(final Session session) { Query query = session.createQuery(FIND_CASENUM); query.setFirstResult((showPage - 1) * pageSize); query.setMaxResults(pageSize); List<Cases> casesList = query.list(); if(null == casesList || casesList.isEmpty()){ casesList = null; } return casesList; } }); } 抛出异常: Hibernate: select top 4 cases0_.id as id1_, cases0_.cdate as cdate1_, cases0_.title as title1_, cases0_.cont as cont1_, cases0_.imgpath as imgpath1_, cases0_.apply as apply1_ from tb_cases cases0_ order by cases0_.cdate desc 2009-07-08 13:06:22,281 [org.hibernate.util.JDBCExceptionReporter]-[WARN] SQL Error: 1064, SQLState: 42000 2009-07-08 13:06:22,281 [org.hibernate.util.JDBCExceptionReporter]-[ERROR] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '4 cases0_.id as id1_, cases0_.cdate as cdate1_, cases0_.title as title1_, cases0' at line 1 2009-07-08 13:06:26,812 [org.apache.struts.action.RequestProcessor]-[WARN] Unhandled Exception thrown: class org.springframework.dao.InvalidDataAccessResourceUsageException 2009-07-08 13:06:26,812 [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/bianyaqi].[action]]-[ERROR] Servlet.service() for servlet action threw exception org.hibernate.exception.SQLGrammarException: could not execute query at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.loader.Loader.doList(Loader.java:2223) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104) at org.hibernate.loader.Loader.list(Loader.java:2099) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338) at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79) at com.base.hibernate.dao.impl.CasesDaoImpl$1.doInHibernate(CasesDaoImpl.java:65) at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372) at org.springframework.orm.hibernate3.HibernateTemplate.executeFind(HibernateTemplate.java:342) at com.base.hibernate.dao.impl.CasesDaoImpl.getCasesNum(CasesDaoImpl.java:60) at com.base.spring.service.impl.CasesServiceImpl.getCasesNum(CasesServiceImpl.java:66) 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:304) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:139) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy1.getCasesNum(Unknown Source) at com.base.struts.action.IndexAction.execute(IndexAction.java:130) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at com.base.common.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:123) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at com.base.common.filter.ForceNoCacheFilter.doFilter(ForceNoCacheFilter.java:36) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:619) Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '4 cases0_.id as id1_, cases0_.cdate as cdate1_, cases0_.title as title1_, cases0' at line 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.Util.getInstance(Util.java:381) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1734) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1885) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186) at org.hibernate.loader.Loader.getResultSet(Loader.java:1787) at org.hibernate.loader.Loader.doQuery(Loader.java:674) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236) at org.hibernate.loader.Loader.doList(Loader.java:2220) ... 54 more 怀疑是HQL语句有什么错误,但愣是没找出来 映射文件与表中的字段名也检查过了,没什么问题啊! 查看了好久也没找出到底什么地方的错误 还请各们朋友们帮下忙看下到底怎么回事! 补充: 如果将HQL语句改成 from Product 问题依旧 但在Mysql数据库中使用 select id,cdate,title,cont,imgpath,apply from tb_cases; 语句没有任何错误!

ssh整合时tomcat部署出现问题高手请进

<p>2010-9-8 0:20:42 org.apache.catalina.core.AprLifecycleListener init <br>信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Program Files\Java\jdk1.6.0_10\bin;D:\apache-tomcat-6.0.24\apache-tomcat-6.0.24\bin <br>2010-9-8 0:20:42 org.apache.coyote.http11.Http11Protocol init <br>信息: Initializing Coyote HTTP/1.1 on http-8080 <br>2010-9-8 0:20:42 org.apache.catalina.startup.Catalina load <br>信息: Initialization processed in 639 ms <br>2010-9-8 0:20:42 org.apache.catalina.core.StandardService start <br>信息: Starting service Catalina <br>2010-9-8 0:20:42 org.apache.catalina.core.StandardEngine start <br>信息: Starting Servlet Engine: Apache Tomcat/6.0.24 <br>2010-9-8 0:20:42 org.apache.catalina.startup.HostConfig deployDirectory <br>信息: Deploying web application directory epet <br>log4j:WARN No appenders could be found for logger (org.apache.struts.util.PropertyMessageResources). <br>log4j:WARN Please initialize the log4j system properly. <br>2010-9-8 0:20:45 org.apache.catalina.core.ApplicationContext log <br>信息:<span style="color: #ff0000;"> Initializing WebApplicationContext for Struts ActionServlet 'action', module</span> '' <br>2010-9-8 0:20:54 org.apache.catalina.core.ApplicationContext log <br>严重: <span style="color: #ff0000;">action: null <br></span><span style="color: #ff0000;">org.springframework.beans.factory.BeanCreationException: Error creating bean with name '/petDiary' defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: <br>PropertyAccessException 1: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [epet.biz.impl.PetInfoBizImpl] to required type [epet.biz.PetDiaryBiz] for property 'biz'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [epet.biz.impl.PetInfoBizImpl] to required type [epet.biz.PetDiaryBiz] for property 'biz': no matching editors or conversion strategy found <br>Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessException details (1) are: <br>PropertyAccessException 1: <br>org.springframework.beans.TypeMismatchException: Failed to convert property value of type [epet.biz.impl.PetInfoBizImpl] to required type [epet.biz.PetDiaryBiz] for property 'biz'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [epet.biz.impl.PetInfoBizImpl] to required type [epet.biz.PetDiaryBiz] for property 'biz': no matching editors or conversion strategy found <br>Caused by: java.lang.IllegalArgumentException: Cannot convert value of type [epet.biz.impl.PetInfoBizImpl] to required type [epet.biz.PetDiaryBiz] for property 'biz': no matching editors or conversion strategy found <br></span>at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231) <br>at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138) <br>at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:815) <br>at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:645) <br>at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:78) <br>at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:59) <br>at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1127) <br>at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:862) <br>at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:424) <br>at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251) <br>at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156) <br>at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248) <br>at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160) <br>at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287) <br>at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352) <br>at org.springframework.web.struts.ContextLoaderPlugIn.createWebApplicationContext(ContextLoaderPlugIn.java:355) <br>at org.springframework.web.struts.ContextLoaderPlugIn.initWebApplicationContext(ContextLoaderPlugIn.java:296) <br>at org.springframework.web.struts.ContextLoaderPlugIn.init(ContextLoaderPlugIn.java:225) <br>at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:1158) <br>at org.apache.struts.action.ActionServlet.init(ActionServlet.java:473) <br>at javax.servlet.GenericServlet.init(GenericServlet.java:212) <br>at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173) <br>at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993) <br>at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4187) <br>at org.apache.catalina.core.StandardContext.start(StandardContext.java:4496) <br>at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) <br>at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) <br>at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526) <br>at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041) <br>at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964) <br>at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502) <br>at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277) <br>at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321) <br>at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) <br>at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) <br>at org.apache.catalina.core.StandardHost.start(StandardHost.java:722) <br>at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) <br>at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) <br>at org.apache.catalina.core.StandardService.start(StandardService.java:516) <br>at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) <br>at org.apache.catalina.startup.Catalina.start(Catalina.java:593) <br>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) <br>at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) <br>at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) <br>at java.lang.reflect.Method.invoke(Method.java:597) <br>at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) <br>at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) <br>2010-9-8 0:20:54 org.apache.catalina.core.ApplicationContext log <br>信息: Marking servlet action as unavailable <br>2010-9-8 0:20:54 org.apache.catalina.core.StandardContext loadOnStartup <br>严重: Servlet /epet threw load() exception <br>javax.servlet.UnavailableException <br>at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:1169) <br>at org.apache.struts.action.ActionServlet.init(ActionServlet.java:473) <br>at javax.servlet.GenericServlet.init(GenericServlet.java:212) <br>at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173) <br>at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993) <br>at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4187) <br>at org.apache.catalina.core.StandardContext.start(StandardContext.java:4496) <br>at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) <br>at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) <br>at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526) <br>at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041) <br>at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964) <br>at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502) <br>at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277) <br>at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321) <br>at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) <br>at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) <br>at org.apache.catalina.core.StandardHost.start(StandardHost.java:722) <br>at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) <br>at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) <br>at org.apache.catalina.core.StandardService.start(StandardService.java:516) <br>at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) <br>at org.apache.catalina.startup.Catalina.start(Catalina.java:593) <br>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) <br>at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) <br>at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) <br>at java.lang.reflect.Method.invoke(Method.java:597) <br>at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) <br>at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) <br>2010-9-8 0:20:54 org.apache.catalina.startup.HostConfig deployDirectory <br>信息: Deploying web application directory epet.myeclipse.bak <br>log4j:WARN No appenders could be found for logger (org.apache.struts.util.PropertyMessageResources). <br>log4j:WARN Please initialize the log4j system properly. <br>2010-9-8 0:20:56 org.apache.catalina.startup.HostConfig deployDirectory <br>信息: Deploying web application directory hourse <br>log4j:WARN No appenders could be found for logger (org.apache.struts.util.PropertyMessageResources). <br>log4j:WARN Please initialize the log4j system properly. <br>2010-9-8 0:20:59 org.apache.coyote.http11.Http11Protocol start <br>信息: Starting Coyote HTTP/1.1 on http-8080 <br>2010-9-8 0:20:59 org.apache.jk.common.ChannelSocket init <br>信息: JK: ajp13 listening on /0.0.0.0:8009 <br>2010-9-8 0:20:59 org.apache.jk.server.JkMain start <br>信息: Jk running ID=0 time=0/47  config=null <br>2010-9-8 0:20:59 org.apache.catalina.startup.Catalina start <br>信息: Server startup in 17017 ms</p> <p> </p> <p> </p> <p> </p> <p>下面是我的applicationContext.xml文件内容</p> <p>&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br>&lt;beans<br> xmlns="<a href="http://www.springframework.org/schema/beans">http://www.springframework.org/schema/beans</a>"<br> xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>"<br> xmlns:aop="<a href="http://www.springframework.org/schema/aop">http://www.springframework.org/schema/aop</a>"<br> xmlns:tx="<a href="http://www.springframework.org/schema/tx">http://www.springframework.org/schema/tx</a>"<br> xsi:schemaLocation="<a href="http://www.springframework.org/schema/beans">http://www.springframework.org/schema/beans</a> <a href="http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">http://www.springframework.org/schema/beans/spring-beans-2.0.xsd</a><br> <a href="http://www.springframework.org/schema/tx">http://www.springframework.org/schema/tx</a><br> <a href="http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">http://www.springframework.org/schema/tx/spring-tx-2.0.xsd</a><br> <a href="http://www.springframework.org/schema/aop">http://www.springframework.org/schema/aop</a><br> <a href="http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">http://www.springframework.org/schema/aop/spring-aop-2.0.xsd</a>"&gt;<br> &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"&gt;<br>  &lt;property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/&gt;<br>  &lt;property name="url" value="jdbc:sqlserver://localhost:1433;DataBaseName=epet;SelectMethod=cursor"&gt;&lt;/property&gt;<br>  &lt;property name="username" value="sa"&gt;&lt;/property&gt;<br>  &lt;property name="password" value="123456"&gt;&lt;/property&gt;<br> &lt;/bean&gt;<br> <br> &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&gt;<br>  &lt;property name="dataSource"&gt;<br>   &lt;ref local="dataSource"/&gt;<br>  &lt;/property&gt;<br>  &lt;property name="mappingResources"&gt;<br>   &lt;list&gt;<br>   &lt;value&gt;epet/entity/PetInfo.hbm.xml&lt;/value&gt;<br>   &lt;value&gt;epet/entity/PetDiary.hbm.xml&lt;/value&gt;<br>   &lt;/list&gt;<br>  &lt;/property&gt;<br>  &lt;property name="hibernateProperties"&gt;<br>   &lt;props&gt;<br>    &lt;prop key="hibernate.dialect"&gt;<br>     org.hibernate.dialect.SQLServerDialect<br>    &lt;/prop&gt;<br>    &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;<br>   &lt;/props&gt;<br>  &lt;/property&gt;<br> &lt;/bean&gt;<br> <br> &lt;bean id="petInfoDAO" class="epet.dao.hibimpl.PetInfoDAOHiblImpl"&gt;<br>  &lt;property name="sessionFactory" ref="sessionFactory"&gt;&lt;/property&gt;<br> &lt;/bean&gt;<br> &lt;bean id="petDiaryDAO" class="epet.dao.hibimpl.PetDiaryDAOHibImpl"&gt;<br>  &lt;property name="sessionFactory" ref="sessionFactory"&gt;&lt;/property&gt;<br> &lt;/bean&gt;<br> <br> &lt;bean id="petInfoBiz" class="epet.biz.impl.PetInfoBizImpl"&gt;<br>  &lt;property name="biz" ref="petInfoDAO"&gt;&lt;/property&gt;<br> &lt;/bean&gt;<br> &lt;bean id="petDiaryBiz" class="epet.biz.impl.PetDiaryBIzImpl"&gt;<br>  &lt;property name="biz" ref="petDiaryDAO"&gt;&lt;/property&gt;<br> &lt;/bean&gt;<br> <br> &lt;bean name="/pet" class="epet.web.action.PetAction"&gt;<br>  &lt;property name="biz" ref="petInfoBiz"&gt;&lt;/property&gt;<br> &lt;/bean&gt;<br> &lt;bean name="/petDiary" class="epet.web.action.PetDiaryAction"&gt;<br>  &lt;property name="biz" ref="petInfoBiz"&gt;&lt;/property&gt;<br> &lt;/bean&gt;<br> <br> &lt;bean id="myHibTxManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt;<br>  &lt;property name="sessionFactory" ref="sessionFactory"&gt;&lt;/property&gt;<br> &lt;/bean&gt;<br> &lt;tx:advice id="txAdvice" transaction-manager="myHibTxManager"&gt;<br>  &lt;tx:attributes&gt;<br>   &lt;tx:method name="get*" propagation="SUPPORTS" read-only="true"/&gt;<br>   &lt;tx:method name="load*" propagation="SUPPORTS" read-only="true"/&gt;<br>   &lt;tx:method name="search*" propagation="SUPPORTS" read-only="true"/&gt;<br>   &lt;tx:method name="to*" propagation="SUPPORTS" read-only="true"/&gt;<br>   &lt;tx:method name="do*" propagation="REQUIRED"/&gt;<br>   &lt;tx:method name="*" propagation="REQUIRED"/&gt;<br>  &lt;/tx:attributes&gt;<br> &lt;/tx:advice&gt;<br> &lt;aop:config&gt;<br>  &lt;aop:pointcut id="bizMethod" expression="execution(* epet.*.*(..))"/&gt;<br>  &lt;aop:advisor advice-ref="txAdvice" pointcut-ref="bizMethod"/&gt;<br> &lt;/aop:config&gt;<br>&lt;/beans&gt;</p> <p> </p>

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

我以为我学懂了数据结构,直到看了这个导图才发现,我错了

数据结构与算法思维导图

String s = new String(" a ") 到底产生几个对象?

老生常谈的一个梗,到2020了还在争论,你们一天天的,哎哎哎,我不是针对你一个,我是说在座的各位都是人才! 上图红色的这3个箭头,对于通过new产生一个字符串(”宜春”)时,会先去常量池中查找是否已经有了”宜春”对象,如果没有则在常量池中创建一个此字符串对象,然后堆中再创建一个常量池中此”宜春”对象的拷贝对象。 也就是说准确答案是产生了一个或两个对象,如果常量池中原来没有 ”宜春” ,就是两个。...

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

Linux面试题(2020最新版)

文章目录Linux 概述什么是LinuxUnix和Linux有什么区别?什么是 Linux 内核?Linux的基本组件是什么?Linux 的体系结构BASH和DOS之间的基本区别是什么?Linux 开机启动过程?Linux系统缺省的运行级别?Linux 使用的进程间通信方式?Linux 有哪些系统日志文件?Linux系统安装多个桌面环境有帮助吗?什么是交换空间?什么是root帐户什么是LILO?什...

将一个接口响应时间从2s优化到 200ms以内的一个案例

一、背景 在开发联调阶段发现一个接口的响应时间特别长,经常超时,囧… 本文讲讲是如何定位到性能瓶颈以及修改的思路,将该接口从 2 s 左右优化到 200ms 以内 。 二、步骤 2.1 定位 定位性能瓶颈有两个思路,一个是通过工具去监控,一个是通过经验去猜想。 2.1.1 工具监控 就工具而言,推荐使用 arthas ,用到的是 trace 命令 具体安装步骤很简单,大家自行研究。 我的使用步骤是...

学历低,无法胜任工作,大佬告诉你应该怎么做

微信上收到一位读者小涛的留言,大致的意思是自己只有高中学历,经过培训后找到了一份工作,但很难胜任,考虑要不要辞职找一份他能力可以胜任的实习工作。下面是他留言的一部分内容: 二哥,我是 2016 年高中毕业的,考上了大学但没去成,主要是因为当时家里经济条件不太允许。 打工了三年后想学一门技术,就去培训了。培训的学校比较垃圾,现在非常后悔没去正规一点的机构培训。 去年 11 月份来北京找到了一份工...

JVM内存结构和Java内存模型别再傻傻分不清了

讲一讲什么是Java内存模型 Java内存模型虽说是一个老生常谈的问题 ,也是大厂面试中绕不过的,甚至初级面试也会问到。但是真正要理解起来,还是相当困难,主要这个东西看不见,摸不着。 这是一个比较开放的题目,面试官主要想考察的是对Java内存模型的了解到了什么程度了,然后根据回答进行进一步的提问 下面,我们就这个问题的回答列一下我们的思路 具体的思路如下: 说一说Java内存模型的缘由 简略辨析...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

Google 与微软的浏览器之争

浏览器再现“神仙打架”。整理 | 屠敏头图 | CSDN 下载自东方 IC出品 | CSDN(ID:CSDNnews)从 IE 到 Chrome,再从 Chrome 到 Edge,微软与...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

搜狗输入法也在挑战国人的智商!

故事总是一个接着一个到来...上周写完《鲁大师已经彻底沦为一款垃圾流氓软件!》这篇文章之后,鲁大师的市场工作人员就找到了我,希望把这篇文章删除掉。经过一番沟通我先把这篇文章从公号中删除了...

85后蒋凡:28岁实现财务自由、34岁成为阿里万亿电商帝国双掌门,他的人生底层逻辑是什么?...

蒋凡是何许人也? 2017年12月27日,在入职4年时间里,蒋凡开挂般坐上了淘宝总裁位置。 为此,时任阿里CEO张勇在任命书中力赞: 蒋凡加入阿里,始终保持创业者的冲劲,有敏锐的...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

什么时候跳槽,为什么离职,你想好了么?

都是出来打工的,多为自己着想

程序员为什么千万不要瞎努力?

本文作者用对比非常鲜明的两个开发团队的故事,讲解了敏捷开发之道 —— 如果你的团队缺乏统一标准的环境,那么即使勤劳努力,不仅会极其耗时而且成果甚微,使用...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

终于懂了TCP和UDP协议区别

终于懂了TCP和UDP协议区别

立即提问
相关内容推荐