hibernate-commons-annotations-4.0.1.Final.jar; invalid LOC header (bad signature)?
Asked Answered
M

12

45

I am new for Maven ..I am trying to create maven project for springMVC+Hiberante but I am getting lot of errors..can any one slove my problem please check my pom.xml for below

<?xml version="1.0" encoding="UTF-8"?><project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>Spring3HibernateMaven</groupId>
    <artifactId>Spring3HibernateMaven</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <description></description>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>

                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>

            <!--  <plugin>
               <artifactId>maven-war-plugin</artifactId>
               <version>2.0</version>

             </plugin> -->
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>4.1.9.Final</version>
        </dependency>

        <dependency>
            <groupId>taglibs</groupId>
            <artifactId>standard</artifactId>
            <version>1.1.2</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.1.2</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.10</version>
        </dependency>
        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>20030825.184428</version>
        </dependency>
        <dependency>
            <groupId>commons-pool</groupId>
            <artifactId>commons-pool</artifactId>
            <version>20030825.183949</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.5</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.6.4</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.5</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-annotations</artifactId>
            <version>3.4.0.GA</version>
        </dependency>

    </dependencies>
    <properties>
        <org.springframework.version>3.0.2.RELEASE</org.springframework.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
</project>

but I am getting the following errors

[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project Spring3HibernateMaven: Compilation failure: Compilation failure:
[ERROR] error: error reading C:\Users\Bhanu\.m2\repository\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar; invalid LOC header (bad signature)
[ERROR] error: error reading C:\Users\Bhanu\.m2\repository\org\hibernate\hibernate-core\4.1.9.Final\hibernate-core-4.1.9.Final.jar; invalid LOC header (bad signature)
[ERROR] error: error reading C:\Users\Bhanu\.m2\repository\antlr\antlr\2.7.7\antlr-2.7.7.jar; invalid LOC header (bad signature)
[ERROR] error: error reading C:\Users\Bhanu\.m2\repository\org\jboss\logging\jboss-logging\3.1.0.GA\jboss-logging-3.1.0.GA.jar; invalid LOC header (bad signature)
[ERROR] error: error reading C:\Users\Bhanu\.m2\repository\dom4j\dom4j\1.6.1\dom4j-1.6.1.jar; invalid LOC header (bad signature)
[ERROR] error: error reading C:\Users\Bhanu\.m2\repository\org\hibernate\javax\persistence\hibernate-jpa-2.0-api\1.0.1.Final\hibernate-jpa-2.0-api-1.0.1.Final.jar; invalid LOC header (bad signature)
[ERROR] error: error reading C:\Users\Bhanu\.m2\repository\org\hibernate\common\hibernate-commons-annotations\4.0.1.Final\hibernate-commons-annotations-4.0.1.Final.jar; invalid LOC header (bad signature)
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Can Any one help me how to resolve my problem . I am using apache-maven-3.2.1 +Java1.6+ecpliseIndigo

Morceau answered 26/4, 2014 at 11:53 Comment(0)
C
88

This looks like a problem of corrupt jars being downloaded. I have seen this happen only when I use eclipse. Here's what I did to get rid of this problem:

  • Delete contents from C:\Users\Bhanu.m2\repository. Either everything or selectively - your choice.
  • Then use the command prompt to force download jars and build

    mvn clean install
    
Comminute answered 16/5, 2014 at 17:56 Comment(3)
just deleting the one problematic descendant child folder in the .m2 repo and forcing an Update Project (in my case with Force update snapshots) did the trickRillet
Thanks to you I solved a similar (invalid LOC header) problem by deleting all subfolders of "repository\org\springframework\data\spring-data-jpa\.." and then running "mvn clean install -U" afterwards. However I still had to include and export Maven Dependencies into Eclipse Build PathSecunda
I logged in just to say give the thumbs up for this advice. It worked for me. ThanksSinglephase
A
7

I will tell you what I did

I was getting the same error in common-logging so I went to C:\Users\admin.m2\repository\commons-logging and deleted the directory. The problem was solved next time I compiled.

Audet answered 13/7, 2016 at 11:12 Comment(0)
H
6

It Throw Because your hibernate-commons-annotations-4.0.1.Final.jar is Invalid Or Corrupted.

Follow the Steps:

Note : .m2 Folder is Hidden by Default. UnHide the Folder.

Step 1:Delete all the Content in .m2/repository Folder.

Step 2:Restart Your Eclipse.

Step 3:Maven->Update Project .Checked- Force Update of Snapshots/Releases.

Step 4:Run as Maven Clean.

Step 5:Run as Maven Install.

Step 6: Clean Project.

Step 7 : Run Your Project.

I Hope you Find your Solution Here..

Thanks..

Humility answered 24/8, 2016 at 5:50 Comment(0)
N
5

The reason is a corrupt jar file. Use mvn dependency:purge-local-repository to delete und reload your dependencies in your local maven repository.

Neuman answered 12/6, 2017 at 18:32 Comment(0)
S
4

I know this is an old thread, but I have faced the same problem (albeit with a different jar file).

In eclipse, when a maven build fails because of corrupt LOC header, a warning is generated (in my case it was spring-tx-3.0.3.RELEASE.pom but could be any other maven dependancy).

Go up in build stack-trace and figure out which JAR is failing, delete the corresponding repo folder from .m2 repositories and rebuild, that should do the trick.

Sardius answered 22/8, 2016 at 18:22 Comment(0)
N
3

It is important to remember that what is invalid is useless (e.g. corrupted), so:

  • Delete all JARs that have invalid signature. invalid means invalid.
  • Update Maven project, clean, install.
  • If you still get invalid LOC header - change repo and your ISP...

I had similar problem and it had nothing to do with revisioning or Maven itself... The problem was corrupted JAR ( Eclipse with Maven plugin does not work with latest revisions, but works with older ones).

Good luck!

Nonresistance answered 31/12, 2016 at 21:39 Comment(0)
N
2

I was getting the same error while running the mvn clean install command

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project MongoModule: Compilation failure
[ERROR] error: error reading /home/radium/.m2/repository/org/mongodb/mongo-java-driver/3.2.2/mongo-java-driver-3.2.2.jar; invalid LOC header (bad signature)
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project MongoModule: Compilation failure
error: error reading /home/radium/.m2/repository/org/mongodb/mongo-java-driver/3.2.2/mongo-java-driver-3.2.2.jar; invalid LOC header (bad signature)

Then I deleted the mongo-java-driver-3.2.2.jar file from the maven repo and re run the maven build command, which forced the maven to re download the jar and successfully build the project.

Nekton answered 6/8, 2016 at 5:32 Comment(0)
I
0

Another option is to instead of deleting the repo add a new one, update Maven settings file - <localRepository>C:\\repos\\mycustomrepo</localRepository>

This can be useful if your working between on different unrelated projects - as was my case. @Vinay Rao answer pointed me in direction of creating a custom repo.

Industrials answered 3/12, 2014 at 13:26 Comment(0)
C
0

I was getting the same problem.So I had update my maven library and it worked for me.

Cutcliffe answered 22/4, 2015 at 10:27 Comment(1)
What does "update my maven library" mean? Can you provide some instructions?Pe
H
0

Nagivate to your C:\Users\user.m2\repository\projects\project1

Pick the corresponding project and delete it from your .m2. Then f you use maven do mvn clean install otherwise build it accordingly in the terminal. it will recreate those jar files for you Reinstall the ear or war file in server and it should deploy just fine now.

It worked for me.

Headword answered 21/11, 2017 at 22:0 Comment(0)
E
0

In the above case delete the commons-logging-1.1.1.jar from .m2/repository/ folder and then just run maven-install, It will definitely be successful.

Extensile answered 19/8, 2019 at 17:9 Comment(0)
M
0

You have to remove all jars from your .m2 repository and run maven project again: if you have war already so you have to delete all jars and download again.

  • Delete contents from .m2\repository. from your directory

    mvn clean install
    
Merissameristem answered 29/8, 2019 at 9:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.