Error - Didn't find class "javax.naming.ldap.LdapName" - java

I'm using unirest to get a camfind result.
The full error log :
04-14 18:24:39.574 1880-2300/projectco.project E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-120
Process: projectco.project, PID: 1880
java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/naming/ldap/LdapName;
at com.mashape.relocation.conn.ssl.AbstractVerifier.extractCNs(AbstractVerifier.java:277)
at com.mashape.relocation.conn.ssl.AbstractVerifier.getCNs(AbstractVerifier.java:265)
at com.mashape.relocation.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:157)
at com.mashape.relocation.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:140)
[...] more "at"s
at bookshotco.bookshot2.MainActivity$1.run(MainActivity.java:100)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.ClassNotFoundException: Didn't find class "javax.naming.ldap.LdapName" on path: DexPathList[[zip file "/data/app/projectco.project-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
[..]
Suppressed: java.lang.ClassNotFoundException: javax.naming.ldap.LdapName
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 23 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
Few people had this problem and even fewer solved it, most of the times using stuff to do with compatibility of different versions which did not work for me.
The emulator I'm using is up to date (nexus 5 on api 21).

I've recently had the same issue and it was only happening in obfuscated code. So keeping the whole org.apache package in Proguard rules solved the issue.
# Keep Apache Package, since it cannot find some of the classes and throws Verify Error
-keep class org.apache.** {*;}

This error can also be caused by requiring ssl (i.e., "useSSL") when connecting to a remote server and NOT having verifyServerCertificate and trustServerCertificate defined as below, and also not having a server certificate defined properly. The system is trying to use an LDAP authentication process, thus the error.
val info = Properties()
info.setProperty("useSSL", "true")
info.setProperty("requireSSL", "true")
info.setProperty("user", user)
info.setProperty("password", password)
info.setProperty("verifyServerCertificate", "false")
info.setProperty("trustServerCertificate", "true")
Also, if you define:
trustServerCertificate=false
then you may need to set the following (unless everything matches up):
disableSslHostnameVerification=true

Related

Proguard removes com.sun.mail.imap.IMAPProvider

In my app I send emails to some specific address, it all works fine, but when it comes to obfuscation, shrinking, etc with ProGuard it fails
I've tried adding some ProGuard rules, which didn't work
That's my ProGuard
-keepclassmembernames class com.sun.mail.imap
2019-08-08 14:29:26.811 11724-12675/? E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #5
Process: com.redegrow.besttaxi, PID: 11724
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:354)
...
Caused by: java.util.ServiceConfigurationError: e.b.r: Provider com.sun.mail.imap.IMAPProvider not found
at java.util.ServiceLoader.fail(ServiceLoader.java:233)
at java.util.ServiceLoader.access$100(ServiceLoader.java:183)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:373)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:416)
at java.util.ServiceLoader$1.next(ServiceLoader.java:494)
...
Caused by: java.lang.ClassNotFoundException: com.sun.mail.imap.IMAPProvider
...
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.sun.mail.imap.IMAPProvider" on path: DexPathList[[zip file "/data/app/com.redegrow.besttaxi-_Kl-yVNRgbmmwzLXuKKmWQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.redegrow.besttaxi-_Kl-yVNRgbmmwzLXuKKmWQ==/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
...
Well, I found the solution.
It's not great, but at least it works
-keep class com.sun.mail.imap.IMAPProvider
-keep class com.sun.mail.imap.IMAPSSLProvider
-keep class com.sun.mail.smtp.** {*;}
Using keepclassmembernames for a class tells ProGuard not to obfuscate the class members, but does not have an effect on the class itself. So ProGuard does its job and changes the class name.
So if you want to prevent ProGuard from obfuscating the class name you should use keepnames instead.
To prevent both the obfuscation and shrinking (which is removing in case of not being used), you should use keepclassmembers if you want to target only the class members and keep to target the class itself and its members.

Trying to test my android application on firebase test lab but it keeps crashing

hope everyone is doing well.
I am trying to test my application on firebase however it keeps crashing. Firstly, I tried to test it and got the following error:
java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.example.leonapplication-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.leonx.application-1/lib/arm, /data/app/com.example.leonx.application-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
After doing some research I found out about Multidex and configured my app towards this however after trying to test it again, I get a new error:
java.lang.RuntimeException: Unable to instantiate application android.support.multidex.MultiDexApplication: java.lang.ClassNotFoundException: Didn't find class "android.support.multidex.MultiDexApplication" on path: DexPathList[[zip file "/data/app/com.example.leonx.application-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.leonx.application-1/lib/arm, /data/app/com.example.leonx.application-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
Does anyone have any advice on how to tackle this? App is running fine on the emulator and on my phone. I have also cleaned the project however still getting the above error
Many thanks, Leon

ClassNotFoundException Mystery

Google Play Console is reporting a minute percentage of my users are getting a ClassNotFoundException upon app launch. The mystery is, which is the class that cannot be found? Well, the Stacktrace is supposed to state the name, but in these cases it is missing the name. The following is the trace, which is being sent by multiple devices:
java.lang.RuntimeException:
at android.app.LoadedApk.makeApplication(LoadedApk.java:507)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4720)
at android.app.ActivityThread.access$1500(ActivityThread.java:166)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1343)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5584)
at java.lang.reflect.Method.invokeNative(Method.java:0)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
at dalvik.system.NativeStart.main(NativeStart.java:0)
Caused by: java.lang.ClassNotFoundException:
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.Instrumentation.newApplication(Instrumentation.java:982)
at android.app.LoadedApk.makeApplication(LoadedApk.java:502)
As you can see, the standard "Didn't find class "xx.yy.zz" message is missing!
Any ideas?
i just created an account to ask something so i couldn't help you by a comment:) sorry to make this little hint as an answer.
the last exception without a cause is the interesting one.
my answer despite the data you shared from your project is to look after the line "Caused by: java.lang.ClassNotFoundException:" in your log output, just below that line goto "BaseDexClassLoader.java:56" by clicking on it, it's the first line in its stack trace ,this line tells you the class and method where the exception with no cause occurred as well as its file and line number, i am pretty sure you will find more clues searching from there as that place is probably caused the main problem.

java.lang.UnsatisfiedLinkError: cqjnilinuxproxy (Not found in java.library.path)

I have webservices deployed on WAS that use Clearquest jars to connect to Clearquest. At runtime, I get the following errors.
java.lang.Exception: Cannot parse the output since it has an error. Error = ReasonCode = conflictCRVAP0049E (internal-error): Cannot instantiate protocol provider: cqjnilinuxproxy (Not found in java.library.path)
...java.lang.reflect.InvocationTargetException:
at com.ibm.rational.stp.cs.internal.util.StpExceptionImpl.realException(StpExceptionImpl.java:493)
at com.ibm.rational.stp.cs.internal.util.StpExceptionImpl.<init>(StpExceptionImpl.java:572)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:56)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39)
at java.lang.reflect.Constructor.newInstance(Constructor.java:527)
at com.ibm.rational.stp.client.internal.core.ProtocolSubprovider.setProtocolProvider(ProtocolSubprovider.java:614)
... 57 more
Caused by: java.lang.UnsatisfiedLinkError: cqjnilinuxproxy (Not found in java.library.path)
at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1090)
at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1054)
at java.lang.System.loadLibrary(System.java:510)
at com.rational.clearquest.cqjni.CQJNIBaseObj.<clinit>(Unknown Source)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:235)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:202)
at com.ibm.rational.stp.client.internal.cqjni.CqJniProtocol.<init>(CqJniProtocol.java:2343)
... 62 more
I followed the technote https://www-304.ibm.com/support/docview.wss?uid=swg21515079 - "An exception occurs on 64-bit WebSphere servers when running reports from ClearQuest data sources that require the Java Native Interface (JNI).
As suggested, WAS 32-bit was installed instead on 64 bit. But the error still occurs. Can you please let me know where this library is or what is going wrong?
Thanks,
Aarthi
The ClearQuest libraries and jars need to be placed on the path so WebSphere can pick them up. Did you source cq_setup.csh prior to starting the WebSphere profile? You would need to source cq_setup.csh and then start the profile in the same shell.

Cassandra Cannot locate storage-conf.xml

I was trying to start Cassandra on FreeBSD with /usr/local/share/cassandra/bin/cassandra.
But it gives me the following error messages, any idea how to get around the problem? Any suggestions will be GREATLY appreciated. Thank you.
INFO 21:16:38,666 JNA not found. Native methods will be disabled.
ERROR 21:16:38,684 Exception encountered during startup.
java.lang.ExceptionInInitializerError
at org.apache.cassandra.thrift.CassandraDaemon.setup(CassandraDaemon.java:73)
at org.apache.cassandra.thrift.CassandraDaemon.main(CassandraDaemon.java:224)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Cannot locate storage-conf.xml via storage-config system property or classpath lookup.
at org.apache.cassandra.config.DatabaseDescriptor.(DatabaseDescriptor.java:584)
... 2 more
Caused by: java.lang.RuntimeException: Cannot locate storage-conf.xml via storage-config system property or classpath lookup.
at org.apache.cassandra.config.DatabaseDescriptor.getStorageConfigPath(DatabaseDescriptor.java:180)
at org.apache.cassandra.config.DatabaseDescriptor.(DatabaseDescriptor.java:187)
... 2 more
Exception encountered during startup.
java.lang.ExceptionInInitializerError
at org.apache.cassandra.thrift.CassandraDaemon.setup(CassandraDaemon.java:73)
at org.apache.cassandra.thrift.CassandraDaemon.main(CassandraDaemon.java:224)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Cannot locate storage-conf.xml via storage-config system property or classpath lookup.
at org.apache.cassandra.config.DatabaseDescriptor.(DatabaseDescriptor.java:584)
... 2 more
Caused by: java.lang.RuntimeException: Cannot locate storage-conf.xml via storage-config system property or classpath lookup.
at org.apache.cassandra.config.DatabaseDescriptor.getStorageConfigPath(DatabaseDescriptor.java:180)
at org.apache.cassandra.config.DatabaseDescriptor.(DatabaseDescriptor.java:187)
... 2 more
Is this cassandra 0.6.x? You probably want to upgrade to the latest cassandra, 0.7.4
The error is because Cassandra can't locate storage-conf.xml. This file should be in your cassandra conf directory, see http://wiki.apache.org/cassandra/StorageConfiguration
If you upgrade to cassandra 0.7.x, you will need a cassandra.yaml file instead.

Categories