1
votes

I have packaged a spring boot service using Maven "mvn package" and I am successfully able to create the jar. But when I run it from command line using below command : "java -jar \target\demo-0.0.1-SNAPSHOT.jar" I am getting below error ::

java.io.IOException:    Unable to open nested jar file 'lib/JavaPNS-jar-2.2.0.jar'
Caused by: java.io.IOException:    Unable to find ZIP central directory records after reading 65792 bytes

Above jar "JavaPNS-jar-2.2.0.jar" i am referening in my pom.xml from my local file system using below : JavaPNS JavaPNS-jar 2.2.0 in-project In Project Repo file://${project.basedir}/lib

When i run the application using "mvn spring-boot:run" command it runs fine without any error.

I have tried below options to resolve this :

  1. Cleared the local cache of Maven and then again build the application. But it does not help to resolve it.
  2. Also I tried to add the jar again to make sure that it is not corrupt.

Can someone please help me with this issue.

1
try to unzip demo-0.0.1-SNAPSHOT.jar then again unzip JavaPNS-jar-2.2.0.jar (from the 1st step result) and see if you can unzip it. - TLJ
Tried the same but doesn't help. - Pushpendra Pal
When i run the application using "mvn spring-booot:run" command, it comes up fine but give below warning : [WARNING] The POM for JavaPNS:JavaPNS-jar:jar:2.2.0 is missing, no dependency information available. Can it be the reason for the above issue ? - Pushpendra Pal

1 Answers

0
votes

I resolved it using a workaround. I created a lib folder inside my spring boot project folder structure and copied the JavaPNS-jar-2.2.0.jar inside lib folder and then referenced the jar using Add jars option inside configure build path in Eclipse.

Then I again packaged it using Maven. And now created jar is working fine without any issues!!