Когда я запускаю свой проект в IntelliJ, все работает нормально (с использованием java --classpath com.my.project .Launcher).
Однако, когда я создаю jar-файл и запускаю его вручную, я получаю следующую трассировку стека.
Код: Выделить всё
2024-10-02 16:50:24 [background-preinit] INFO [org.hibernate.validator.internal.util.Version] Version.:30 - HV000001: Hibernate Validator 5.2.4.Final
2024-10-02 16:50:24 [main] INFO [com.my.project.Launcher] StartupInfoLogger.logStarting:48 - Starting Launcher v3.1-SNAPSHOT on localhost.localdomain with PID 12995 (/home/user/workspace/my.project/target/my.project.jar started by user in /home/user/workspace/my.project)
2024-10-02 16:50:24 [main] INFO [com.my.project.batch.my.project.Launcher] SpringApplication.logStartupProfileInfo:661 - No active profile set, falling back to default profiles: default
2024-10-02 16:50:24 [main] INFO [org.springframework.context.annotation.AnnotationConfigApplicationContext] AbstractApplicationContext.prepareRefresh:582 - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@244038d0: startup date [Wed Oct 02 16:50:24 CEST 2024]; root of context hierarchy
2024-10-02 16:50:25 [main] INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] DefaultListableBeanFactory.registerBeanDefinition:821 - Overriding bean definition for bean 'transactionManager' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=myprojectTransactionManagerConfiguration; factoryMethodName=transactionManager; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/my/project/batch/my.project/configuration/MyProjectTransactionManagerConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.batch.core.configuration.annotation.SimpleBatchConfiguration; factoryMethodName=transactionManager; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/batch/core/configuration/annotation/SimpleBatchConfiguration.class]]
2024-10-02 16:50:25 [main] WARN [org.springframework.context.annotation.ConfigurationClassEnhancer] ConfigurationClassEnhancer$BeanMethodInterceptor.intercept:348 - @Bean method ScopeConfiguration.stepScope is non-static and returns an object assignable to Spring's BeanFactoryPostProcessor interface. This will result in a failure to process annotations such as @Autowired, @Resource and @PostConstruct within the method's declaring @Configuration class. Add the 'static' modifier to this method to avoid these container lifecycle issues; see @Bean javadoc for complete details.
2024-10-02 16:50:25 [main] WARN [org.springframework.context.annotation.ConfigurationClassEnhancer] ConfigurationClassEnhancer$BeanMethodInterceptor.intercept:348 - @Bean method ScopeConfiguration.jobScope is non-static and returns an object assignable to Spring's BeanFactoryPostProcessor interface. This will result in a failure to process annotations such as @Autowired, @Resource and @PostConstruct within the method's declaring @Configuration class. Add the 'static' modifier to this method to avoid these container lifecycle issues; see @Bean javadoc for complete details.
2024-10-02 16:50:25 [main] WARN [com.atomikos.jdbc.AbstractDataSourceBean] Slf4jLogger.logWarning:12 - AtomikosDataSoureBean 'data1Ds': poolSize equals default - this may cause performance problems!
2024-10-02 16:50:26 [main] WARN [com.atomikos.jdbc.AbstractDataSourceBean] Slf4jLogger.logWarning:12 - AtomikosDataSoureBean 'data2Ds': poolSize equals default - this may cause performance problems!
2024-10-02 16:50:26 [main] WARN [com.atomikos.icatch.config.UserTransactionServiceImp] Slf4jLogger.logWarning:12 - No properties path set - looking for transactions.properties in classpath...
2024-10-02 16:50:26 [main] WARN [com.atomikos.icatch.config.UserTransactionServiceImp] Slf4jLogger.logWarning:12 - transactions.properties not found - looking for jta.properties in classpath...
2024-10-02 16:50:26 [main] WARN [com.atomikos.icatch.config.UserTransactionServiceImp] Slf4jLogger.logWarning:12 - Failed to open transactions properties file - using default values
2024-10-02 16:50:26 [main] WARN [com.atomikos.icatch.config.imp.AbstractUserTransactionService] Slf4jLogger.logWarning:12 - /logqm0/myproject could not be created - using default
2024-10-02 16:50:26 [main] WARN [com.atomikos.persistence.Utils] Slf4jLogger.logWarning:12 - /logqm0/myproject could not be created - using default
2024-10-02 16:50:27 [main] INFO [org.springframework.batch.core.repository.support.JobRepositoryFactoryBean] JobRepositoryFactoryBean.afterPropertiesSet:183 - No database type set, using meta data indicating: ORACLE
2024-10-02 16:50:27 [main] INFO [org.springframework.batch.core.launch.support.SimpleJobLauncher] SimpleJobLauncher.afterPropertiesSet:195 - No TaskExecutor has been set, defaulting to synchronous executor.
2024-10-02 16:50:27 [main] INFO [org.apache.commons.vfs2.impl.StandardFileSystemManager] VfsLog.info:136 - Using "/tmp/vfs_cache" as temporary files store.
2024-10-02 16:50:27 [main] INFO [org.springframework.jmx.export.annotation.AnnotationMBeanExporter] MBeanExporter.afterSingletonsInstantiated:431 - Registering beans for JMX exposure on startup
2024-10-02 16:50:27 [main] INFO [org.springframework.boot.autoconfigure.batch.JobLauncherCommandLineRunner] JobLauncherCommandLineRunner.run:118 - Running default command line with: [--logging.level.root=TRACE]
2024-10-02 16:50:27 [main] ERROR [org.springframework.boot.SpringApplication] SpringApplication.reportFailure:839 - Application startup failed
java.lang.StackOverflowError: null
at java.lang.reflect.InvocationTargetException.(InvocationTargetException.java:72)
at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.batch.core.configuration.annotation.SimpleBatchConfiguration$PassthruAdvice.invoke(SimpleBatchConfiguration.java:127)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy.$Proxy60.getTransaction(Unknown Source)
at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.batch.core.configuration.annotation.SimpleBatchConfiguration$PassthruAdvice.invoke(SimpleBatchConfiguration.java:127)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy.$Proxy60.getTransaction(Unknown Source)
at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.batch.core.configuration.annotation.SimpleBatchConfiguration$PassthruAdvice.invoke(SimpleBatchConfiguration.java:127)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy.$Proxy60.getTransaction(Unknown Source)
Код: Выделить всё
4.0.0
org.springframework.boot
spring-boot-starter-parent
1.4.2.RELEASE
com.my.project
my-project
1.1-SNAPSHOT
My Project
a simple project
1.8
UTF-8
UTF-8
org.springframework.boot
spring-boot-starter-batch
org.springframework.boot
spring-boot-starter-jta-atomikos
org.springframework.boot
spring-boot-starter-test
test
org.hibernate
hibernate-validator
org.apache.commons
commons-lang3
3.5
org.apache.commons
commons-vfs2
2.1
com.jcraft
jsch
0.1.54
org.apache.poi
poi
5.2.5
org.apache.poi
poi-ooxml
5.2.5
commons-io
commons-io
2.15.1
com.github.dragon66
icafe
1.1
system
${project.basedir}/lib/icafe-1.1.jar
com.oracle.jdbc
ojdbc8
12.2.0.1
system
${project.basedir}/lib/ojdbc8-19.8.0.0.jar
org.apache.pdfbox
pdfbox
2.0.30
com.itextpdf
layout
8.0.2
com.itextpdf
itext-core
8.0.2
pom
com.github.jai-imageio
jai-imageio-core
1.3.1
com.itextpdf
itextpdf
5.5.13.1
org.apache.logging.log4j
log4j-api
org.springframework.boot
spring-boot-maven-plugin
true
org.springframework.boot
spring-boot-maven-plugin
2.7.5
repackage
${url.git}
scm:git:${url.git}
scm:git:${url.git}
HEAD
nexus-releases
nexus releases
${url.repository}maven-releases
nexus-snapshots
nexus snapshots
${url.repository}maven-snapshots
Подробнее здесь: https://stackoverflow.com/questions/790 ... y-with-jar