我遇到了Hibernate Template的问题。有时,调用getElementById()时会出错。这是日志:
21:24:59.227 [http-bio-8080-exec-5] DEBUG c.o.x.i.PrefixMethodInvocationUtil - cannot find method [validateDoOrder] in action [com.restaurant.action.OrderAction@7e99f5b2]
21:24:59.227 [http-bio-8080-exec-5] DEBUG c.o.xwork2.DefaultActionInvocation - Executing action method = order
21:24:59.229 [http-bio-8080-exec-5] DEBUG o.s.o.h.HibernateTransactionManager - Found thread-bound Session [SessionImpl(PersistenceContext[entityKeys=[],collectionKeys=[]];ActionQueue[insertions=org.hibernate.engine.spi.ExecutableList@46ae8f9c updates=org.hibernate.engine.spi.ExecutableList@6e566f04 deletions=org.hibernate.engine.spi.ExecutableList@6c92a833 orphanRemovals=org.hibernate.engine.spi.ExecutableList@1060e3f5 collectionCreations=org.hibernate.engine.spi.ExecutableList@4915f239 collectionRemovals=org.hibernate.engine.spi.ExecutableList@3fd1a1ab collectionUpdates=org.hibernate.engine.spi.ExecutableList@5bcd0248 collectionQueuedOps=org.hibernate.engine.spi.ExecutableList@7050f40d unresolvedInsertDependencies=UnresolvedEntityInsertActions[]])] for Hibernate transaction
21:24:59.229 [http-bio-8080-exec-5] DEBUG o.s.o.h.HibernateTransactionManager - Creating new transaction with name [com.restaurant.service.impl.DeskServiceImpl.getDeskById]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT; '',+java.lang.Exception
21:24:59.229 [http-bio-8080-exec-5] DEBUG o.s.o.h.HibernateTransactionManager - Preparing JDBC Connection of Hibernate Session [SessionImpl(PersistenceContext[entityKeys=[],collectionKeys=[]];ActionQueue[insertions=org.hibernate.engine.spi.ExecutableList@46ae8f9c updates=org.hibernate.engine.spi.ExecutableList@6e566f04 deletions=org.hibernate.engine.spi.ExecutableList@6c92a833 orphanRemovals=org.hibernate.engine.spi.ExecutableList@1060e3f5 collectionCreations=org.hibernate.engine.spi.ExecutableList@4915f239 collectionRemovals=org.hibernate.engine.spi.ExecutableList@3fd1a1ab collectionUpdates=org.hibernate.engine.spi.ExecutableList@5bcd0248 collectionQueuedOps=org.hibernate.engine.spi.ExecutableList@7050f40d unresolvedInsertDependencies=UnresolvedEntityInsertActions[]])]
21:24:59.230 [http-bio-8080-exec-5] DEBUG o.s.o.h.HibernateTransactionManager - Exposing Hibernate transaction as JDBC transaction [Lazy Connection proxy for target DataSource [JDBC URL = jdbc:mysql://localhost:3306/restaurant?autoReconnect=true&useUnicode=true&characterEncoding=utf-8, Username = root, partitions = 2, max (per partition) = 20, min (per partition) = 5, idle max age = 10 min, idle test period = 3 min, strategy = DEFAULT]]
Hibernate: select desk0_.ID as ID1_1_0_, desk0_.availability as availabi2_1_0_, desk0_.LEVEL_ID as LEVEL_ID4_1_0_, desk0_.NAME as NAME3_1_0_ from Desk desk0_ where desk0_.ID=?
21:25:14.294 [http-bio-8080-exec-5] DEBUG o.s.j.d.LazyConnectionDataSourceProxy - Connecting to database for operation 'prepareStatement'
21:25:14.307 [http-bio-8080-exec-5] DEBUG o.s.o.h.HibernateTransactionManager - Initiating transaction rollback
21:25:14.307 [http-bio-8080-exec-5] DEBUG o.s.o.h.HibernateTransactionManager - Rolling back Hibernate transaction on Session [SessionImpl(PersistenceContext[entityKeys=[EntityKey[com.restaurant.model.Desk#1]],collectionKeys=[]];ActionQueue[insertions=org.hibernate.engine.spi.ExecutableList@46ae8f9c updates=org.hibernate.engine.spi.ExecutableList@6e566f04 deletions=org.hibernate.engine.spi.ExecutableList@6c92a833 orphanRemovals=org.hibernate.engine.spi.ExecutableList@1060e3f5 collectionCreations=org.hibernate.engine.spi.ExecutableList@4915f239 collectionRemovals=org.hibernate.engine.spi.ExecutableList@3fd1a1ab collectionUpdates=org.hibernate.engine.spi.ExecutableList@5bcd0248 collectionQueuedOps=org.hibernate.engine.spi.ExecutableList@7050f40d unresolvedInsertDependencies=UnresolvedEntityInsertActions[]])]
21:25:14.308 [http-bio-8080-exec-5] DEBUG o.s.j.d.LazyConnectionDataSourceProxy - Using existing database connection for operation 'rollback'
21:25:14.308 [http-bio-8080-exec-5] DEBUG o.s.j.d.LazyConnectionDataSourceProxy - Using existing database connection for operation 'setAutoCommit'
21:25:14.309 [http-bio-8080-exec-5] DEBUG o.s.j.d.LazyConnectionDataSourceProxy - Using existing database connection for operation 'isReadOnly'
21:25:14.310 [http-bio-8080-exec-5] DEBUG o.s.o.h.HibernateTransactionManager - Not closing pre-bound Hibernate Session [SessionImpl(PersistenceContext[entityKeys=[],collectionKeys=[]];ActionQueue[insertions=org.hibernate.engine.spi.ExecutableList@46ae8f9c updates=org.hibernate.engine.spi.ExecutableList@6e566f04 deletions=org.hibernate.engine.spi.ExecutableList@6c92a833 orphanRemovals=org.hibernate.engine.spi.ExecutableList@1060e3f5 collectionCreations=org.hibernate.engine.spi.ExecutableList@4915f239 collectionRemovals=org.hibernate.engine.spi.ExecutableList@3fd1a1ab collectionUpdates=org.hibernate.engine.spi.ExecutableList@5bcd0248 collectionQueuedOps=org.hibernate.engine.spi.ExecutableList@7050f40d unresolvedInsertDependencies=UnresolvedEntityInsertActions[]])] after transaction
21:25:14.311 [http-bio-8080-exec-5] DEBUG o.s.j.d.LazyConnectionDataSourceProxy - Using existing database connection for operation 'isClosed'
21:25:14.311 [http-bio-8080-exec-5] DEBUG o.s.j.d.LazyConnectionDataSourceProxy - Using existing database connection for operation 'getWarnings'
21:25:14.311 [http-bio-8080-exec-5] DEBUG o.s.j.d.LazyConnectionDataSourceProxy - Using existing database connection for operation 'clearWarnings'
21:25:14.311 [http-bio-8080-exec-5] DEBUG o.s.j.d.LazyConnectionDataSourceProxy - Using existing database connection for operation 'close'
21:25:14.320 [http-bio-8080-exec-5] DEBUG c.o.x.o.accessor.XWorkMethodAccessor - Error calling method through OGNL: object: [com.restaurant.action.OrderAction@7e99f5b2] method: [order] args: [[]]
java.lang.NoClassDefFoundError: javassist/util/proxy/Proxy
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.getProxy(JavassistLazyInitializer.java:147) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
at org.hibernate.proxy.pojo.javassist.JavassistProxyFactory.getProxy(JavassistProxyFactory.java:75) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
at org.hibernate.tuple.entity.AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:771) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.createProxy(AbstractEntityPersister.java:4613) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
at org.hibernate.event.internal.DefaultLoadEventListener.createProxyIfNecessary(DefaultLoadEventListener.java:350) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:271) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:151) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1070) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
at org.hibernate.internal.SessionImpl.internalLoad(SessionImpl.java:989) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:716) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]