The Java.lang.SecurityException Solution

Source: Internet
Author: User

It was a mistake to run a project with Gradle today, and it used to run with Ant.


The symptoms are as follows: The build is normal, but when run prompts

Exception in thread ' main ' java.lang.SecurityException:Invalid signature file Digest for Manifest main attributes

At first it looks like the signature doesn't match, guess it might be gradle and Ant's bag.

So I searched for a symptom:

Stackoveflow:invalid Signature

IText question

After reading the discussion above I understand that because gradle all the dependency together, different versions of the package may conflict


Then Justin looked at it and immediately pointed out that this was because of the signature conflict, some SF, RSA files were duplicated, and our project didn't actually need these files .

MAVEN Packaging issues

The problem with the above is basically the same.

So I went to change the Gradle.build file under the project directory.

Exclude dependency

With this man's approach, in the Runtime.collect after the sentence add three words exclude on the line

    From {configurations.runtime.collect {ziptree (IT)}}//
    {
        exclude meta-inf/*. SF "
        exclude" meta-inf/*. DSA "
        exclude" meta-inf/*. RSA "
    }

It may not be the same for everyone, but I can solve the problem by doing so.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.