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

ANT builds fail on NB11.3 and 12.0 #252

Open
xxxajk opened this issue Jul 30, 2020 · 6 comments
Open

ANT builds fail on NB11.3 and 12.0 #252

xxxajk opened this issue Jul 30, 2020 · 6 comments
Assignees
Labels

Comments

@xxxajk
Copy link

xxxajk commented Jul 30, 2020

Describe the bug
Try to build an ANT project, and fail.
Note that ant debug works from shell.

To Reproduce
Steps to reproduce the behaviour:

  1. Try to debug build the project
  2. java.lang.InternalError: Could not obtain X500Principal access
android-sdk-linux build-tools 23.0.2
android sdklib.jar patched to not depend on Oracle's base64 implementation.

Product Version: Apache NetBeans IDE 12.0
Updates: NetBeans IDE is updated to version NetBeans 8.2 Patch 2
Java: 11.0.8; OpenJDK 64-Bit Server VM 11.0.8+10-post-Ubuntu-0ubuntu118.04.1
Runtime: OpenJDK Runtime Environment 11.0.8+10-post-Ubuntu-0ubuntu118.04.1
System: Linux version 5.4.0-42-generic running on amd64; UTF-8; en_US (nb)
@xxxajk
Copy link
Author

xxxajk commented Feb 18, 2021

I've found that there needs to be a couple of settings.
One such setting would be to select the system apache ant, instead of the ant plugin.
This would be an option much like available from the Java plugin.

So... is this project even still alive?

@geertjanw
Copy link
Collaborator

It's alive if you want it to be. Will you make those changes?

@xxxajk
Copy link
Author

xxxajk commented Feb 18, 2021

I'm still investigating the root cause. What is strange is that when I do:
ant debug
from shell, it is happy, no problems. Of course this is using the system ant...

I compared the output of each, and the messages from both are identical, except for the signing phase, which is failing.
I'm thinking here that the solution would be to fork and run ant, which is shell, instead of calling the class.

I've not fully checked, but it looks like even java compiles do the same thing on NetBeans.

@xxxajk
Copy link
Author

xxxajk commented Feb 18, 2021

Checked using the NetBeans supplied ant, works from command line too.
I think the solution here is to run ant from a login shell, or similar...

@xxxajk
Copy link
Author

xxxajk commented Feb 18, 2021

Looks like it is the fault of how the ant plug-in launches ant!
I've noticed a few changes from the older NBANDROID, of which I think the most important is:

Old NBANDROID would ask for the passphrase for the signing keys.

This could be the fix.

@xxxajk
Copy link
Author

xxxajk commented Feb 19, 2021

And... I located the big difference why it bombs.

Please note, I merged the needed jar files in my sdklib.jar long ago, so I could actually compile from the cli...

cli does this:

Finding class com.android.sdklib.internal.build.SignedJarBuilder$SignatureOutputStream
Loaded from /home/xxxajk/android/android-sdk-linux/tools/lib/sdklib.jar com/android/sdklib/internal/build/SignedJarBuilder$SignatureOutputStream.class
Class java.io.FilterOutputStream loaded from parent loader (parentFirst)
Class com.android.sdklib.internal.build.SignedJarBuilder$SignatureOutputStream loaded from ant loader (parentFirst)
Class java.util.jar.Manifest loaded from parent loader (parentFirst)
Class java.util.jar.Attributes loaded from parent loader (parentFirst)
Class java.util.Base64 loaded from parent loader (parentFirst)
Class java.security.MessageDigest loaded from parent loader (parentFirst)
Class java.util.Base64$Encoder loaded from parent loader (parentFirst)
Class java.security.PrivateKey loaded from parent loader (parentFirst)
Class java.security.Signature loaded from parent loader (parentFirst)
Class java.security.SignatureException loaded from parent loader (parentFirst)
Class sun.security.pkcs.SignerInfo loaded from parent loader (parentFirst)
Class sun.security.x509.X500Name loaded from parent loader (parentFirst)
Class javax.security.auth.x500.X500Principal loaded from parent loader (parentFirst)
Class sun.security.x509.AlgorithmId loaded from parent loader (parentFirst)
Class sun.security.pkcs.PKCS7 loaded from parent loader (parentFirst)
Class sun.security.pkcs.ContentInfo loaded from parent loader (parentFirst)

and everything is fine. Here's what netbeans tries to do:

Finding class com.android.sdklib.internal.build.SignedJarBuilder$SignatureOutputStream
Loaded from /home/xxxajk/android/android-sdk-linux/tools/lib/sdklib.jar com/android/sdklib/internal/build/SignedJarBuilder$SignatureOutputStream.class
Class java.io.FilterOutputStream loaded from parent loader (parentFirst)
Class com.android.sdklib.internal.build.SignedJarBuilder$SignatureOutputStream loaded from ant loader (parentFirst)
Class java.util.jar.Manifest loaded from parent loader (parentFirst)
Class java.util.jar.Attributes loaded from parent loader (parentFirst)
Class java.util.Base64 loaded from parent loader (parentFirst)
Class java.security.MessageDigest loaded from parent loader (parentFirst)
Class java.util.Base64$Encoder loaded from parent loader (parentFirst)
Class java.security.PrivateKey loaded from parent loader (parentFirst)
Class java.security.Signature loaded from parent loader (parentFirst)
Class java.security.SignatureException loaded from parent loader (parentFirst)
Class sun.security.pkcs.SignerInfo loaded from parent loader (parentFirst)
Class sun.security.x509.X500Name loaded from parent loader (parentFirst)

and bombs :-)

So... it's not seeing javax or a different javax is already loaded into the parent class loader, thus no javax.security.auth.x500.X500Principal which would read in the remaining bits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants