Java – SecurityException – signer information does not match signer information of other classes in the same package

Today I want to talk about a java exception, SecurityException, I encountered. I build my project via command line using maven, and I encountered this exception:

java.lang.SecurityException: [YourClassGoesHere]'s class signer information does not match signer information of other classes in the same package

Here is my situation:

  1. I am merging my code into an existing project, which was managed/developed by me.
  2. The existing project do not have a lot of overlaps in terms of coding with my project, but we share a lot of maven dependencies in the pom.xml
  3. As mentioned in 2, dependencies are specified in maven
  4. I have built the project previously, and just rebuilding it  on top of it after merging my code
  5. My code is using some newer versions of the maven dependencies.

So after seeing the error, I have gone to do some research to what it is, and found the following links, they are very informative and useful, and I have tested them out while trying to resolve the issue:

However none of these solved my case. Which made me thinking other possibilities. I was thinking what if something that is already built (in target folder) is conflicting with the what is newly built?

So i went on deleting everything in target folder, and rerun maven (package) command, and run my project, and bingo! It worked without the error.

So I just want to share this experience, and my findings, so someone else out there experiencing similar situation could at least try it out. It might not work for you, but it is something worth a try.