Пример проекта, выбрасывающего NoClassDefFoundError: com / fastxml / jackson / databind / ObjectMapper - PullRequest
0 голосов
/ 29 мая 2019

Я реализовал проект согласно https://spring.io/guides/gs/batch-processing/

Но я получаю:

Ошибка создания компонента с именем 'batchConfigurer': сбой вызова метода init;Вложенное исключение - java.lang.NoClassDefFoundError: com / fastxml / jackson / databind / ObjectMapper

Я новичок в Spring-Batch. Может кто-нибудь помочь, пожалуйста

Ответы [ 2 ]

0 голосов
/ 30 мая 2019

2 банки были повреждены, привязка данных Джексона и log4.

Хотя ошибка чистой установки mvn была (invalid LOC header bad signature) в журналах, но сборка проходила успешно, поэтому я пропустил журналы.

Мне пришлось удалить папку из .m2, а затем запустить mvn clean installэто решило проблему

0 голосов
/ 30 мая 2019

Следующее работает как положено:

$>git clone https://github.com/spring-guides/gs-batch-processing.git
$>cd gs-batch-processing/complete
$>./mvnw clean install
$>./mvnw spring-boot:run

Вывод следующий:

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.4.RELEASE)

2019-05-30 12:23:12.642  INFO 90644 --- [           main] hello.Application                        : Starting Application on localhost with PID 90644 (/private/tmp/gs-batch-processing/complete/target/classes started by mbenhassine in /private/tmp/gs-batch-processing/complete)
2019-05-30 12:23:12.646  INFO 90644 --- [           main] hello.Application                        : No active profile set, falling back to default profiles: default
2019-05-30 12:23:13.333  INFO 90644 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2019-05-30 12:23:13.338  WARN 90644 --- [           main] com.zaxxer.hikari.util.DriverDataSource  : Registered driver with driverClassName=org.hsqldb.jdbcDriver was not found, trying direct instantiation.
2019-05-30 12:23:13.683  INFO 90644 --- [           main] com.zaxxer.hikari.pool.PoolBase          : HikariPool-1 - Driver does not support get/set network timeout for connections. (feature not supported)
2019-05-30 12:23:13.687  INFO 90644 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2019-05-30 12:23:14.091  INFO 90644 --- [           main] o.s.b.c.r.s.JobRepositoryFactoryBean     : No database type set, using meta data indicating: HSQL
2019-05-30 12:23:14.277  INFO 90644 --- [           main] o.s.b.c.l.support.SimpleJobLauncher      : No TaskExecutor has been set, defaulting to synchronous executor.
2019-05-30 12:23:14.437  INFO 90644 --- [           main] hello.Application                        : Started Application in 2.114 seconds (JVM running for 5.2)
2019-05-30 12:23:14.438  INFO 90644 --- [           main] o.s.b.a.b.JobLauncherCommandLineRunner   : Running default command line with: []
2019-05-30 12:23:14.503  INFO 90644 --- [           main] o.s.b.c.l.support.SimpleJobLauncher      : Job: [FlowJob: [name=importUserJob]] launched with the following parameters: [{run.id=1}]
2019-05-30 12:23:14.530  INFO 90644 --- [           main] o.s.batch.core.job.SimpleStepHandler     : Executing step: [step1]
2019-05-30 12:23:14.590  INFO 90644 --- [           main] hello.PersonItemProcessor                : Converting (firstName: Jill, lastName: Doe) into (firstName: JILL, lastName: DOE)
2019-05-30 12:23:14.590  INFO 90644 --- [           main] hello.PersonItemProcessor                : Converting (firstName: Joe, lastName: Doe) into (firstName: JOE, lastName: DOE)
2019-05-30 12:23:14.590  INFO 90644 --- [           main] hello.PersonItemProcessor                : Converting (firstName: Justin, lastName: Doe) into (firstName: JUSTIN, lastName: DOE)
2019-05-30 12:23:14.590  INFO 90644 --- [           main] hello.PersonItemProcessor                : Converting (firstName: Jane, lastName: Doe) into (firstName: JANE, lastName: DOE)
2019-05-30 12:23:14.590  INFO 90644 --- [           main] hello.PersonItemProcessor                : Converting (firstName: John, lastName: Doe) into (firstName: JOHN, lastName: DOE)
2019-05-30 12:23:14.604  INFO 90644 --- [           main] hello.JobCompletionNotificationListener  : !!! JOB FINISHED! Time to verify the results
2019-05-30 12:23:14.607  INFO 90644 --- [           main] hello.JobCompletionNotificationListener  : Found <firstName: JILL, lastName: DOE> in the database.
2019-05-30 12:23:14.607  INFO 90644 --- [           main] hello.JobCompletionNotificationListener  : Found <firstName: JOE, lastName: DOE> in the database.
2019-05-30 12:23:14.607  INFO 90644 --- [           main] hello.JobCompletionNotificationListener  : Found <firstName: JUSTIN, lastName: DOE> in the database.
2019-05-30 12:23:14.607  INFO 90644 --- [           main] hello.JobCompletionNotificationListener  : Found <firstName: JANE, lastName: DOE> in the database.
2019-05-30 12:23:14.607  INFO 90644 --- [           main] hello.JobCompletionNotificationListener  : Found <firstName: JOHN, lastName: DOE> in the database.
2019-05-30 12:23:14.610  INFO 90644 --- [           main] o.s.b.c.l.support.SimpleJobLauncher      : Job: [FlowJob: [name=importUserJob]] completed with the following parameters: [{run.id=1}] and the following status: [COMPLETED]

Как видите, NoClassDefFoundError.

нет
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...