How to Solve Error Message Failure to find com.lowagie:itext:pom:2.1.7.js6 when building and compiling Java Project in Netbeans IDE

Posted on

Introduction

This is an article where the main focus is discussing about how to solve an error message appear. It appears when the execution process for building and compiling a certain project of Java-based application program occurs. The process for building and compiling process is in a Java-based IDE called Netbeans IDE. The error appears as an output of the building and compiling process as follows :

cd C:\apps; "JAVA_HOME=C:\\Program Files\\Java\\jdk1.8.0_111" M2_HOME=C:\\apache-maven-3.6.3 cmd /c "\"\"C:\\apache-maven-3.6.3\\bin\\mvn.cmd\" -Dmaven.ext.class.path=\"C:\\Program Files\\NetBeans 8.2\\java\\maven-nblib\\netbeans-eventspy.jar\" clean install\""
Scanning for projects...

---------------------< com.github.adminfaces:apps >---------------------
Building apps 0.1-SNAPSHOT
--------------------------------[ war ]---------------------------------
Downloading from snapshots: https://oss.sonatype.org/content/repositories/snapshots/com/lowagie/itext/2.1.7.js6/itext-2.1.7.js6.pom
Downloading from prime-repo: http://repository.primefaces.org/com/lowagie/itext/2.1.7.js6/itext-2.1.7.js6.pom
Downloading from central: https://repo.maven.apache.org/maven2/com/lowagie/itext/2.1.7.js6/itext-2.1.7.js6.pom
Downloading from jaspersoft-third-party: http://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts/com/lowagie/itext/2.1.7.js6/itext-2.1.7.js6.pom
Downloading from jr-ce-releases: http://jaspersoft.jfrog.io/jaspersoft/jr-ce-releases/com/lowagie/itext/2.1.7.js6/itext-2.1.7.js6.pom
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 6.426 s
Finished at: 2021-07-22T07:19:56+07:00
------------------------------------------------------------------------
Failed to execute goal on project apps: Could not resolve dependencies for project com.github.adminfaces:apps:war:0.1-SNAPSHOT: Failed to collect dependencies at net.sf.jasperreports:jasperreports:jar:6.9.0 -> com.lowagie:itext:jar:2.1.7.js6: Failed to read artifact descriptor for com.lowagie:itext:jar:2.1.7.js6: Could not transfer artifact com.lowagie:itext:pom:2.1.7.js6 from/to jaspersoft-third-party (http://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts/): Transfer failed for http://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts/com/lowagie/itext/2.1.7.js6/itext-2.1.7.js6.pom 308 Permanent Redirect -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

Actually, the focus of the error message exist in the last line of the output building and compiling process execution as follows :

Failed to execute goal on project apps: Could not resolve dependencies for project com.github.adminfaces:apps:war:0.1-SNAPSHOT: Failed to collect dependencies at net.sf.jasperreports:jasperreports:jar:6.9.0 -> com.lowagie:itext:jar:2.1.7.js6: Failed to read artifact descriptor for com.lowagie:itext:jar:2.1.7.js6: Could not transfer artifact com.lowagie:itext:pom:2.1.7.js6 from/to jaspersoft-third-party (http://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts/): Transfer failed for http://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts/com/lowagie/itext/2.1.7.js6/itext-2.1.7.js6.pom 308 Permanent Redirect -> [Help 1]

Upon building and compiling the project, it cannot find the jar file with the name of com.lowagie.itext.jar with the version of 2.1.7.js6 from the package dependency definition of  net.sf.jasperreports.jasperreports.jar with the version of 6.9.0. The error message is very clear exist in the following lines :

net.sf.jasperreports:jasperreports:jar:6.9.0 -> com.lowagie:itext:jar:2.1.7.js6: 

Failed to read artifact descriptor for com.lowagie:itext:jar:2.1.7.js6: 

Could not transfer artifact com.lowagie:itext:pom:2.1.7.js6 from/to jaspersoft-third-party 

(http://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts/): 

Transfer failed for http://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts/com/lowagie/itext/2.1.7.js6/itext-2.1.7.js6.pom 308 Permanent Redirect -> [Help 1] 

The cause of the appearance of the error message is because of the following pom.xml file definition after searching thoroughly :

<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>6.9.0</version>
</dependency>

Solution :

So, what is the way to solve the problem as exist in the introduction part ?. The solution is basically easy. The jar file or the package file with the name of com.lowagie.itext.jar with the version of 2.1.7.js6 is already exist in other repository.  The information is available in the output of the building and compiling process above :

Downloading from snapshots: https://oss.sonatype.org/content/repositories/snapshots/com/lowagie/itext/2.1.7.js6/itext-2.1.7.js6.pom 
Downloading from prime-repo: http://repository.primefaces.org/com/lowagie/itext/2.1.7.js6/itext-2.1.7.js6.pom 
Downloading from central: https://repo.maven.apache.org/maven2/com/lowagie/itext/2.1.7.js6/itext-2.1.7.js6.pom

But as soon as it is trying to download it from another repository which is associated with net.sf.jasperreports, it ends in failure. The failure exist in the following line :

Downloading from jaspersoft-third-party: http://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts/com/lowagie/itext/2.1.7.js6/itext-2.1.7.js6.pom
Downloading from jr-ce-releases: http://jaspersoft.jfrog.io/jaspersoft/jr-ce-releases/com/lowagie/itext/2.1.7.js6/itext-2.1.7.js6.pom

So, in order to prevent it from downloading the itext-2.1.7.js6 pom file definition from the jasperreports repository, just excluded it by adding the following definition to the pom.xml file :

<exclusions>
<exclusion>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
</exclusion>
</exclusions>

Just insert it in the jasperreports package definition. The full definition of the jasperreports package will be like the following :

<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>6.9.0</version>
<exclusions>
<exclusion>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
</exclusion>
</exclusions>
</dependency>

Finally, after editing the pom.xml file, just compile and build the project again once more. If there is no more error appear, the compile and build project will end in a success.

Leave a Reply