From where does the "Contains non-LDH ASCII characters" exception come from? - java

I develop an application (spring-magnolia) that around this new year (2018) started to throw for me this exception but not for any other colleagues.
The exception is right, there is an _ in the a configured host name, so that domain name should be fixed. Still, it was working before and for the other folks it is still working, not throwing this exception. I tried many different things, from tomcat settings to using an older JRE (1.7)... and even switched from Ubuntu to Windows but the exception wasn't left behind.
One of my mates is working with me in the office, using Mac, and I could look up his settings to catch what is making this difference, but don't really know what else should I look up as the tools, environment are the same (maven, same code, tried different jdks).
Could someone give me a clue what triggered the exception for me but not for others and if I could set it somewhere to ignore this exception?
Caused by: java.security.cert.CertificateException: Illegal given domain name: xyz_t-bud.rd-services.com
at sun.security.util.HostnameChecker.matchDNS(Unknown Source)
at sun.security.util.HostnameChecker.match(Unknown Source)
at sun.security.ssl.X509TrustManagerImpl.checkIdentity(Unknown Source)
at sun.security.ssl.X509TrustManagerImpl.checkIdentity(Unknown Source)
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source)
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)
... 135 more
Caused by: java.lang.IllegalArgumentException: Contains non-LDH ASCII characters
at java.net.IDN.toASCIIInternal(Unknown Source)
at java.net.IDN.toASCII(Unknown Source)
at javax.net.ssl.SNIHostName.<init>(Unknown Source)
... 141 more

Apparently I wasn't testing with older JDKs, as eclipse wasn't picking it up. After uninstalling the latest JDK 1.8.0_161and installing the JDK that my colleague is having, that is 1.8.0_111 I am no longer getting this error... I did try this JDK before, but I didn't uninstall the latest JDK and so the project was in fact still using the latest JDK...

Related

Klockwork Error with dependency (SqliteAgent)

Good afternoon,
I am trying to add the klockwork plugin in QNX (eclipse based) which is using Java 1.6 version (It is needed this version). I have Klockwork version 9.6 installed. But I have some problems.
The results on the internet say that we need to add a variable in the system: _JAVA_OPTIONS = -Djava.net.preferIPv4Stack=true but it still doesn't work.
When I look for something about sql in the Klockwork installation folder, there is a file called sqlite_jni . But it is strange that it does not work because of a dependency on Klockwork when Klockworks desktop works fine.
When I execute eclipse with debug mode enabled, It shows these errors:
Exception in thread "Thread-3" java.lang.UnsatisfiedLinkError: no sqlite_jni in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at com.klocwork.desktopdb.SqliteJniLoader.initDefaultLibraries(SqliteJniLoader.java:28) at com.klocwork.desktopdb.SqliteAgent.(SqliteAgent.java:21) at com.klocwork.inforceeclipse.problems.LocalProblemsStorage.readProblemUpdates(LocalProblemsStorage.java:95) at com.klocwork.inforceeclipse.problems.AbstractProblemsStorage.reloadProblems0(AbstractProblemsStorage.java:186) at com.klocwork.inforceeclipse.problems.AbstractProblemsStorage$1.run(AbstractProblemsStorage.java:159) at java.lang.Thread.run(Unknown Source)
WARN : [com.klocwork.licensing.LibInfo:41]: Could not determine library path:
ERROR: [com.klocwork.licensing.FlexLicenseServer:92]: Warning: Cannot find valid loccounter (loccounter.dll) Exception in thread "Thread-13" java.lang.NoClassDefFoundError: Could not initialize class com.klocwork.desktopdb.SqliteAgent at com.klocwork.inforceeclipse.problems.LocalProblemsStorage.readProblemUpdates(LocalProblemsStorage.java:95) at com.klocwork.inforceeclipse.problems.AbstractProblemsStorage.reloadProblems0(AbstractProblemsStorage.java:197) at com.klocwork.inforceeclipse.problems.AbstractProblemsStorage$1.run(AbstractProblemsStorage.java:159) at java.lang.Thread.run(Unknown Source)
And also It appears this dialog:
Database dialog error
Best regards and thanks in advance!
The first thing is that klockwork is compatible with QNX 32 bits.
Secondly, the klockwork lib should be added to the path:_ Klocwork\USERX\lib\ix86-pc-win32.
That's all!
Thanks.

Any idea how to fix this? Exception in thread "WindowsNativeRunloopThread" java.lang.NoSuchMethodError

My application uses javafx 11.0.1 and is shipped bundled with a jlinked version of openjdk 11. It runs fine for the vast majority of the users but few of them are getting this stack:
Exception in thread "WindowsNativeRunloopThread" java.lang.NoSuchMethodError: <init>
at com.sun.glass.ui.win.WinApplication.staticScreen_getScreens(Native Method)
at com.sun.glass.ui.Screen.initScreens(Screen.java:412)
at com.sun.glass.ui.Application.lambda$run$1(Application.java:152)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Unknown Source)
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
at com.sun.javafx.tk.quantum.QuantumToolkit.assignScreensAdapters(QuantumToolkit.java:695)
at com.sun.javafx.tk.quantum.QuantumToolkit.runToolkit(QuantumToolkit.java:313)
at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$startup$10(QuantumToolkit.java:258)
at com.sun.glass.ui.Application.lambda$run$1(Application.java:153)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Unknown Source)
I found some discussion related to the same exception but regarding Maven+Eclipse, here and here. The issue is very similar, user reporting it, do have other java installations and uninstalling them solves the issue, so basically leaving my bundled openjdk as the only option the application starts, but if there is another Java installed on the system, the wrong .dll is picked up and the application crashes with the above stacktrace.
I tried the suggested java.library.path workaround but users are saying it doesn't solve. Unfortunately I cannot reproduce it myself, any idea on how to solve it or what to ask the users reporting it?
EDIT: we fixed the exe generated by lauch4j here and the bash script here. The idea is basically to restrict/change the PATH env variable to avoid the wrong dll being picked up.
We fixed the exe generated by lauch4j here and the bash script here. The idea is basically to restrict/change the PATH env variable to avoid the wrong dll being picked up.

PKCS#11 library not found on 64bit Windows

In my job I have a requirement to sign XML file with certfifcate from SmartCard. Everything works fine but on 32bit Windows 7 VM.
The problems occur when I try to use the same code on 64bit Windows 10. I get error that "PKCS#11 not found" and "no such algorithm".
I use xades4j package. I've tried probably all solutions found in the web i.e.
Used different .dll libraries (pkcs11.dll, opensc-spy.dll, CPPkiP.dll, esp2003csp11.dll) in both 32 and 64 bits versions.
Placed .dll in both System32 and SysWOW64 directories.
Updated drivers for my reader (IDBridge CT30).
Changed jre to 32bit.
Used solutions from PKCS11 Reference Guide (without xades4j) - it also worked only on 32 bit.
Nothing helps and always the same exceptions occur. If someone have any ideas what else I could do, I will be really thankful for tips.
Best regards.
Caused by: java.security.KeyStoreException: PKCS11 not found
at java.security.KeyStore.getInstance(Unknown Source)
at java.security.KeyStore$Builder$2$1.run(Unknown Source)
at java.security.KeyStore$Builder$2$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 7 more
Caused by: java.security.NoSuchAlgorithmException: no such algorithm: PKCS11 for provider SunPKCS11-SmartCard
at sun.security.jca.GetInstance.getService(Unknown Source)
at sun.security.jca.GetInstance.getInstance(Unknown Source)
at java.security.Security.getImpl(Unknown Source)
... 11 more
I found library which solved my problem. It's https://github.com/esig/dss. I used JavaSE11(jdk-11.0.2), pkcs11.dll placed in C:/Windows/System32 directory.
Before run application it is necessary to add VM argument -Djava.security.debug=sunpkcs11,pkcs11

NoSuchMethodError: <init> in com.sun.glass.ui.win.WinApplication.staticScreen_getScreens

Since upgrading to install4j 7.0.5 and Java 10, users that run our application on Windows more and more often report that the application throws
java.lang.NoSuchMethodError: <init>
at javafx.graphics/com.sun.glass.ui.win.WinApplication.staticScreen_getScreens(Native Method)
at javafx.graphics/com.sun.glass.ui.Screen.initScreens(Unknown Source)
at javafx.graphics/com.sun.glass.ui.Application.lambda$run$1(Unknown Source)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
UiLauncher (WAITING)
at java.base#10.0.1/jdk.internal.misc.Unsafe.park(Native Method)
at java.base#10.0.1/java.util.concurrent.locks.LockSupport.park(Unknown Source)
at java.base#10.0.1/java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(Unknown Source)
at java.base#10.0.1/java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(Unknown Source)
at java.base#10.0.1/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(Unknown Source)
at java.base#10.0.1/java.util.concurrent.CountDownLatch.await(Unknown Source)
at platform/javafx.graphics#10.0.1/com.sun.javafx.tk.quantum.QuantumToolkit.startup(Unknown Source)
at platform/javafx.graphics#10.0.1/com.sun.javafx.application.PlatformImpl.startup(Unknown Source)
at platform/javafx.graphics#10.0.1/com.sun.javafx.application.PlatformImpl.startup(Unknown Source)
at platform/javafx.swing#10.0.1/javafx.embed.swing.JFXPanel.initFx(Unknown Source)
at platform/javafx.swing#10.0.1/javafx.embed.swing.JFXPanel.<init>(Unknown Source)
at java.base#10.0.1/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base#10.0.1/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at java.base#10.0.1/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.base#10.0.1/java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.base#10.0.1/java.lang.Class.newInstance(Unknown Source)
at app//...
when starting the application though the install4j created exe file. The error is triggered by creating an instance of javafx.embed.swing.JFXPanel through reflection:
Class.forName("javafx.embed.swing.JFXPanel").newInstance();
We currently suspect that for some reason an incompatible DLL is loaded (glass.dll seems to contain the native method mentioned in the stacktrace).
Does anyone know how to prevent this error? E.g. is there are way to restrict the java.library.path used when executing the application through the install4j-generated exe to the Java runtime environment that was embedded in the installer and installed locally with the application?
According to one user, the error does not occur if the application is started "manually" using the
java -jar app.jar
command. So it seems the problem lies with the install4j created executable.
The workaround to this problem seems to be to remove all occurences of "glass.dll" from your system %PATH%.
I believe a fix must be implemented somewhere else, though; either in the Java runtime or in the Install4j code, but cannot be implemented in the Java code of the actual app:
For some reason the Java runtime version in Install4j checks the bundled JRE last when locating the libraries. In this case the problematic native library is glass.dll which should contain the requested <init> method but if anywhere in your %PATH% there is an older, incompatible version of glass.dll (e.g. from a previous Java 8 installation) that file will be loaded with a higher precedence and then the application will crash natively.
This is not a problem in the code of the application (the java code), nor a problem with the bundled JDK, this is a problem of how the install-4j-generated exe files (or maybe Java internally) tries to resolve native dlls. Instead of checking all path elements first, it should be checking the bundled JRE directory, first.
With Procmon you can see that it loads arbitrarily placed glass.dll files in the path, first: I added one from JDK 1.8 into one of my path elements and got this (plus the crash):

Eclipse on Windows: Exception in thread "main" java.lang.UnsupportedClassVersionError: MainMethod : Unsupported major.minor version 52.0

I have been trying to fix this problem for several hours now, and I am totally at my wits end.
My old computer crashed, but luckily I was able to recover most of my files. I installed eclipse on my desktop, and attempted to import a few projects into eclipse. Every one of them had problems, and not a single one will run. I am running Windows 7 on a homebuild PC- I am 99% sure this is not a hardware problem, I don't think you need specs.
First, every time I import I have followed this thread because it is the first of my problems: every time I import a project, eclipse will not recognize anything from java and I apparently need to manually tell it what to use (which is annoying, and if anyone has a fix for this it would be great to know how to stop it).
But the big problem comes after I fix that. Whenever I try to run the project, no matter which project it is I get the error I copied in the description:
Exception in thread "main" java.lang.UnsupportedClassVersionError: MainMethod : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
I have tried just about everything, and am getting pretty close to just breaking the whole thing. I have followed all of the following guides: this one, this one and this one. All of them say to do the same thing: change the project preferences and check the compiler settings. The settings should match.
I am running JDK7 and JRE7. JRE8/JDK8 is not installed anywhere on my desktop- I am not sure why eclipse seems to think it is. My question is this: how do I fix this problem? Do I need to do a clean install and follow a specific set of steps to stop this from happening? Do I need to put JDK8 on my computer? Do I need ro re-import the projects into the workspace in a specific way? Am I just stuck?
If you have followed the steps of configuring JDK, the project might be referring to previously generated classes. You may try Project on menu > Clean, select all projects and then try to run the application.
Moreover, go to Project Properties, Java Build Path, Libraries and confirm that you are referring to the correct Java Runtime version.
Your project was created with a version of Java JDK, but your eclipse has a older version of JDK.
Verify if the version of your project's JDK is the same of the eclipse's JDK.

Categories

Resources