Error invalid or corrupt jarfile linux

After adding the Maven jFree dependency to my existing application, I'm not able to execute the created jar. The only error message I get is the following: java -jar target/com.company.product-1...

On my end if I build your project using the pom.xml you’ve showed us, with apache-poi declared after jfreechart, then as you’ve mentioned I get a corrupt JAR. Swapping the order of these two dependencies indeed gives me a correct JAR.

I’ve some previous experience with the maven-shade-plugin and when I used it I had trouble with the created JAR’s META-INF directory, so I’ve checked that for defects.

I’ve tried to copy (using Total Commander) the META-INF directory somewhere on my local filesystem and what I’ve noticed is that there were errors while copying the files in META-INF/licences/. If I’ve tried to copy those somewhere individually and it worked but I couldn’t copy the whole thing. My conclusion was that the JAR/ZIP archive is corrupt.

What I did was I entered that JAR in Total Commander (Ctrl+PgDown over the JAR file) and I renamed thirdpartylicenses.txt to thirdpartylicenses.txt.wtf. Doing this Total Commander offers to save this and it repackages the JAR (I’ve the Total7zip Total Commander packer plugin installed — if anyone tries this and it doesn’t work try it with this installed).

After this. It works.

(I’ve also tried to repack the whole thing without renaming anything using Cygwin’s unzip/zip commands, but that didn’t work the new archive was still corrupt. Total Commander or the plugin I’ve mentioned does some magic.)

I guess the maven-shade-plugin merely creates a corrupt or invalid ZIP/JAR archive. I’m not sure why and maybe what I’ve described won’t work for anyone else but I thought I’d mention it so maybe I could help.


I couldn’t just leave this alone, so I’ve dug deeper and I think I’ve found the answer.

The bad JAR contains 65608 entries.
The good JAR contains 65450 entries.

Guess what’s the upper limit of the number of entries for a plain ZIP file? Yeah. The Wiki article speaks about a ZIP64 format which overcomes this limitation.

The good JAR has less entries because the actual dependencies change because of the position of the dependency declarations in your pom.xml. (As described by this answer.)

I’ve counted the entries like this.

Collections.list(new JarFile("...").entries()).size();

I was using Java 7 which seems to support the new ZIP64 format, so maybe if someone tries to count the entries in the bad JAR using Java 5 or 6 will receive an error (I’m not sure though).

I also tried to run the JAR exploded. I’ve unpacked the whole JAR into a directory and run the whole thing like this.

java -cp <dir/ com.mycompany.test.Start

Worked like a charm.


Bottom line. Don’t overuse the maven-shade-plugin.

I have a project at work where I build my project like this.

  • I copy my project’s dependencies using the maven-dependency-plugin. Checkout the copy-dependencies goal. This copies your dependencies into target/dependency if I remember correctly.
  • Using the maven-jar-plugin I add these dependencies to my final JAR’s MANIFEST.MF as Class-Path entries using these options in the plugins configuration.

    <classpathPrefix>dependency/</classpathPrefix>
    <addClasspath>true</addClasspath>
    

    So I’ll have Class-Path entries like dependency/<artifactId>-<version>.jar, etc.

  • After this I’m using the maven-assembly-plugin to create a distribution ZIP which contains my final JAR and the whole dependency/ folder.
  • When I deploy my application I can run it like java -jar final.jar.

Primarily I’ve opted to use this solution, because in my project I use some Bouncy Castle JARs which JARs have some extravagant this and that inside their META-INF directory. When I used the maven-shade-plugin to create my final runnable JAR all hell broke loose and I got nasty that method couldn’t be found and this signature is not quite right errors.

You should be doing something like this also. This Maven shade business is too shady to be useful (pun intended).


Here’s a blog post on the whole process that I’ve tried to describe just above (thanks to
baba), maybe it’ll help someone in the future.

I just got an Ubuntu VPS from ovh.ca the other day for hosting Java programs/web services on. I use Putty to interact with the VPS. I used PSCP via Windows Command Prompt to transfer my jar file onto the VPS into the /home directory successfully (When I type ls, it shows up). Everything is working except for when I try to run the jar file. It gives me this:

Error: Invalid or corrupt jarfile gdbotproservlet.jar

I have little experience with Ubuntu/Linux servers so I’m not sure if I just need to recompile on the server, because I tried it on my friend’s OVH Ubuntu server and the same thing happened. I have a Windows computer and I’ve tested the program and it runs fine. And I exported it as a «Runnable Jar File» with Eclipse as well as added my own MANIFEST.MF file to the src package. What should I do to fix this?

This is what it looks like:

enter image description here

And this is what the structure of the jar file looks like in Eclipse:

enter image description here

Also, I tried running the jar file on my Ubuntu server with -cp and it couldn’t find the «MainServlet.java» class which has the main(String[] args) method in it.

@dasois

I run node.js v0.10.30 on Arch-Linux and did npm install protractor -g and then webdriver-manager update.
After that i tried webdriver-manager start and I get:
Error: Invalid or corrupt jarfile /usr/lib/node_modules/protractor/selenium/selenium-server-standalone-2.42.2.jar

According to this Stackoverflow answer it seems to be a corrupt version on npm?

@PriyaSr

You just try uninstalling the node.js and then re-install it again.

@jlin412

This usually happens when you try to do webdriver-manager update under vpn.
You will need to delete /node_modules/protractor/selenium folder.
Then run webdriver-manager update without vpn.

On Wed, Aug 27, 2014 at 8:59 AM, PriyaSr notifications@github.com wrote:

You just try uninstalling the node.js and then re-install it again.


Reply to this email directly or view it on GitHub
#1243 (comment).

@dasois

@jlin412

@dasois

Well, we have a gateway, but no proxy in that sense.

Why do I need a «public network»?

@jlin412

Some company proxy blocks the download of the selenium and chrome driver.

On Wed, Aug 27, 2014 at 11:15 AM, David Sautter notifications@github.com
wrote:

Well, we have a gateway, but no proxy in that sense.

Why do I need a «public network»?


Reply to this email directly or view it on GitHub
#1243 (comment).

@mitchhentges

I’ve run into a similar issue before. When you ran webdriver-manager update, did it hang? At any rate, delete the selenium-server-standalone-2.42.2.jar file retry downloading using webdriver-manager.

If that still doesn’t work, then just download from seleniumhq.org — grab Selenium Server, the current version is 2.42.2

@dasois

that is exactly what i did, thank you.
But i wanted to report an issue for this, since this does not seem healthy to me.

@juliemr

I’ve been seeing this the past couple days as well. I think it’s something wrong with the distributing site — will look into it more if it keeps up.

@kburson

I tried to update from protractor 1.0.0 to 1.1.1, then run the webdriver-manager update, I get the same error as reported above. When I then downgrade to protractor 1.0.0 and run the same command everything downloads and installs correctly.

@sidwood

@juliemr not sure if it’s the distributing site. I’ve tried half dozen times via webdirver-manager update under node 0.10.29 + 0.10.31 and failed every time. I’ve tried using a shell script and it works every time.

Anyway, no need to downgrade just to install selenium. Do it manually or use a script.

https://gist.github.com/sidwood/fcee60dc7b7e704d818d

@juliemr

This should be fixed with 1.2.0. Sorry for the flakes!

@thoughtpalette

@elgalu

You are launching with & not giving enough time to update & start selenium

$ webdriver-manager update &
$ webdriver-manager start &
$ protractor protractor.js

Protractor will start before selenium is ready therefore ECONNREFUSED

@jbolila

+1

12:43 $ ./node_modules/protractor/bin/webdriver-manager update
Updating selenium standalone
downloading https://selenium-release.storage.googleapis.com/2.43/selenium-server-standalone-2.43.1.jar...
Updating chromedriver
downloading https://chromedriver.storage.googleapis.com/2.10/chromedriver_linux64.zip...
Error: Got error Error: SELF_SIGNED_CERT_IN_CHAIN from https://selenium-release.storage.googleapis.com/2.43/selenium-server-standalone-2.43.1.jar
Error: Got error Error: SELF_SIGNED_CERT_IN_CHAIN from https://chromedriver.storage.googleapis.com/2.10/chromedriver_linux64.zip

There is any option we can set like in npm? npm config set strict-ssl false

@karthiktv006

I am seeing SELF_SIGNED_CERT_IN_CHAIN error recently. Is there a way to resolve this issue?

IMPORTANT: This is the legacy GATK Forum discussions website. This information is only valid until Dec 31st 2019. For latest documentation and forum click here

created by Grey
on 2018-01-23

When I run

./gatk —help

it seems to be working fine. However, running anything else such as

./gatk —list

produces an error:

Error: Invalid or corrupt jarfile /path/to/gatk/gatk-4.0.0.0/gatk-package-4.0.0.0-local.jar

What’s going on? Sorry this might be noob question.

Updated on 2018-01-23



From SkyWarrior on 2018-01-25


Can you try to re-download the package and extract the script and the jar files into the same folder? Your download may have been interrupted therefore the file is corrupt.


From lbotigue on 2018-02-02


Hi, I got the same error and realized I was working with java 1.7, whereas java 1.8 is required.


From preetisingh on 2018-02-08


Hi,

I have java 1.8 and i still get this error
GATK jar /Users/preetisingh/Documents/gatk-4.0.1.1/gatk-package-4.0.1.1-local.jar
Running:
java -Dsamjdk.use_async_io_read_samtools=false -Dsamjdk.use_async_io_write_samtools=true -Dsamjdk.use_async_io_write_tribble=false -Dsamjdk.compression_level=1 -jar /Users/preetisingh/Documents/gatk-4.0.1.1/gatk-package-4.0.1.1-local.jar —help
Invalid or corrupt jarfile /Users/preetisingh/Documents/gatk-4.0.1.1/gatk-package-4.0.1.1-local.jar

The terminal doesn’t recognise GATK as commands. I reinstalled the package and still no avail (tried this at least 5 times). Could someone please help me.

I’m new to GATK and have had my brain wrecked over this since last 2 weeks. Any help is much appreciated.

Many thanks.

Regards,

Preeti


From preetisingh on 2018-02-08


Also, the script and jar files have been extracted into the same folder (every time) and still I get the same error.

Thanks.

Preeti


From preetisingh on 2018-02-08


Hi,

Apologies for the constant texts. I have been able to list the files but my terminal (on Mac) still doesn’t recognise GATK commands. With any GATK command I get the following error
-bash: gatk: command not found

I am unable to create a reference file even though I have downloaded the bundle from Broad institute ftp server. Any GATK command comes with the above mentioned error.

./gatk works with —help and —list but nothing else.

Hope someone will be able to address my concerns.

Many thanks.

Regards,

Preeti


From JmeAlena on 2018-02-08


Hi,

I am currently having the same issue. I ensured I had the correct java version (1.8) and I downloaded directly from the GATK website. So far, ./gatk —help works but ./gatk list or any other command doesn’t work.

I have gotten the following errors:
“-bash: ./gatk: No such file or directory”
or
“ Error: Invalid or corrupt jarfile”.


From zhaoxvwahaha on 2018-02-13


Hi,
I also have same problem. My system is Linux, and java is “java version “1.8.0_45”. I download the gatk-4.0.1.2.zip and unzip it, then I run ./gatk —list
./gatk —list
Using GATK jar /hwfssz1/ST_META/AP/zhaohailong/install.software/gatk-4.0.1.2/gatk-package-4.0.1.2-local.jar
Running:
java -Dsamjdk.use_async_io_read_samtools=false -Dsamjdk.use_async_io_write_samtools=true -Dsamjdk.use_async_io_write_tribble=false -Dsamjdk.compression_level=1 -jar /hwfssz1/ST_META/AP/zhaohailong/install.software/gatk-4.0.1.2/gatk-package-4.0.1.2-local.jar —help
Error: Invalid or corrupt jarfile /hwfssz1/ST_META/AP/zhaohailong/install.software/gatk-4.0.1.2/gatk-package-4.0.1.2-local.jar

Please help me, how can I solve it?


From Sheila on 2018-02-14


preetisingh JmeAlena @zhaoxvwahaha
Hi everyone,

Do you have Python 2.6 or greater installed as well? Have a look at the [README](https://github.com/broadinstitute/gatk/blob/master/README.md) for more information.

-Sheila


From JmeAlena on 2018-02-14


Hi there,

My version of python is 2.7.7.


From Sheila on 2018-02-21


@JmeAlena
Hi again,

The README did not help? Can you post exactly what you get when you type python —version and java -version in your command line? Sometimes you may have a few different versions downloaded and the version used is not the one you want.

-Sheila


From JmeAlena on 2018-02-22


It appears that the cluster I was using had some issues with the java version 1.8 even though it was the version being used. I have moved a different cluster that seems to have java properly installed and it now works. Thank you!


From lindenb on 2018-06-20


Hi had the same problem today: multiple java JVM installed on our server. I quickly fixed it by changing the gatk script.

«`
def formatLocalJarCommand(localJar):
return [“java”] + PACKAGED_LOCAL$

«`

to

«`
def formatLocalJarCommand(localJar):
return [“/full/path/to/java”] + PACKAGED_LOCAL$
«`


From zhangnew on 2018-07-03


> @lindenb said:
> Hi had the same problem today: multiple java JVM installed on our server. I quickly fixed it by changing the gatk script.
>
> «`
> def formatLocalJarCommand(localJar):
> return [“java”] + PACKAGED_LOCAL$
>
> «`
>
> to
>
>
> «`
> def formatLocalJarCommand(localJar):
> return [“/full/path/to/java”] + PACKAGED_LOCAL$
> «`
>

Thank you for fixed my problem.


From shlee on 2018-07-05


Thanks for sharing your solution @lindenb.


From rgiannico on 2018-09-17


If you are using a conda env (like me), you can simply resolve installing java inside the conda env, like this:
«`bash
source activate gatk
conda install -c cyclus java-jdk
«`
I think it should already be present in the gatkcondaenv.yml file if java v1.8 is one of the requirements!


From emb on 2018-11-12


I’m running into this same error, but I can’t seem to use any of the provided solutions to fix it. I’m on java 8.45 and python 3.6.2:

java -version
java version “1.8.0_45“
Java™ SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot™ 64-Bit Server VM (build 25.45-b02, mixed mode)

python —version
Python 3.6.2 :: Continuum Analytics, Inc.

System info:

lsb_release -a
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.5 (Final)
Release: 6.5
Codename: Final

I tried hard coding the java path like lindenb suggested, but that didn’t work. I also hard coded the python path in the shebang. Prior to doing that, I download and unzipped the file three times and still received the same error.

./gatk —help

The output is as expected:

Usage template for all tools (uses —spark-runner LOCAL when used with a Spark tool)
gatk AnyTool toolArgs

Usage template for Spark tools (will NOT work on non-Spark tools)
gatk SparkTool toolArgs [ — —spark-runner sparkArgs ]

Getting help
gatk —list Print the list of available tools

gatk Tool —help Print help on a particular tool
—cutoff remainder of output

But when I try to call gatk, I get the previously mentioned error:

java -jar ./gatk
-T SplitNCigarReads
-R /path/to/fasta
-I /path/to/input
-o /path/to/output
-rf ReassignOneMappingQuality
RMQF 255
RMQT 60
-U ALLOW_N_CIGAR_READS

Error: Invalid or corrupt jarfile ./gatk

pwd
/emb/software/gatk-4.0.11.0

I even created a gatk env (followed README instructions) and tried running the command within the session, but I still get the same error.

Thanks for any insight.


From shlee on 2018-11-16


Hi @emb,

In GATK4, the `./gatk` is a launch script and not a jar. Instead of `java -jar ./gatk`, try just invoking the toolkit with `./gatk`. Alternatively, using the Docker image solves all install and dependency setups. Instructions to set up Docker are in [Tutorial#11090](https://software.broadinstitute.org/gatk/documentation/article?id=11090).


From leshwill on 2018-11-20


Hi Please help
How do folks change the “gatk script” to instruct GATK to use java 1.8 instead of installed older versions? is this the gatk-completion.sh? Thanks


From bhanuGandham on 2018-11-21


Hi @leshwill

[This](https://software.broadinstitute.org/gatk/documentation/article?id=11135 “This”) document will help you out. :smile:

Regards
Bhanu

Hello everyone,

I am working on my first multiplayer server build. I am running ubuntu, java 1.7.0_95, and minecraft 1.7.10.

Error: Invalid or corrupt jarfile minecraft.jar

How I am installing.

DOWNLOAD (either seems to work)

wget https://minecraft.net/download/minecraft_server.1.7.10.jar

OR

curl -L -O https://minecraft.net/download/minecraft_server.1.7.10.jar

File is located in /home/oneup_shroom/minecraft/minecraft.1.7.10.jar

After CD into that directory I run chmod to allow permissions to the jar file.

chmod +x minecraft.1.7.10.jar

I then rename the file for ease of use

mv minecraft_server.1.7.10.jar minecraft.jar

Then my launch script, which is where things seem to fall apart

java –Xmx1024M -Xms1024M -jar minecraft.jar nogui

The error that comes out of the launch is «Error: Invalid or corrupt jarfile minecraft.jar».

I have tried multiple server instances and started from scratch a few times to try to combat this error. I even moved my attempts to Azure from my typical hosting to try it out.

Is there something I am missing? I am confused because this should be a simple launch of vanilla minecraft. I can get minecraft 1.5.2 to launch with no error but who wants to play on something that old?

Thank you!

Josh

Понравилась статья? Поделить с друзьями:
  • Error invalid or corrupt jarfile forge
  • Error invalid or corrupt jarfile choros jar
  • Error invalid or corrupt jarfile app jar
  • Error invalid operands to binary have float and int
  • Error invalid operands to binary have float and float