Eclipse maven error: Archive for the required library in the project cannot be read or is not a valid ZIP file

In an eclipse maven project using spring web mvc, the following error appears on the Markers tab:

Archive for required library: 'D:/mypath/.m2/repository/javax/transaction/jta/1.0.1B/jta-1.0.1B.jar' in project 'DocumentManager' cannot be read or is not a valid ZIP file 

I checked and the jar file is actually present in the specified url. I even copied the jar backup to overwrite the jar file in this place, but this also did not get rid of this error. I forced maven to update, which did not solve the problem. I also launched eclipse again.

At one point, jta-1.0.1B.jar was jta-1.0.1B.jar.LatestUpdate, so I shortened the name to jta-1.0.1B.jar

In pom.xml, the location of the error message is line 2, which looks like this:

 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 

When I load jta-1.0.1B.jar manually from this URL , the error in pom.xml goes away, but is replaced with new errors in the .java files, indicating that 5 methods of the Document class are not valid.

I read this and this , but I do not use struts, I already include 3.3. 2.ga sleep mode, and I donโ€™t have a repository tag in pom.xml (which this one said it didnโ€™t even solve the problem), so I donโ€™t think it is a duplicate.

Can anyone suggest a way to fix this problem? If I need a repository tag, where to put it? And what else can I change to accommodate?

For anyone curious, my pom.xml is included for reference as follows:

 <?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <packaging>war</packaging> <version>0.0.1-SNAPSHOT</version> <description></description> <build> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> <plugin> <artifactId>maven-war-plugin</artifactId> <version>2.0.1</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>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>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>3.3.2.GA</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>1.5.4</version> </dependency> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.2.1</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>1.3</version> </dependency> <!-- dependency to fix JSPServletException --> <dependency> <groupId>org.apache.tomcat</groupId> <artifactId>jsp-api</artifactId> <version>6.0.32</version> <scope>provided</scope> </dependency> </dependencies> <properties> <org.springframework.version>3.2.4.RELEASE</org.springframework.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <groupId>DocumentManager</groupId> <artifactId>DocumentManager</artifactId> </project> 
+7
java spring eclipse maven hibernate
source share
7 answers

To fix such issues, let Maven download the files again:

  • Delete folder D:/mypath/.m2/repository/javax/transaction/jta
  • Launch Maven with -U to try broken downloads again.

This should try to download the file again and clear any "residue" in your local repository.

If Eclipse is still complaining about file JAR corruption:

  • Update your project ( F5 or from the context menu)
  • Clear project
  • Try to open the JAR file. Perhaps this is really messed up.

If the JAR file is damaged, delete the folder again and run Maven again. Pay attention to the URLs Maven used to download the archive, and contact the administrator of this site.

+12
source share

You must exclude JTA depending on sleep mode.

 <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate</artifactId> <version>3.2.3.ga</version> <exclusions> <exclusion> <artifactId>javax.transaction</artifactId> <groupId>jta</groupId> </exclusion> </exclusions> </dependency> 

After that add jta dependency.

 <dependency> <groupId>javax.transaction</groupId> <artifactId>jta</artifactId> <version>1.1</version> </dependency> 
+1
source share

The problem with me was fixed by going to Build Path-> Configure Build Path-> Libraries-> Remove the jta lib , which has a small cross mark on it.

I managed to successfully create my project, but got this error even after the Refresh / Project Clean project.

+1
source share

You can manually go to the repository specified in the error console i.e. Archive for required library: '**D:/mypath/.m2/repository/javax/transaction/jta/1.0.1B/jta-1.0.1B.jar**' in project 'DocumentManager' cannot be read or is not a valid ZIP file

Delete the mentioned JAR

Go to eclipse, right click on the project and select as-> maven-install command. It will load the right jar file.

+1
source share

The maven central repository does not contain a jar file for this groupId / artifactId only pom.xml .

maven central results

You are using Spring 3.2, so I suggest you just upgrade hibernate to the latest version (4.2.6.Final), which should have a link to jta 1.1. Or just include version 1.1 in your pom, which has a jug in the center of maven.

0
source share

To fix this problem is simple.

  • select all libraries in the "Maven Dependencies" of the corresponding project.
  • just do the "Refresh" right mouse button ...

The reason is cache information, so just update the information.

0
source share

Tried with 1.5.5 Release jar and it worked for me

 <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.5.RELEASE</version> 

https://mvnrepository.com/artifact/org.springframework.boot/ spring-boot-starter-parent / 1.5.5.RELEASE

0
source share

All Articles