有没有人能帮我解决下面的异常,我想我只是不太了解事务传播机制,这阻碍了我理解下面显示的异常消息的真正含义,所以请帮助我理解整个事情,真的非常感谢!
java.lang.IllegalStateException: Existing transaction detected in JobRepository. Please fix this and try again (e.g. remove @Transactional annotations from client).
at org.springframework.batch.core.repository.support.Abstract
在maven项目上,我连接到informix数据库,并且希望在出现异常时进行回滚。看起来informix不支持回滚,我收到以下异常。
java.sql.SQLException: Not in transaction.
at com.informix.util.IfxErrMsg.buildExceptionWithMessage(IfxErrMsg.java:416)
at com.informix.util.IfxErrMsg.buildIsamException(IfxErrMsg.java:401)
at com.informix.jdbc.IfxSqli.ad
我在运行Pro Spring 5书籍中的一个示例时获得了JTA异常(12.使用Spring,boot-jms项目)。以下是整个代码(不包括导入)。它只有一个文件Application.java:
@SpringBootApplication
public class Application {
private static Logger logger = LoggerFactory.getLogger(Application.class);
@Bean
public JmsListenerContainerFactory<DefaultMessageListe
我和一样有同样的问题。我得到了堆栈跟踪,因为我放置了一个违反唯一字段限制的新记录:
Exception in thread "main" 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 or
在进行批处理时,我将得到以下异常
encountered an error.org.springframework.transaction.UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
at java.util.concurrent.FutureTask.get(FutureTask.java:
我正在使用jBPM5,并将Bitronix Transaction Manager (BTM)配置为供jBPM流程持久性单元使用的事务管理器。
在过去的两周中,一切正常,但是突然它开始失败,并出现以下异常,这导致我重新启动应用服务器。重启后,一切正常工作,如预期。
异常堆栈跟踪:
com.xxx.jbpm.workflow.exception.WorkflowException: Could not commit session or rollback
at org.springframework.context.event.SimpleApplicationEventMulticaste
在查询事务中的文档时,只使用特定的id (其他所有id都可以)时,会遇到这个Mongo异常:
Exception occured: org.springframework.data.mongodb.MongoTransactionException:
Query failed with error code 251 and error message
'Given transaction number 1 does not match any in-progress transactions. The active transaction number is -1' on
我得到了一个JAR形式的"API“,用于从我的Java-Seam-Hibernate应用程序执行一些外部记帐操作。
在内部,API是一个普通的Hibernate应用程序,除了Seam本身使用的数据源之外,还使用了两个独立的数据源。
问题是其中一个"API“操作在执行内部.commit()时会引发以下异常:
java.sql.SQLException: You cannot commit during a managed transaction!
at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection
嗨,我正在尝试将异常记录到数据库中
public void a(){
try{
String c = b();
}catch (Throwable ex){
com.log.Logger.log(ex);
throw new UserDefinedException(ex);
}
}
public String b(){
throw new NullPointerException(
我在Tomcatv2.2.0 EC2服务器上运行了Spring4.2.4/Hibernate 5.0.6。
我遇到的问题是在运行服务器一段时间(超过一天)之后,我偶尔会得到以下异常
org.hibernate.AssertionFailure: null id in com.app.core.models.User entry (don't flush the Session after an exception occurs)
org.hibernate.event.internal.DefaultFlushEntityEventListener.checkId(DefaultFlu
postgresql中有许多存储过程,出于某种原因,我需要在事务中运行许多过程,因此如果出现错误,它将回滚。
有办法这样做吗?
编辑1
我通过java运行它,由于某些原因,我不能从java进行事务处理,也不能运行查询字符串,只需存储过程。我其实在想做这样的程序
CREATE OR REPLACE FUNCTION ldt_pricing_rule_v1_api.start()
RETURNS VOID
LANGUAGE PLPGSQL
SECURITY DEFINER
AS $$
BEGIN
EXECUTE 'begin transaction'
RETUR
我们开发了无状态Web服务实现。我们使用JPA作为ORM层来进行数据库操作。在服务方法中,我们使用实体管理器来持久化实体。在将相同的记录持久化到表中时,我们无法处理服务方法中的异常“由: java.sql.SQLIntegrityConstraintViolationException: ORA-00001:唯一约束(TIGOSUSCRIPTIONES.SYS_C0020549)违反”引起的异常。它直接在客户端结果中抛出以下异常。
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Tra
我有一个类文件,CBRTask.java
在这个CBRTask.java中,我有如下代码:
@Autowired
private CbrService cbrService;
public CBRPayment execute() {
try {
cbrService.sendCR( this.entity );
// If I manually throw Exception here, no problem in catch
catch (Exception exception) {
// do something to call db
使用Server与JdbcTemplate和JTDS连接到我正在维护的遗留代码中的MS数据库。我正在尝试处理应用程序已经启动的情况,以及由于任何原因,数据库变得不可用并引发连接异常的情况。
我已经有了一个自定义的SQL代码转换器(下面),它捕获了jdbcTemplate引发的许多其他异常。但是,即使连接被封装为java.sql.SQLException (请参阅堆栈跟踪),也不会捕获连接拒绝的异常。
为什么翻译不捕捉这个异常呢?
public class CustomSqlErrorCodeTranslator extends
SQLErrorCode
我正在建立一个基于java的web应用程序,在SQL服务器上工作。
SQL server的默认数据库隔离级别为READ_COMMITTED。
我得到了以下异常:
Cause: org.hibernate.exception.LockAcquisitionException: Transaction (Process ID 124) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
2016-0
这里是我的问题:
我正在Java /Spring/Hibernate应用程序上运行一个批处理。这个批处理调用一个method1。这个方法调用一个method2,它可以抛出UserException (扩展RuntimeException的类)。以下是它的样子:
@Transactional
public class BatchService implements IBatchService {
@Transactional(propagation=Propagation.REQUIRES_NEW)
public User method2(User user) {
// Process
当消息处理抛出异常时,我如何有效地支持JMS重新交付?
我有一个使用JMS (ActiveMQ)的流,它的connectionFactory被配置为允许n次重新传递尝试。
我希望在处理msg时发生的任何错误都会导致msg在connectionFactory配置允许的次数内被放回重新传送,然后当最大重新传送尝试用完时,传送到DLQ。像往常一样使用AMQ。
对一个相关SO问题的回答意味着我可以有一个重新抛出的errorChannel,它应该触发重新交付:
但是,由于以下原因,这种情况并没有发生:
/***
* Dispatch msgs from JMS queue to a handler u
我使用的是spring boot 1.2.3.RELEASE版本和hibernate上的JPA。我遇到以下异常
org.springframework.dao.InvalidDataAccessApiUsageException: No transactional EntityManager available; nested exception is javax.persistence.TransactionRequiredException: No transactional EntityManager available
at org.springframework.orm.jpa.En
在我的应用程序中,我在从web服务获得响应后显示了一个对话框片段。我从onCreate调用此服务。在此期间,如果应用程序转到后台,它会因异常而崩溃
Fatal Exception: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1493)
at android.support.v4.app.Fr