jta 相关问题

Java Transaction API(JTA)指定事务管理器与分布式事务系统中涉及的各方之间的标准Java接口:资源管理器,应用程序服务器和事务应用程序。

@Trasactional 注释不适用于 webflux 3.3.2

我们最近开始将 spring webflux 版本 2.7X 升级到 3.3.2。升级后,当我们用 Postman 访问 API 时,它会进入控制器层,如果服务层方法用@注释

回答 1 投票 0

Atomikos 库有不兼容的包(从 javax.transaction 到 jakarta.transaction)

我在 Springboot 3 中有 Atomikos (6.0.0),并使用 Java 21。它可以工作,但使用 @Deprecated 类“ChainedTransactionManager(transactionManagerOne, transactionManagerTwo)”。如果事实...

回答 1 投票 0

LoggerFactory 异常

在我的Java应用程序中,我需要使用连接池,所以我决定实现HibernateCP。问题是我得到这个异常,我需要添加以下内容:org/slf4j/LoggerFactory。完整

回答 1 投票 0

是否有可能将 JTA 与 Spring Framework 6 和 Tomcat 或 Payara 一起使用?

您能解释一下如何在 Payara 或 Tomcat 服务器上使用纯 Spring 框架的 Java Transaction API 吗?我找不到任何解决方案。 Stack Overflow 上有多个关于使用

回答 1 投票 0

如何暂时禁用Hibernate实体版本检查?

我有一个显示所有联系人的页面。这只是只读页面,我所做的就是遍历某个组的所有联系人并显示它们: //不是延迟加载联系人,我不能使用...

回答 4 投票 0

JaVers + Spring Boot 3 + JTA + Atomikos

将现有 Java 项目从 Spring Boot 2.7 升级到 3.1 后,除了 JaVers 之外,一切正常。每当 JaVers 需要做某事时 - 例如在应用程序启动时验证架构或提交......

回答 1 投票 0

如何验证 Java 事务注释已被处理?

我有一个接口,我想为其实现事务变体。 公共接口服务{ void handle(Object message) 抛出异常; } 我的实现使用注释来...

回答 1 投票 0

JTA UserTransaction(使用 narayna 实现)在独立 JPA+Hibernate 应用程序中回滚不起作用

以下代码片段在main中 尝试(EntityManager em =EntityManagerFactory.createEntityManager()){ TestEntity e = new TestEntity(); 用户交易 tx = com.arjuna.ats.jta.

回答 1 投票 0

javax.transaction.Transactional 与 org.springframework.transaction.annotation.Transactional

我不明白注释javax.transaction.Transactional和org.springframework.transaction.annotation.Transactional之间的实际区别是什么? 是 org.springframework.transaction.

回答 4 投票 0

Quarkus:即使外部事务回滚也会更新数据库表

我们的大多数 Quarkus 端点都遵循标准做法,其中使用 @Transactional 进行注释,调用我们的业务层,如果抛出异常,则滚动整个事务

回答 1 投票 0

Jakarta EE 8 JTA 事务在 2 分钟后中止

我正在使用 Apach Netbeans 16 和 Glassfish 6.2.5 进行开发,每次当我有一个事务需要超过 2 分钟时,事务就会中止并出现以下错误: 系统异常

回答 1 投票 0

什么是 openliberty 事务管理器后端路由?

Java EE 应用程序服务器 OpenLiberty 文档为事务管理器提供了一个可配置属性“backendURL”。 当后端路由处于活动状态时,对等服务器使用 URL 来

回答 1 投票 0

将 JTA 属性设置为 Atomikos + Spring Boot 配置

我正在尝试使用以下命令在 Spring Boot 配置中设置 Atomikos JTA 属性(例如 com.atomikos.icatch.max_timeout): 导入 com.atomikos.icatch.config.UserTransactionServiceImp; ...

回答 3 投票 0

Hibernate执行更新SQL语句但更新没有写入数据库

我有一个在 WildFly 服务器上运行的 Java EE 应用程序。持久化单元中的配置如下: 我有一个在 WildFly 服务器上运行的 Java EE 应用程序。持久化单元中的配置如下: <persistence-unit name="default" transaction-type="JTA"> <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> <jta-data-source>java:/jboss/datasources/templateDS</jta-data-source> <shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode> <validation-mode>AUTO</validation-mode> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" /> <property name="hibernate.show_sql" value="true" /> <property name="hibernate.format_sql" value="true" /> <property name="use_sql_comments" value="false" /> <property name="hibernate.cache.use_second_level_cache" value="true" /> <property name="hibernate.cache.use_query_cache" value="true" /> <!-- <property name="hibernate.cache.region.factory_class" vvalue="org.hibernate.transaction.CMTTransactionFactory"/>--> <!-- <property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.infinispan.JndiInfinispanRegionFactory" />--> <property name="hibernate.cache.infinispan.cachemanager" value="java:jboss/infinispan/container/hibernate" /> <!-- <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>--> <property name="hibernate.generate_statistics" value="false" /> <!-- none | validate | update | create | create-drop --> <property name="hibernate.hbm2ddl.auto" value="none" /> </properties> </persistence-unit> 我有一些业务逻辑,用于向用户发送 Firebase 推送通知,作为一种有针对性的通信形式。用户基数相当大(> 10k),因此我们决定以 10 个为一组对消息收件人进行分页和批处理,以确保不存在内存问题。我有一个名为 MessageRecipient 的实体,它管理接收消息的用户。它有一个列来管理状态,当逻辑运行时,我们希望将每条已发送消息的状态从“未发送”更新为“已发送”或“失败”。以下是我在方法中运行的业务逻辑: private void sendTargetedMessages(CsvFile dueFile) { LOGGER.debug("in send targeted messages"); String filename = dueFile.getFilename(); String batchRef = filename.substring(0, filename.indexOf('.')); // Calculate number of recipients. int numberOfRecipients = crudService.findAllByColumn(MessageRecipient.class, batchRef, "batchRef").size(); int pageNumber = 0; int pageSize = 10; //TODO: Change this to config entry Integer num_sent = 0; // Calculate number of pages. Use calculated number of pages to run the logic in a do while loop that increments do { List<MessageRecipient> recipients = crudService.findAllByColumn(MessageRecipient.class, batchRef, "batchRef", new Paging(pageNumber, pageSize)); // Execute the logic if (recipients != null) { // send targeted messages User u; for (MessageRecipient r : recipients) { u = null; if (RecipientState.UNSENT.equals(r.getState())) { if (UserReferenceType.CVS_REF.equals(dueFile.getUserReferenceType())) { u = userRepository.findUserByCvsRef(r.getReference(), Status.ACTIVE); } else { try { u = userRepository.findUserByUserId(Long.parseLong(r.getReference()), Status.ACTIVE); } catch (NumberFormatException e) { r.setState(RecipientState.FAILED); LOGGER.error("Reference cannot be converted to long.", e); } } if (u != null) { pushNotificationService.sendTargetedCommunication(u, dueFile.getCommId()); r.setState(RecipientState.SENT); num_sent++; } //crudService.merge(r); entityManager.merge(r); entityManager.flush(); } } } else { LOGGER.error("No recipients found for targeted communication."); } // Increment page number pageNumber++; } while (pageNumber <= (calculateNumberOfPages(numberOfRecipients, pageSize) - 1)); // Send email report once done if (!StringUtils.isBlank(dueFile.getReportEmails())) { String[] reportEmails = dueFile.getReportEmails().split(","); List<String> reportEmailsList = Arrays.asList(reportEmails); messagingReportService.sendEmailReport(reportEmailsList, batchRef, numberOfRecipients, num_sent, dueFile.getBucketName()); } } 我调用entityManager merge() 和flush() 来尝试在发送推送通知后更新每个MessageRecipient 记录的状态,但状态在我的数据库(MySQL 数据库)中没有更新。我在应用程序中打开了 SQL 语句日志记录,并且看到 Hibernate 执行更新 SQL 语句,尽管我的数据库中没有更新。我该如何解决这个问题? 11:04:54,017 INFO [stdout] (EE-ManagedScheduledExecutorService-default-Thread-1) Hibernate: 11:04:54,018 INFO [stdout] (EE-ManagedScheduledExecutorService-default-Thread-1) update 11:04:54,018 INFO [stdout] (EE-ManagedScheduledExecutorService-default-Thread-1) message_recipient 11:04:54,019 INFO [stdout] (EE-ManagedScheduledExecutorService-default-Thread-1) set 11:04:54,019 INFO [stdout] (EE-ManagedScheduledExecutorService-default-Thread-1) last_updated=?, 11:04:54,019 INFO [stdout] (EE-ManagedScheduledExecutorService-default-Thread-1) batch_ref=?, 11:04:54,020 INFO [stdout] (EE-ManagedScheduledExecutorService-default-Thread-1) reference=?, 11:04:54,020 INFO [stdout] (EE-ManagedScheduledExecutorService-default-Thread-1) state=? 11:04:54,021 INFO [stdout] (EE-ManagedScheduledExecutorService-default-Thread-1) where 11:04:54,021 INFO [stdout] (EE-ManagedScheduledExecutorService-default-Thread-1) id=? 最初我只是调用 entityManager.merge(T entity),Hibernate 在尝试更新实体时没有生成更新 SQL 语句,但我添加了 entityManager.flush(),现在我在日志中看到它。但是,我的问题是数据库也没有更新。 您正在使用二级缓存,可能是缓存尚未刷新事务,请尝试读取应用程序中的更改(如果您尝试读取时存在更改),没问题,它按预期工作,那么这意味着它的缓存未刷新还没有到 DB。 另一件事是确保您使用 EJB 和 @TransactionManagement(TransactionManagementType.CONTAINER) 在容器管理的 TX 范围内进行操作

回答 1 投票 0

在Servlet内的容器管理事务上下文中调用EntityManager的方法是线程安全的吗?

servlet 中有以下代码片段 @PeristenceContext 私有EntityManager实体管理器; @覆盖 protected void doPost(HttpServletRequest req, HttpServletResponse resp) ...

回答 1 投票 0

有问题的读取提交行为 - 我应该期待什么?

有关使用 Wildfly、hibernate jpa、jta 和隔离级别 READ_COMMITED 的隔离级别的小简化问题。假设以下场景: 线程 1,在表 SomeTable 上,使用 JPA ...

回答 1 投票 0

无法创建请求的服务[org.hibernate.service.jta.platform.spi.JtaPlatform]

我正在使用 spring3、hibernate4 和 maven3,我的这段代码给了我这个错误: 无法创建请求的服务 [org.hibernate.service.jta.platform.spi.JtaPlatform] 我正在使用 spring3、hibernate4 和 maven3,我的这段代码给了我这个错误: Unable to create requested service [org.hibernate.service.jta.platform.spi.JtaPlatform] <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd"> <util:properties id="hibernateProperties" location="classpath:hibernate.properties" /> <tx:annotation-driven proxy-target-class="true" transaction-manager="transactionManager"/> <context:component-scan base-package="com.ecom.data.access.controller" /> <context:component-scan base-package="com.ecom.data.access.model" /> <mvc:annotation-driven /> <bean id="usermanagementSessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <property name="dataSource" ref="usermanagementDataSource" /> <property name="configLocation" value="classpath:hibernate.cfg.xml" /> <!-- <property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration" /> --> <property name="annotatedClasses"> <list> <value>com.ecom.data.access.model.User</value> <value>com.ecom.data.access.controller.LoginController</value> <value>com.ecom.data.access.dao.MyFactory</value> </list> </property> <property name="hibernateProperties" ref="hibernateProperties" /> </bean> <jee:jndi-lookup id="usermanagementDataSource" jndi-name="java:jboss/datasources/usermanagementDS" /> <bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager" init-method="init" destroy-method="close"> <property name="forceShutdown" value="false" /> <property name ="startupTransactionService" value="false"/> </bean> <bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp"> <property name="transactionTimeout" value="30" /> </bean> <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <property name="transactionManager" ref="atomikosTransactionManager" /> <property name="userTransaction" ref="atomikosUserTransaction" /> </bean> <bean id="User" class="com.ecom.data.access.model.User"/> <bean id="myFactory" class="com.ecom.data.access.dao.MyFactory"/> </beans> 休眠属性文件 hibernate.validator.apply_to_ddl=false hibernate.validator.autoregister_listeners=false hibernate.dialect=org.hibernate.dialect.MySQLDialect hibernate.show_sql=false hibernate.format_sql=true #hibernate.query.factory_class=org.hibernate.hql.classic.ClassicQueryTranslatorFactory hibernate.hbm2ddl.auto=validate hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider hibernate.max_fetch_depth=2 hibernate.default_batch_fetch_size=32 hibernate.transaction.manager_lookup_class=com.atomikos.icatch.jta.hibernate4.TransactionManagerLookup hibernate.transaction.factory_class=org.hibernate.transaction.CMTTransactionFactory 错误: Error creating bean with name 'usermanagementSessionFactory' defined in class path resource [applicationContext-dao.xml]: Invocation of init method failed; nested exception is hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.service.jta.platform.spi.JtaPlatform] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1486) [spring-beans-3.2.1.RELEASE ] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:524) [spring-beans-3.2.1.RELEASE.ja at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461) [spring-beans-3.2.1.RELEASE.jar: at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) [spring-beans-3.2.1.RELEASE.jar:] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) [spring-beans-3.2.1.RELEASE.jar:] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) [spring-beans-3.2.1.RELEASE.jar:] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) [spring-beans-3.2.1.RELEASE.jar:] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:608) [spring-beans-3.2.1.RELEASE.jar:] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932) [spring-context-3.2.1.RELEASE.jar at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479) [spring-context-3.2.1.RELEASE.jar:] at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389) [spring-web-3.2.2.RELEASE.jar:] at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294) [spring-web-3.2.2.RELEASE.jar:] at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) [spring-web-3.2.2.RELEASE.jar:] at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3368) [jbossweb-7.0.1.Final.jar:7.0.2.Final] at org.apache.catalina.core.StandardContext.start(StandardContext.java:3821) [jbossweb-7.0.1.Final.jar:7.0.2.Final] at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_18] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_18] at java.lang.Thread.run(Thread.java:619) [:1.6.0_18] aused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.service.jta.platform.spi.JtaPlatform] at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:186) [hibernate-core-4.1.10.Final.jar:] at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:150) [hibernate-core-4.1.10.Final.jar:] at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131) [hibernate-core-4.1.10.Final.jar:] at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:102) [hibernate-core-4.1.10.Final.jar:] at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2276) [hibernate-core-4.1.10.Final.jar:] at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2272) [hibernate-core-4.1.10.Final.jar:] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1741) [hibernate-core-4.1.10.Final.jar:] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1781) [hibernate-core-4.1.10.Final.jar:] at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:247) [spring-orm-3.2.2.RELEASE.jar:] at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:373) [spring-orm-3.2.2.RELEASE.jar:] at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:358) [spring-orm-3.2.2.RELEASE.jar:] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1545) [spring-beans-3.2.1.RELE ar:] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1483) [spring-beans-3.2.1.RELEASE ] ... 20 more aused by: org.hibernate.service.jta.platform.spi.JtaPlatformException: Unable to build org.hibernate.service.jta.platform.internal.TransactionManagerLookupBridge from specifie .hibernate.transaction.TransactionManagerLookup implementation: com.atomikos.icatch.jta.hibernate4.TransactionManagerLookup at org.hibernate.service.jta.platform.internal.JtaPlatformInitiator.mapLegacyClasses(JtaPlatformInitiator.java:155) [hibernate-core-4.1.10.Final.jar:] at org.hibernate.service.jta.platform.internal.JtaPlatformInitiator.getConfiguredPlatform(JtaPlatformInitiator.java:78) [hibernate-core-4.1.10.Final.jar:] at org.hibernate.service.jta.platform.internal.JtaPlatformInitiator.initiateService(JtaPlatformInitiator.java:60) [hibernate-core-4.1.10.Final.jar:] at org.hibernate.service.jta.platform.internal.JtaPlatformInitiator.initiateService(JtaPlatformInitiator.java:47) [hibernate-core-4.1.10.Final.jar:] at org.hibernate.service.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:69) [hibernate-core-4.1.10.Final.jar:] at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:176) [hibernate-core-4.1.10.Final.jar:] ... 32 more 4:57:12,923 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/SpringMVC]] (MSC service thread 1-4) Exception sending context initialized event to list instance of class org.springframework.web.context.ContextLoaderListener: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'usermanagement onFactory' defined in class path resource [applicationContext-dao.xml]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unabl create requested service [org.hibernate.service.jta.platform.spi.JtaPlatform] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1486) [spring-beans-3.2.1.RELEASE ] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:524) [spring-beans-3.2.1.RELEASE.ja at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461) [spring-beans-3.2.1.RELEASE.jar: at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) [spring-beans-3.2.1.RELEASE.jar:] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) [spring-beans-3.2.1.RELEASE.jar:] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) [spring-beans-3.2.1.RELEASE.jar:] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) [spring-beans-3.2.1.RELEASE.jar:] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:608) [spring-beans-3.2.1.RELEASE.jar:] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932) [spring-context-3.2.1.RELEASE.jar at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479) [spring-context-3.2.1.RELEASE.jar:] at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389) [spring-web-3.2.2.RELEASE.jar:] at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294) [spring-web-3.2.2.RELEASE.jar:] at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) [spring-web-3.2.2.RELEASE.jar:] at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3368) [jbossweb-7.0.1.Final.jar:7.0.2.Final] at org.apache.catalina.core.StandardContext.start(StandardContext.java:3821) [jbossweb-7.0.1.Final.jar:7.0.2.Final] at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_18] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_18] at java.lang.Thread.run(Thread.java:619) [:1.6.0_18] aused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.service.jta.platform.spi.JtaPlatform] at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:186) [hibernate-core-4.1.10.Final.jar:] at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:150) [hibernate-core-4.1.10.Final.jar:] at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131) [hibernate-core-4.1.10.Final.jar:] at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:102) [hibernate-core-4.1.10.Final.jar:] at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2276) [hibernate-core-4.1.10.Final.jar:] at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2272) [hibernate-core-4.1.10.Final.jar:] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1741) [hibernate-core-4.1.10.Final.jar:] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1781) [hibernate-core-4.1.10.Final.jar:] at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:247) [spring-orm-3.2.2.RELEASE.jar:] at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:373) [spring-orm-3.2.2.RELEASE.jar:] at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:358) [spring-orm-3.2.2.RELEASE.jar:] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1545) [spring-beans-3.2.1.RELE ar:] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1483) [spring-beans-3.2.1.RELEASE ] ... 20 more aused by: org.hibernate.service.jta.platform.spi.JtaPlatformException: Unable to build org.hibernate.service.jta.platform.internal.TransactionManagerLookupBridge from specifie .hibernate.transaction.TransactionManagerLookup implementation: com.atomikos.icatch.jta.hibernate4.TransactionManagerLookup at org.hibernate.service.jta.platform.internal.JtaPlatformInitiator.mapLegacyClasses(JtaPlatformInitiator.java:155) [hibernate-core-4.1.10.Final.jar:] at org.hibernate.service.jta.platform.internal.JtaPlatformInitiator.getConfiguredPlatform(JtaPlatformInitiator.java:78) [hibernate-core-4.1.10.Final.jar:] at org.hibernate.service.jta.platform.internal.JtaPlatformInitiator.initiateService(JtaPlatformInitiator.java:60) [hibernate-core-4.1.10.Final.jar:] at org.hibernate.service.jta.platform.internal.JtaPlatformInitiator.initiateService(JtaPlatformInitiator.java:47) [hibernate-core-4.1.10.Final.jar:] at org.hibernate.service.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:69) [hibernate-core-4.1.10.Final.jar:] at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:176) [hibernate-core-4.1.10.Final.jar:] ... 32 more 4:57:13,028 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-4) Error listenerStart 4:57:13,028 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-4) Context [/SpringMVC] startup failed due to previous errors 4:57:13,046 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/SpringMVC]] (MSC service thread 1-4) Closing Spring root WebApplicationContext 4:57:13,050 INFO [org.jboss.web] (MSC service thread 1-4) registering web context: /SpringMVC 4:57:13,055 INFO [org.jboss.as] (MSC service thread 1-1) JBoss AS 7.0.2.Final "Arc" started in 9904ms - Started 184 of 241 services (57 services are passive or on-demand) 4:57:13,115 INFO [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed "SpringMVC.war" 我可以尝试回答您的问题,但您的问题应该包含更多信息: 您应该包含完整的堆栈跟踪。您在问题中提出的错误中没有足够的信息。完整的堆栈跟踪将添加一些必要的信息来帮助我们弄清楚发生了什么。 您发布了一个配置文件,但它引用了其他文件,例如hibernate.properties。您应该包含这些文件,以便我们可以检查您的应用程序的正确配置。 如果没有这些信息,我只能建议以下内容: 您正在使用 Atomikos 作为交易管理器。您必须包含对 Atomikos 的 Maven 依赖项(您在帖子中说您正在使用 Maven)。 在声明的beanusermanagementSessionFactory中,您应该具有与Atomikos相关的属性,如本文档中所述(因为我们看不到hibernate属性,也许您已正确配置它们)。 举个例子,我有一个项目可以与 Spring 3.2.3、Hibernate 4.2.1、Atomikos 3.8.0 和 Ivy 完美配合作为依赖管理器(Ivy 使用与 Maven 相同的信息来声明依赖项,所以你不应该使其适应 Maven 的问题)。我在这里放置了一些配置文件,可以帮助您找到错误: ivy.xml <dependency org="org.hibernate" name="hibernate-core" rev="4.2.1.Final"/> <dependency org="com.atomikos" name="transactions-jdbc" rev="3.8.0" /> <dependency org="com.atomikos" name="transactions-hibernate3" rev="3.8.0" /> spring-config.xml <bean id="usermanagementSessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSourceA" /> <property name="annotatedClasses"> <list> <value>com.edt.tests.model.Contact</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.transaction.factory_class"> org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory </prop> <prop key="hibernate.transaction.manager_lookup_class"> com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup </prop> <prop key="hibernate.show_sql">true</prop> </props> </property> </bean> 如果您无法使用此信息解决问题,则必须发布有关您所遇到的错误以及您在项目中使用的配置文件的更多信息。 我用hibernate.transaction.jta.platform_resolver制作的,描述于这里。

回答 2 投票 0

如何在 Quarkus/Kotlin 中使用 JDBC 以事务方式写入 Kafka 记录并持久化它

我正在使用 Kotlin 编写一个反应式 Quarkus 应用程序。这是我的 REST 资源,它接收请求并尝试从中创建操作。 @ApplicationScoped @Path("/v1/opera...

回答 1 投票 0

引起:org.hibernate.MappingException:未知实体:新对象。 JTA

由于我的数据库的复杂性,我决定创建一个新对象,在其中仅指定我将使用的参数。为了进行自定义查询,我在 JPA 中使用 createNativeQuery。遵循我的目标...

回答 4 投票 0

分布式事务中无法调用Connection.commit

我正在使用 Weblogic 12c,在应用程序中提交分布式事务时遇到以下错误。 “java.sql.SQLException:无法在分布式事务中调用 Connection.commit...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.