gpt4 book ai didi

java - org.hibernate.exception.GenericJDBCException : Cannot open connection

转载 作者:行者123 更新时间:2023-11-29 10:06:14 29 4
gpt4 key购买 nike

我正在使用 JBPM jar 来遵循一些流程。以前我们在 jar 中做了一些代码更改并使用 Malven 构建并且它工作正常。现在我们再次进行了一些代码更改并使用 Ant 脚本进行构建。但它会抛出异常

java.lang.ExceptionInInitializerError
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 org.hibernate.engine.UnsavedValueFactory.instantiate(UnsavedValueFactory.java:22)
at org.hibernate.engine.UnsavedValueFactory.getUnsavedIdentifierValue(UnsavedValueFactory.java:44)
at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:44)
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:124)
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:1300)
at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:97)
at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:95)
at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:99)
at org.jbpm.persistence.db.DbPersistenceService.getGraphSession(DbPersistenceService.java:341)
at org.jbpm.JbpmContext.getGraphSession(JbpmContext.java:571)
at org.jbpm.JbpmContext.newProcessInstanceForUpdate(JbpmContext.java:417)
at com.k2.process.adapter.jbpm.JBPMAdapter.createNewProcessInstance(JBPMAdapter.java:79)
at com.k2.process.ProcessAgentManager.createNewProcessInstance(ProcessAgentManager.java:45)
at com.k2.process.control.ProcessController.createNewProcess(ProcessController.java:153)
at com.k2.process.control.ProcessController.createNewProcess(ProcessController.java:90)
at com.k2.process.ProcessAgentBean.createProcess(ProcessAgentBean.java:104)
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.jboss.invocation.Invocation.performCall(Invocation.java:359)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:237)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:169)
at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
at org.jboss.ejb.Container.invoke(Container.java:960)
at sun.reflect.GeneratedMethodAccessor644.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
at org.jboss.invocation.InvokerInterceptor.invokeLocalMarshalled(InvokerInterceptor.java:295)
at org.jboss.invocation.MarshallingInvokerInterceptor.invoke(MarshallingInvokerInterceptor.java:61)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
at $Proxy503.createProcess(Unknown Source)

Caused by: org.hibernate.exception.GenericJDBCException: Cannot open connection
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:426)
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] at org.hibernate.loader.Loader.doQuery(Loader.java:673)
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] at org.hibernate.loader.Loader.doList(Loader.java:2213)
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] at org.hibernate.loader.Loader.list(Loader.java:2099)
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] at com.k2.util.HibernateQuery.execute(HibernateQuery.java:32)
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] ... 209 more
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] Caused by: org.jboss.util.NestedSQLException: Transaction is not active: tx=TransactionImple < ac, BasicAction: -3f57fe7d:998:4e703d1b:201 status: ActionStatus.ABORT_ONLY >; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: -3f57fe7d:998:4e703d1b:201 status: ActionStatus.ABORT_ONLY >)
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:94)
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:69)
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] ... 223 more
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] Caused by: javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: -3f57fe7d:998:4e703d1b:201 status: ActionStatus.ABORT_ONLY >
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:304)
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:396)
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842)
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88)
2011-09-14 11:13:56,457 ERROR [http-192.168.1.131-18080-1] [STDERR] ... 225 more

构建流程没有任何变化。

<property name="hibernate.connection.datasource">java:/JbpmDS</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.format_sql">true</property>
<property name="hibernate.use_sql_comments">true</property>

以上是我的 hibernate 映射。这是我生成异常的行

sessionFactory=hibernateConfiguration.buildSessionFactory();

先谢谢你。

最佳答案

已发布此内容,作为问题的有用答案。

带有消息的异常 javax.resource.ResourceException:Transaction is not active 并不意味着由于无法启动事务而导致事务失败。相反,在应用程序代码中抛出了一个未捕获的异常,导致现有事务终止。当尝试后续事务 Activity 时,它失败并出现指定的异常,因为与线程关联的事务不再处于 Activity 状态。

此类事件的修复是修复导致非 Activity 事务的原始异常的原因。这可以通过使用过于广泛的异常处理程序(捕获 ExceptionThrowable)来捕获异常以确定根本原因来完成。修复根本原因将导致不抛出异常,并具有确保事务在执行事务 Activity 时处于 Activity 状态的预期效果。

关于java - org.hibernate.exception.GenericJDBCException : Cannot open connection,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7411604/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com