我在Windows上的STS上制作了java-batch,并将jar(由maven install制作)和属性文件传输到CentOS(ver,7)。 执行时,发生错误。日志如下: 注意 BBBB01是程序名称。
有人可以帮助我......!
<div id='content'>
<div id='menu'>menu</div>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi interdum porttitor accumsan. Aliquam at egestas lacus, sed ultrices dui.</p>
</div>
==================== 我认为音乐会信息如下所示:
** src / main / resources上的2个属性文件。 1)batch.properties 2)log4j.properties
在CentOS上放置与jar文件相同的目录。
1)包括HSQLDB的常规设置(如下)和指定的程序。
YYYY-MM-DD 13:49:33,413 ERROR CommandLineJobRunner - Job Terminated in error: Error creating bean with name 'BBBB01Configuration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.batch.core.repository.JobRepository com.batch.xxxxx.BBBB01Configuration.jobRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobRepository': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Could not get Connection for extracting meta data; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class '${batch.jdbc.driver}'
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'BBBB01Configuration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.batch.core.repository.JobRepository com.batch.cilabo.BBBB01Configuration.jobRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobRepository': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Could not get Connection for extracting meta data; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class '${batch.jdbc.driver}'
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
**发射-context.xml中
# Placeholders batch.*
# for HSQLDB:
batch.jdbc.driver=org.hsqldb.jdbcDriver
batch.jdbc.url=jdbc:hsqldb:mem:testdb;sql.enforce_strict_size=true
# use this one for a separate server process so you can inspect the results
# (or add it to system properties with -D to override at run time).
# batch.jdbc.url=jdbc:hsqldb:hsql://localhost:9005/samples
batch.jdbc.user=sa
batch.jdbc.password=
batch.schema=
batch.schema.script=classpath:/org/springframework/batch/core/schema-hsqldb.sql
...
** Manifest.MF由maven-shade-plugin制作。
<beans ...>
<context:property-placeholder order="1" location="classpath:batch.properties" />
<context:property-placeholder order="2" location="classpath:log4j.properties" />
<context:annotation-config/>
<context:component-scan base-package="com.batch.XXXXXX" />
<jdbc:initialize-database data-source="dataSource">
<jdbc:script location="${batch.schema.script}" />
</jdbc:initialize-database>
<batch:job-repository id="jobRepository" />
<import resource="classpath:/META-INF/spring/module-context.xml" />
** POM.xml的部分内容 *属性
Manifest-Version: 1.0
Package: com.batch.XXXXXX
Build-Number: 1
Archiver-Version: Plexus Archiver
Built-By: xxxxxxxxx
Class-Path: ./
Created-By: Apache Maven 3.3.9
Build-Jdk: 1.8.0_102
Main-Class: org.springframework.batch.core.launch.support.CommandLineJ
obRunner
*构建
<properties>
<maven.test.failure.ignore>true</maven.test.failure.ignore>
<spring.framework.version>3.0.6.RELEASE</spring.framework.version>
<spring.batch.version>2.1.7.RELEASE</spring.batch.version>
<configFileBatch>batch.properties</configFileBatch>
<configFilelog4j>log4j.properties</configFilelog4j>
</properties>
提前谢谢。