admin管理员组

文章数量:1122846

I have a springboot app. wit this conf file:

@EnableTransactionManagement
@EnableJpaRepositories({ "org.moib.kwbom.repositories", "org.moib.kwbom.notification.repositories"})
@Slf4j
@Configuration
public class EclipseLinkJpaConfiguration extends JpaBaseConfiguration {

    private final DataSource dataSource;

    protected EclipseLinkJpaConfiguration(
            JpaProperties properties,
            ObjectProvider<JtaTransactionManager> jtaTransactionManager,
            DataSource dataSource, DataSource dataSource1) {

        super(dataSource, properties, jtaTransactionManager);
        this.dataSource = dataSource1;
    }

    @Override
    protected AbstractJpaVendorAdapter createJpaVendorAdapter() {
        return new EclipseLinkJpaVendorAdapter();
    }

    @Bean
    @Primary
    public static JpaProperties properties() {
        final JpaProperties jpaProperties = new JpaProperties();
        jpaProperties.setShowSql(false);
        jpaProperties.setDatabasePlatform("org.eclipse.persistence.platform.database.OraclePlatform");
        return jpaProperties;
    }

    @Override
    protected Map<String, Object> getVendorProperties() {
        HashMap<String, Object> map = new HashMap<>();
        map.put(PersistenceUnitProperties.WEAVING, detectWeavingMode());
        return map;
    }

    private String detectWeavingMode() {
        return InstrumentationLoadTimeWeaver.isInstrumentationAvailable() ? "true" : "static";
    }
}

and this service class:

@Service
@Transactional
public class InscriptionService implements IInscriptionService {

    private static final Logger LOG = LoggerFactory.getLogger(InscriptionService.class);

  
    private final InscriptionSiteRepository inscriptionSiteRepository;

..
}

and

  @Configuration
@Slf4j
public class ProcessEngineConfig {

    private final DataSource dataSource;

    public ProcessEngineConfig(DataSource dataSource) {
        this.dataSource = dataSource;
    }

    @Bean
    public PlatformTransactionManager transactionManager() {
        return new DataSourceTransactionManager(this.dataSource);
    }

    @Bean
    public SpringProcessEngineConfiguration processEngineConfiguration() {

        SpringProcessEngineConfiguration config = new SpringProcessEngineConfiguration();
        config.setDataSource(this.dataSource);
        config.setTransactionManager(transactionManager());
        config.setDatabaseSchemaUpdate("true");
        config.setHistory("audit");

        return config;
    }


    @Bean
    public ProcessEngineFactoryBean processEngine() {
        ProcessEngineFactoryBean factoryBean = new ProcessEngineFactoryBean();
        factoryBean.setProcessEngineConfiguration(processEngineConfiguration());
        return factoryBean;
    }

    @Bean
    public RepositoryService repositoryService(ProcessEngine processEngine) {
        return processEngine.getRepositoryService();
    }

    @Bean
    public IdentityService identityService(ProcessEngine processEngine) {
        return processEngine.getIdentityService();
    }

    @Bean
    public FormService formService(ProcessEngine processEngine) {
        return processEngine.getFormService();
    }

    @Bean
    public RuntimeService runtimeService(ProcessEngine processEngine) {
        return processEngine.getRuntimeService();
    }

    @Bean
    public TaskService taskService(ProcessEngine processEngine) {
        return processEngine.getTaskService();
    }

    @Bean
    public ManagementService managementService(ProcessEngine processEngine) {
        return processEngine.getManagementService();
    }

    @Bean
    public HistoryService historyService(ProcessEngine processEngine) {
        return processEngine.getHistoryService();
    }
}

but when I save I have this error:

Caused by: javax.persistence.TransactionRequiredException: 
Exception Description: No transaction is currently active
    at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionWrapper.throwCheckTransactionFailedException(EntityTransactionWrapper.java:89)
    at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionWrapper.checkForTransaction(EntityTransactionWrapper.java:52)
    at org.eclipse.persistence.internal.jpa.EntityManagerImpl.checkForTransaction(EntityManagerImpl.java:2196)
    at org.eclipse.persistence.internal.jpa.QueryImpl.executeUpdate(QueryImpl.java:295)
    at org.springframework.data.jpa.repository.query.JpaQueryExecution$ModifyingExecution.doExecute(JpaQueryExecution.java:241)
    at org.springframework.data.jpa.repository.query.JpaQueryExecution.execute(JpaQueryExecution.java:90)
    at org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:156)
    at org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:144)
    at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:137)
    at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:121)
    at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:160)
    at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:139)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:76)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137)
    ... 105 more
 [30m2024-11-22 11:24:02.366 [0;39m  [1;31mERROR [0;39m [ [32m [0;39m]  [33me.e.e.o.k.w.filter.OIBResponseFilter@doFilter(91) [0;39m - Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: 

and logging the info of the transaction manager:

  EclipseLinkJpaConfiguration constructor org.apache.tomcat.jdbc.pool.DataSource@53ab6600{ConnectionPool[defaultAutoCommit=null; defaultReadOnly=null; defaultTransactionIsolation=-1; defaultCatalog=null; driverClassName=oracle.jdbc.OracleDriver; maxActive=40; maxIdle=40; minIdle=5; initialSize=5; maxWait=30000; testOnBorrow=true; testOnReturn=false; timeBetweenEvictionRunsMillis=30000; numTestsPerEvictionRun=0; minEvictableIdleTimeMillis=30000; testWhileIdle=true; testOnConnect=false; password=********; url=jdbc:oracle:thin:@//solrdev181.dins.int:1597/DEDDYWEB_TOIB_01_D_TAF.cec.eu.int; username=DEDDYWEB; validationQuery=SELECT 1 from dual; validationQueryTimeout=-1; validatorClassName=null; validationInterval=30000; accessToUnderlyingConnectionAllowed=true; removeAbandoned=false; removeAbandonedTimeout=60; logAbandoned=false; connectionProperties=null; initSQL=null; jdbcInterceptors=null; jmxEnabled=true; fairQueue=true; useEquals=true; abandonWhenPercentageFull=0; maxAge=60000; useLock=false; dataSource=null; dataSourceJNDI=null; suspectTimeout=300; alternateUsernameAllowed=false; commitOnReturn=false; rollbackOnReturn=false; useDisposableConnectionFacade=true; logValidationErrors=false; propagateInterruptState=false; ignoreExceptionOnPreLoad=false; useStatementFacade=true; ]} org.springframework.boot.autoconfigure.orm.jpa.JpaProperties@7017196b org.springframework.beans.factory.support.DefaultListableBeanFactory$DependencyObjectProvider@7d2c3b1d

the pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns=".0.0" xmlns:xsi=";
         xsi:schemaLocation=".0.0 .xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>org.coronel.sam.mobweb.mobweb.server</groupId>
    <artifactId>canal-coronel</artifactId>
    <version>6.0.0</version>
    <name>mobweb mobweb</name>
    <description>mobweb mobweb</description>
    <packaging>pom</packaging>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.15</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <activiti.version>6.0.0</activiti.version>
        <apache.poi.version>5.3.0</apache.poi.version>
        <calculation-engine.version>3.0.4</calculation-engine.version>
        <commons-csv.version>1.12.0</commons-csv.version>
        <com.h2database.version>1.4.200</com.h2database.version>
        <dbunit.version>2.7.0</dbunit.version>
        <mob-sam-kw-mobweb-workflow-api>3.0.3</mob-sam-kw-mobweb-workflow-api>
        <moblipselink.version>2.7.15</moblipselink.version>
        <eulogin.version>9.8.0</eulogin.version>
        <guava.version>33.3.1-jre</guava.version>
        <h2.version>2.1.210</h2.version>
        <hibernate.version>6.6.1.Final</hibernate.version>
        <jackson.version>2.16.1</jackson.version>
        <jasperreports.version>6.19.1</jasperreports.version>
        <java.version>11</java.version>
        <javax.annotation-api.version>1.3.2</javax.annotation-api.version>
        <javax.mail.version>1.4.7</javax.mail.version>
        <javax.mail-api.version>1.6.2</javax.mail-api.version>
        <javax.validation.version>2.0.1.Final</javax.validation.version>
        <jstl.version>1.2</jstl.version>
        <junit-jupiter.version>5.11.3</junit-jupiter.version>
        <mobweb.mobweb.version>6.0.0</mobweb.mobweb.version>
        <lombok.version>1.18.34</lombok.version>
        <maven-surefire-plugin.version>2.21.0</maven-surefire-plugin.version>
        <oracle.version>11.2.0.4</oracle.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <servlet-api.version>3.1.0</servlet-api.version>
        <spring-boot.version>3.3.5</spring-boot.version>
        <spring-test-dbunit.version>1.3.0</spring-test-dbunit.version>
        <springfox-swagger.version>2.9.2</springfox-swagger.version>
        <springfox.version>2.9.2</springfox.version>
        <tomcat-embed-core.version>9.0.56</tomcat-embed-core.version>
    </properties>


    <repositories>
        <repository>
            <id>digit releases</id>
            <name>DG DIGIT Snapshot Repository</name>
            <url>/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>digit snapshots</id>
            <name>Project Snapshots Repository</name>
            <url>/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
        </repository>
    </repositories>

    <modules>
        <module>modules/canal-coronel-annotations</module>
        <module>modules/canal-coronel-commons</module>
        <module>modules/canal-coronel-definitions</module>
        <module>modules/canal-coronel-definitions-api</module>
        <module>modules/canal-coronel-model</module>
        <module>modules/canal-coronel-presences</module>
        <module>modules/canal-coronel-presences-api</module>
        <module>modules/canal-coronel-repositories</module>
        <module>modules/canal-coronel-services</module>
        <module>modules/canal-coronel-services-api</module>
        <module>modules/canal-coronel-web</module>
        <module>modules/canal-coronel-web-requests</module>
        <module>modules/canal-coronel-workflows</module>
        <module>modules/canal-coronel-workflows-api</module>
    </modules>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-core</artifactId>
                <version>${jackson.version}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${jackson.version}</version>
            </dependency>
            <dependency>
                <groupId>org.coronel.digit.iamlogin.client</groupId>
                <artifactId>eulogin-tomcat-8.0</artifactId>
                <version>${eulogin.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.coronel.digit.imi.lib.oracle</groupId>
                <artifactId>ojdbc6</artifactId>
                <version>${oracle.version}</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger-ui</artifactId>
                <version>${springfox.version}</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger2</artifactId>
                <version>${springfox.version}</version>
            </dependency>
            <dependency>
                <groupId>net.sf.jasperreports</groupId>
                <artifactId>jasperreports</artifactId>
                <version>${jasperreports.version}</version>
            </dependency>
            <dependency>
                <groupId>net.sf.jasperreports</groupId>
                <artifactId>jasperreports-functions</artifactId>
                <version>${jasperreports-functions.version}</version>
            </dependency>
            <dependency>
                <groupId>org.activiti</groupId>
                <artifactId>activiti-spring</artifactId>
                <version>${activiti.version}</version>
            </dependency>
            <dependency>
                <groupId>org.activiti</groupId>
                <artifactId>activiti5-spring</artifactId>
                <version>${activiti.version}</version>
            </dependency>
            <dependency>
                <groupId>org.activiti</groupId>
                <artifactId>activiti5-spring-compatibility</artifactId>
                <version>${activiti.version}</version>
            </dependency>
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>${lombok.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-tx</artifactId>
                <version>6.1.11</version>
                <type>pom</type>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-devtools</artifactId>
                <scope>runtime</scope>
                <optional>true</optional>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-mail</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
                <exclusions>
                    <exclusion>
                        <groupId>org.junit.vintage</groupId>
                        <artifactId>junit-vintage-engine</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <profiles>
        <profile>
            <id>DEV</id>
            <activation>
                <activeByDefault>true</activeByDefault>
                <property>
                    <name>env</name>
                    <value>dev</value>
                </property>
            </activation>
            <properties>
                <spring.profiles.active>dev</spring.profiles.active>
                <profileName>dev</profileName>
                <log.path>./logs</log.path>
                <log.level>INFO</log.level>
                <moblipselink.showSql>true
                </moblipselink.showSql>
                <moblipselink.logging.level>INFO</moblipselink.logging.level>
                <moblipselink.logging.level.sql>INFO</moblipselink.logging.level.sql>
                <webpack.buildmand>run build-dev-ci</webpack.buildmand>
                <swagger.enable>false</swagger.enable>
                <mobas.serviceUrl>;/mobas.serviceUrl>
                <mobas.mobasBaseUrl>/</mobas.mobasBaseUrl>
            </properties>
        </profile>
    </profiles>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>org.junit.jupiter</groupId>
                        <artifactId>junit-jupiter-engine</artifactId>
                        <version>${junit-jupiter.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

</project>

本文标签: