My application does not start in Spring-Tools Suite

2

I created a maven project in the Spring-Tools Suite when I started to see this error:

Exception in thread "main" java.lang.IllegalStateException: Failed to read Class-Path attribute from manifest of jar file:/C:/Users/Manoel/.m2/repository/xml-apis/xml-apis/1.4.01/xml-apis-1.4.01.jar
    at org.springframework.boot.devtools.restart.ChangeableUrls.getUrlsFromClassPathOfJarManifestIfPossible(ChangeableUrls.java:102)
    at org.springframework.boot.devtools.restart.ChangeableUrls.fromUrlClassLoader(ChangeableUrls.java:88)
    at org.springframework.boot.devtools.restart.DefaultRestartInitializer.getUrls(DefaultRestartInitializer.java:93)
    at org.springframework.boot.devtools.restart.DefaultRestartInitializer.getInitialUrls(DefaultRestartInitializer.java:56)
    at org.springframework.boot.devtools.restart.Restarter.<init>(Restarter.java:139)
    at org.springframework.boot.devtools.restart.Restarter.initialize(Restarter.java:539)
    at org.springframework.boot.devtools.restart.RestartApplicationListener.onApplicationStartedEvent(RestartApplicationListener.java:68)
    at org.springframework.boot.devtools.restart.RestartApplicationListener.onApplicationEvent(RestartApplicationListener.java:45)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122)
    at org.springframework.boot.context.event.EventPublishingRunListener.started(EventPublishingRunListener.java:67)
    at org.springframework.boot.SpringApplicationRunListeners.started(SpringApplicationRunListeners.java:48)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:305)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1187)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1176)
    at com.algaworks.vinhos.AwVinhosApplication.main(AwVinhosApplication.java:10)
Caused by: java.util.zip.ZipException: invalid LOC header (bad signature)
    at java.util.zip.ZipFile.read(Native Method)
    at java.util.zip.ZipFile.access$1400(Unknown Source)
    at java.util.zip.ZipFile$ZipFileInputStream.read(Unknown Source)
    at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(Unknown Source)
    at java.util.zip.InflaterInputStream.read(Unknown Source)
    at sun.misc.IOUtils.readFully(Unknown Source)
    at java.util.jar.JarFile.getBytes(Unknown Source)
    at java.util.jar.JarFile.getManifestFromReference(Unknown Source)
    at java.util.jar.JarFile.getManifest(Unknown Source)
    at org.springframework.boot.devtools.restart.ChangeableUrls.getUrlsFromClassPathOfJarManifestIfPossible(ChangeableUrls.java:99)
    ... 16 more

Follow the class AwVinhosApplication

package com.algaworks.vinhos;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication 
public class AwVinhosApplication {

    public static void main(String[] args) {
        SpringApplication.run(AwVinhosApplication.class, args);
    } 
}   
    
asked by anonymous 03.02.2017 / 15:02

2 answers

5
Caused by: java.util.zip.ZipException: invalid LOC header (bad signature)
    at java.util.zip.ZipFile.read(Native Method)

It usually means that one or more jars are corrupted.

Maven, by default, downloads and stores these jars in the ~/.m2/repository/* folder. To solve the problem, delete the contents of the folder and run mvn clean install again.

Note: In Windows the .m2 folder by default is invisible. To find it, assuming default settings in Maven, open your file manager and navigate to your user's folder (e.g., C:\User\MeuUsuario ). Even though the .m2 folder is not visible you can navigate to it by typing the path (e.g., C:\User\MeuUsuario\.m2\repository ).

Font : SOen - Maven invalid LOC header (bad signature)

    
03.02.2017 / 18:02
0

I had this same problem with this Algawoks project. I solved by changing the version of Hibernate in pom.xml It was so after the changes.         org.springframework.boot         spring-boot-starter-parent         1.5.3.RELEASE               

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>

    io.jsonwebtoken     jjwt     0.7.0                      org.springframework.boot             spring-boot-starter-data-jpa                               org.springframework.boot             spring-boot-starter-thymeleaf                     org.postgresql       postgresql

</dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
        <scope>provided</scope>
    </dependency>
            <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

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

    
19.09.2017 / 04:54