Ошибка чтения файла xlsx во вложенной исключительной ситуации весеннего пакета java.lang.verifrerror - PullRequest
0 голосов
/ 09 февраля 2019

Я пытаюсь прочитать из файла Excel и отобразить их в объект и сохранить его в базе данных, и я вручную загрузил весенний файл JAR для Excel с com.github.deanwong

<dependency>
    <groupId>com.github.deanwong</groupId>
    <artifactId>spring-batch-excel</artifactId>
    <version>0.5.5</version>
</dependency>

такво время шага 1 он встречает это исполнение

SEVERE: задание завершено с ошибкой:

Error creating bean with name 'step1': Cannot resolve reference to bean 'customerItemReader' while setting bean property 'itemReader'; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.batch.item.excel.poi.PoiItemReader] for bean with name 'customerItemReader' defined in class path resource [spring/batch/jobs/excelreader.xml]: problem with class file or dependent class; nested exception is java.lang.VerifyError: class org.springframework.batch.item.excel.AbstractExcelItemReader overrides final method org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.read()Ljava/lang/Object;
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'step1': Cannot resolve reference to bean 'customerItemReader' while setting bean property 'itemReader'; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.batch.item.excel.poi.PoiItemReader] for bean with name 'customerItemReader' defined in class path resource [spring/batch/jobs/excelreader.xml]: problem with class file or dependent class; nested exception is java.lang.VerifyError: class org.springframework.batch.item.excel.AbstractExcelItemReader overrides final method org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.read()Ljava/lang/Object;
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:329)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1393)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1134)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:608)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
        at org.springframework.batch.core.launch.support.CommandLineJobRunner.start(CommandLineJobRunner.java:284)
        at org.springframework.batch.core.launch.support.CommandLineJobRunner.main(CommandLineJobRunner.java:577)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:282)
        at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.batch.item.excel.poi.PoiItemReader] for bean with name 'customerItemReader' defined in class path resource [spring/batch/jobs/excelreader.xml]: problem with class file or dependent class; nested exception is java.lang.VerifyError: class org.springframework.batch.item.excel.AbstractExcelItemReader overrides final method org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.read()Ljava/lang/Object;
        at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1272)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:438)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
        at org.springframework.beans.factory.support.BeanDefinion

МОЙ XML-файл

<batch:job id="customerJob">
    <batch:step id="step1">
        <batch:tasklet>
            <batch:chunk reader="customerItemReader" writer="mysqlItemWriter"
                processor="customerItemProcessor" commit-interval="1000">
            </batch:chunk>
        </batch:tasklet>
    </batch:step>
</batch:job>
<bean class="com.shoppers.sales.util.ExtendPropertySourcesPlaceholderConfigurer">
<property name="overridingSource"
           value="${propertyPath}" />
</bean>
<bean id="customerItemReader" class="org.springframework.batch.item.excel.poi.PoiItemReader">
<property name="linesToSkip" value="1" />
<property name="resource" value="#{'file:'+'${upload_path}'+'${customer_file}'}" />
<property name="rowMapper">
   <bean class="org.springframework.batch.item.excel.mapping.BeanWrapperowMapper">
        <property name="targetType" value="com.shoppers.sales.job.model.Customer" />
    </bean>    
</property>
</bean>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...