Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java 11 broken jar file #30

Open
ipkpjersi opened this issue Feb 2, 2020 · 9 comments
Open

Java 11 broken jar file #30

ipkpjersi opened this issue Feb 2, 2020 · 9 comments
Labels
help wanted Extra attention is needed

Comments

@ipkpjersi
Copy link

ipkpjersi commented Feb 2, 2020

Whenever I use this library in Java 11 to build a jar with Intellij, it says my main class is not found:

When the main class clearly does exist, with the correct packaging:

When using JBCrypt 0.4 instead of this bcrypt library, my jar file works fine, but JBCrypt doesn't support the newer $2y BCrypt version, only $2a.

I worked around this issue by finding a newer JBCrypt fork with $2y support, and I built a jar of it and the jar worked perfectly: https://github.com/Oscil8/jBCrypt/tree/djm-2y-etc an

@patrickfav
Copy link
Owner

Hi @ipkpjersi

Thanks for the bug report.

I'm a little confused though, it seems the missing class is from your codebase, so I don't see how this library could influence that issue? The only hunch I have is if you use OSGi (I added a feature supporting it by a feature request - but it shouldn't influence non-OSGi)

@ipkpjersi
Copy link
Author

ipkpjersi commented Feb 2, 2020

I know, it confused me too. It does say the missing class is from my code-base, but, I did narrow it down to this BCrypt library or the Bytes library that this library depends on. If I remove BCrypt and Bytes and just use JBCrypt, it works fine as it did for months. Just thought I'd give a heads up and report this issue, and maybe see if anyone else was running into it. I'm not using OSGI, but I am using Java 11 which has been known to break some things. I also tried multiple versions of this BCrypt library and of Bytes, and it still did not work.

@patrickfav
Copy link
Owner

Thanks for telling me, appreciate it. TBF there are not a lot of tests using Java11 so maybe something is broken - I will leave this open and will test in the near future for possible issues.

Have a good one!

@RohanNagar
Copy link
Contributor

For what it's worth I just replaced jbcrypt with this library in my Java 11 application and it's working great!

@LionZXY
Copy link

LionZXY commented Nov 15, 2020

This problem too :(

@patrickfav patrickfav added the help wanted Extra attention is needed label Nov 29, 2020
@patrickfav
Copy link
Owner

So unfortunately with this much information I cant really investigate, if one of you have some pointer where to look, or a test case I might be able to fix that.

@anc1llary
Copy link

anc1llary commented Dec 14, 2020

Hi Patrick,

What is happening to the individuals for this issue is they did not include your other library, 'Bytes', which is necessary for your Bcrypt library to work. I included the Bytes library with the necessary imports, and this worked successfully. There is no problem here.

Thanks for your work, it is much appreciated.

@HorizonCode
Copy link

HorizonCode commented Mar 21, 2021

Also having the same issue with Java8 in IntelliJ.
added it via maven pom.xml.
Luyten thows this exception if trying to decompile:

java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
	at sun.security.util.SignatureFileVerifier.processImpl(Unknown Source)
	at sun.security.util.SignatureFileVerifier.process(Unknown Source)
	at java.util.jar.JarVerifier.processEntry(Unknown Source)
	at java.util.jar.JarVerifier.update(Unknown Source)
	at java.util.jar.JarFile.initializeVerifier(Unknown Source)
	at java.util.jar.JarFile.getInputStream(Unknown Source)
	at com.strobel.assembler.metadata.JarTypeLoader.tryLoadType(JarTypeLoader.java:59)
	at us.deathmarine.luyten.LuytenTypeLoader.tryLoadType(LuytenTypeLoader.java:25)
	at com.strobel.assembler.metadata.MetadataSystem.resolveType(MetadataSystem.java:125)
	at com.strobel.assembler.metadata.MetadataSystem.lookupTypeCore(MetadataSystem.java:86)
	at com.strobel.assembler.metadata.MetadataResolver.lookupType(MetadataResolver.java:46)
	at us.deathmarine.luyten.Model.openEntryByTreePath(Model.java:338)
	at us.deathmarine.luyten.Model$TreeListener$1.run(Model.java:266)

Edit:
This issue seems just to appear if the bytes.jar lib is added to the artifact.
if i remove it from the export list, the file is fine.
so as my conclusion: its a issue with the bytes lib dependency.

Edit 2:
I think i found the issue, i just deleted the whole META-INF Folder and it works, seems like any of your Hashes are wrong, maybe you should check if there is any issues there.

@NathanPB
Copy link

NathanPB commented Jun 2, 2021

Just to address, this issue was happening with the Firebase Admin library too. I still don't have any decent workaround

https://stackoverflow.com/questions/64440041/firebase-admin-sdk-causing-cannot-find-or-load-main-class

Edit: I downloaded the bytes.jar file and manually checked the hashes in the MANIFEST file and they don't match the .class files ones. Maybe a simple recompile of bytes can solve the entire problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

7 participants