Выполнение файла jar: java .lang.illegalargumentexception в meta-inf / spring.factories не найдены классы автоматической конфигурации - PullRequest
0 голосов
/ 06 августа 2020

Мой проект отлично работает, когда я запускаю его в Intellij IDEA. Я создал банку с intellij и изменил каталог MANIFEST.MF с java на ресурсы, но когда я его запускаю:

java -jar window-projectNew.jar

Возникает ошибка:

java.lang.illegalargumentexception no auto configuration classes found in meta-inf/spring.factories

Вот полный журнал:

Microsoft Windows [Version 6.3.9600]
(c) Корпорация Майкрософт (Microsoft Corporation), 2013. Все права защищены.

C:\Users\UserOld.Laptop>cd C:\Users\UserOld.Laptop\Desktop\фото

C:\Users\UserOld.Laptop\Desktop\фото>java -cp window-projectNew.jar com.eurodesi
gn.windowproject.WindowProjectApplication
14:13:30.014 [main] DEBUG org.springframework.web.context.support.StandardServle
tEnvironment - Activating profiles []

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

14:13:30.217 [main] INFO com.eurodesign.windowproject.WindowProjectApplication -
 Starting WindowProjectApplication on Laptop with PID 2316 (C:\Users\UserOld.Lap
top\Desktop\ЇюЄю\window-projectNew.jar started by UserOld in C:\Users\UserOld.La
ptop\Desktop\ЇюЄю)
14:13:30.217 [main] DEBUG com.eurodesign.windowproject.WindowProjectApplication
- Running with Spring Boot, Spring
14:13:30.217 [main] INFO com.eurodesign.windowproject.WindowProjectApplication -
 No active profile set, falling back to default profiles: default
14:13:30.217 [main] DEBUG org.springframework.boot.SpringApplication - Loading s
ource class com.eurodesign.windowproject.WindowProjectApplication
14:13:30.310 [main] DEBUG org.springframework.boot.web.servlet.context.Annotatio
nConfigServletWebServerApplicationContext - Refreshing org.springframework.boot.
web.servlet.context.AnnotationConfigServletWebServerApplicationContext@158a8276
14:13:30.326 [main] DEBUG org.springframework.beans.factory.support.DefaultLista
bleBeanFactory - Creating shared instance of singleton bean 'org.springframework
.context.annotation.internalConfigurationAnnotationProcessor'
14:13:30.404 [main] DEBUG org.springframework.context.annotation.ClassPathBeanDe
finitionScanner - Identified candidate component class: URL [jar:file:/C:/Users/
UserOld.Laptop/Desktop/%d1%84%d0%be%d1%82%d0%be/window-projectNew.jar!/com/eurod
esign/windowproject/config/WebSecurityConfig.class]
14:13:30.435 [main] DEBUG org.springframework.context.annotation.ClassPathBeanDe
finitionScanner - Identified candidate component class: URL [jar:file:/C:/Users/
UserOld.Laptop/Desktop/%d1%84%d0%be%d1%82%d0%be/window-projectNew.jar!/com/eurod
esign/windowproject/controller/AdminPageController.class]
14:13:30.435 [main] DEBUG org.springframework.context.annotation.ClassPathBeanDe
finitionScanner - Identified candidate component class: URL [jar:file:/C:/Users/
UserOld.Laptop/Desktop/%d1%84%d0%be%d1%82%d0%be/window-projectNew.jar!/com/eurod
esign/windowproject/controller/HomePageController.class]
14:13:30.435 [main] DEBUG org.springframework.context.annotation.ClassPathBeanDe
finitionScanner - Ignored because not a concrete top-level class: URL [jar:file:
/C:/Users/UserOld.Laptop/Desktop/%d1%84%d0%be%d1%82%d0%be/window-projectNew.jar!
/com/eurodesign/windowproject/dao/CallMeFormRepository.class]
14:13:30.435 [main] DEBUG org.springframework.context.annotation.ClassPathBeanDe
finitionScanner - Ignored because not a concrete top-level class: URL [jar:file:
/C:/Users/UserOld.Laptop/Desktop/%d1%84%d0%be%d1%82%d0%be/window-projectNew.jar!
/com/eurodesign/windowproject/dao/FeedbackApprovedRepository.class]
14:13:30.435 [main] DEBUG org.springframework.context.annotation.ClassPathBeanDe
finitionScanner - Ignored because not a concrete top-level class: URL [jar:file:
/C:/Users/UserOld.Laptop/Desktop/%d1%84%d0%be%d1%82%d0%be/window-projectNew.jar!
/com/eurodesign/windowproject/dao/FeedbackRepository.class]
14:13:30.451 [main] DEBUG org.springframework.context.annotation.ClassPathBeanDe
finitionScanner - Ignored because not a concrete top-level class: URL [jar:file:
/C:/Users/UserOld.Laptop/Desktop/%d1%84%d0%be%d1%82%d0%be/window-projectNew.jar!
/com/eurodesign/windowproject/dao/WorkDoneRepository.class]
14:13:30.451 [main] DEBUG org.springframework.context.annotation.ClassPathBeanDe
finitionScanner - Identified candidate component class: URL [jar:file:/C:/Users/
UserOld.Laptop/Desktop/%d1%84%d0%be%d1%82%d0%be/window-projectNew.jar!/com/eurod
esign/windowproject/mailSender/MailConfig.class]
14:13:30.451 [main] DEBUG org.springframework.context.annotation.ClassPathBeanDe
finitionScanner - Identified candidate component class: URL [jar:file:/C:/Users/
UserOld.Laptop/Desktop/%d1%84%d0%be%d1%82%d0%be/window-projectNew.jar!/com/eurod
esign/windowproject/service/CallMeFormService.class]
14:13:30.467 [main] DEBUG org.springframework.context.annotation.ClassPathBeanDe
finitionScanner - Identified candidate component class: URL [jar:file:/C:/Users/
UserOld.Laptop/Desktop/%d1%84%d0%be%d1%82%d0%be/window-projectNew.jar!/com/eurod
esign/windowproject/service/FeedbackApprovedService.class]
14:13:30.467 [main] DEBUG org.springframework.context.annotation.ClassPathBeanDe
finitionScanner - Identified candidate component class: URL [jar:file:/C:/Users/
UserOld.Laptop/Desktop/%d1%84%d0%be%d1%82%d0%be/window-projectNew.jar!/com/eurod
esign/windowproject/service/FeedbackService.class]
14:13:30.467 [main] DEBUG org.springframework.context.annotation.ClassPathBeanDe
finitionScanner - Identified candidate component class: URL [jar:file:/C:/Users/
UserOld.Laptop/Desktop/%d1%84%d0%be%d1%82%d0%be/window-projectNew.jar!/com/eurod
esign/windowproject/service/WorkDoneService.class]
14:13:30.514 [main] ERROR org.springframework.boot.SpringApplication - Applicati
on run failed
java.lang.IllegalArgumentException: No auto configuration classes found in META-
INF/spring.factories. If you are using a custom packaging, make sure that file i
s correct.
        at org.springframework.util.Assert.notEmpty(Assert.java:467)
        at org.springframework.boot.autoconfigure.AutoConfigurationImportSelecto
r.getCandidateConfigurations(AutoConfigurationImportSelector.java:180)
        at org.springframework.boot.autoconfigure.AutoConfigurationImportSelecto
r.getAutoConfigurationEntry(AutoConfigurationImportSelector.java:123)
        at org.springframework.boot.autoconfigure.AutoConfigurationImportSelecto
r$AutoConfigurationGroup.process(AutoConfigurationImportSelector.java:434)
        at org.springframework.context.annotation.ConfigurationClassParser$Defer
redImportSelectorGrouping.getImports(ConfigurationClassParser.java:878)
        at org.springframework.context.annotation.ConfigurationClassParser$Defer
redImportSelectorGroupingHandler.processGroupImports(ConfigurationClassParser.ja
va:808)
        at org.springframework.context.annotation.ConfigurationClassParser$Defer
redImportSelectorHandler.process(ConfigurationClassParser.java:779)
        at org.springframework.context.annotation.ConfigurationClassParser.parse
(ConfigurationClassParser.java:192)
        at org.springframework.context.annotation.ConfigurationClassPostProcesso
r.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:319)
        at org.springframework.context.annotation.ConfigurationClassPostProcesso
r.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:236)
        at org.springframework.context.support.PostProcessorRegistrationDelegate
.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.ja
va:280)
        at org.springframework.context.support.PostProcessorRegistrationDelegate
.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:96)
        at org.springframework.context.support.AbstractApplicationContext.invoke
BeanFactoryPostProcessors(AbstractApplicationContext.java:707)
        at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:533)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicat
ionContext.refresh(ServletWebServerApplicationContext.java:143)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.
java:758)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.
java:750)
        at org.springframework.boot.SpringApplication.refreshContext(SpringAppli
cation.java:397)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java
:315)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java
:1237)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java
:1226)
        at com.eurodesign.windowproject.WindowProjectApplication.main(WindowProj
ectApplication.java:10)
14:13:30.529 [main] DEBUG org.springframework.boot.web.servlet.context.Annotatio
nConfigServletWebServerApplicationContext - Closing org.springframework.boot.web
.servlet.context.AnnotationConfigServletWebServerApplicationContext@158a8276, st
arted on Thu Aug 06 14:13:30 MSK 2020

Я пробовал это решение из аналогичного вопроса. Произошла ошибка теста, я пропустил тест, и он был экспортирован в папку / target. Но даже после этого программа не запускалась вне Intellij

Вот мой пом. xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.2.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.eurodesign</groupId>
    <artifactId>window-project</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>window-project</name>
    <description>A project</description>

    <properties>
        <java.version>11</java.version>
        <start-class>com.eurodesign.windowproject.WindowProjectApplication</start-class>
    </properties>

    <dependencies>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.1</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
            <version>2.2.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.thymeleaf.extras</groupId>
            <artifactId>thymeleaf-extras-springsecurity5</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </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>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

В чем моя ошибка? Спасибо!

1 Ответ

0 голосов
/ 13 августа 2020

Наконец-то мне удалось решить свою проблему. По какой-то причине intellije не может правильно сгенерировать файл jar, но когда я сгенерировал jar с maven, проблема исчезла

...