Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 634
user2963481 Avatar asked Apr 26 '14 11:04

user2963481


5 Answers

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
    
like image 54
Vinay Rao Avatar answered Nov 17 '22 01:11

Vinay Rao


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.

like image 29
Somum Avatar answered Nov 17 '22 00:11

Somum


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..

like image 6
Ketul patel Avatar answered Nov 17 '22 00:11

Ketul patel


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

like image 5
Niklas Schlimm Avatar answered Nov 17 '22 00:11

Niklas Schlimm


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.

like image 4
Makarand Avatar answered Nov 17 '22 01:11

Makarand