Exception in thread "main" java.lang.NoSuchFieldError: id_ecPublicKey - oracle-cloud-infrastructure

Seeing the following exception on running the "ObjectStorageSyncExample" from the SDK. I have not made any modifications. Configured the ~/.oci/config correctly as well.
Exception in thread "main" java.lang.NoSuchFieldError: id_ecPublicKey
at org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter.(Unknown Source)
at com.oracle.bmc.http.signing.internal.PEMFileRSAPrivateKeySupplier.(PEMFileRSAPrivateKeySupplier.java:47)
at com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory.createKeySupplier(DefaultRequestSignerFactory.java:111)
at com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory.createRequestSigner(DefaultRequestSignerFactory.java:54)
at com.oracle.bmc.objectstorage.ObjectStorageClient.(ObjectStorageClient.java:181)
at com.oracle.bmc.objectstorage.ObjectStorageClient.(ObjectStorageClient.java:137)
at com.oracle.bmc.objectstorage.ObjectStorageClient.(ObjectStorageClient.java:109)
at com.oracle.bmc.objectstorage.ObjectStorageClient.(ObjectStorageClient.java:84)
at com.oracle.bmc.objectstorage.ObjectStorageClient.(ObjectStorageClient.java:61)
at com.oracle.bmc.objectstorage.ObjectStorageClient.(ObjectStorageClient.java:47)
at com.oracle.bmc.objectstorage.ObjectStorageClient.(ObjectStorageClient.java:36)
at ObjectStorageSyncExample.main(ObjectStorageSyncExample.java:30)

Just summarizing the above comments from skiman and myself:
What version of BouncyCastle are you using? The OCI Java SDK is using 1.52, because there were some problems with later versions.
If you are using a different version of BouncyCastle, or there are multiple versions of BouncyCastle, there will be problems. Make sure there is only one, and for the OCI Java SDK, that currently has to be version 1.52 of BouncyCastle.

Related

Can I deploy a Grails 4 app to Google Cloud Platform?

I have been able to run through the following Grails 3 guide for deploying a Grails application to GCP.
https://guides.grails.org/grails-google-cloud/guide/index.html
I've tried to mirror this using my own Grails 4 application but it fails when I try to access it.
appengineDeploy completes successfully but when I try and access the webapp URL, I get a long stacktrace which culminates in the following error;
Failed to instantiate [org.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com/mysql/cj/api/io/SocketFactory
...
...
Caused by: java.lang.ClassNotFoundException: com.mysql.cj.api.io.SocketFactory
I've been trying all sorts of various versions of the socket factory dependency to try and solve and redeploy but all result in the same error.
I have used various version of the j-6 connector (com.google.cloud.sql:mysql-socket-factory-connector-j-6) and my most recent attempt used the j-8 (1.0.14).
At this point it would be great to even know if what I'm trying is even possible. Java 11 support has been added quite recently and I have made the necessary config adjustments to get my app to deploy, but I cannot then access it.
Upgrading to version 8 of mysql-connector-java in tandem with mysql-socket-factor-connector-j-8 appears to have made this particular issue go away (and moved me to the next).
Dependencies are as follows;
runtime "mysql:mysql-connector-java:8.0.15"
runtime "com.google.cloud.sql:mysql-socket-factory-connector-j-8:1.0.14"

How to fix Kotlin REPL exception NoClassDefFoundError

I'm attempting to run the Kotlin REPL on my windows 10 machine, from the command line. I am receiving a java.lang.NoClassDefFoundError: org/jline/reader/LineReaderBuilder exception when running the command kotlinc
I have IntelliJ Ultimate 2019.1.3 installed, with the Kotlin plugin. I have the Kotlin standalone compiler also installed and I've added that location to my system path. I've tried to run the command from the standalone directory: "C:/Tools/kotlinc/bin" but no difference.
OS Name: Microsoft Windows 10 Enterprise
Version 10.0.16299 Build 16299
Kotlin version 1.3.40-release-123 (JRE 1.8.0_131-b11)
java version "1.8.0_131"
I expect the REPL to start without an exception. What could be causing the exception?
Thank you all!
It looks like that was a bug and it has been fixed with Kotlin plugin & kotlinc version 1.3.41 (released today).

Run Swing app from Tomcat; can't connect to X11 with DISPLAY=:0:0

I have a small Swing monitoring app that I want to run in the Tomcat 6 JVM. The app is started by dynamically loading the monitoring class from a webservice running under Tomcat. This works in Windows but on Linux (Ubuntu 10.4) I'm getting some errors.
My first error was that I was getting a HeadlessException. I'm not explicitly using headless mode and after searching around I changed Tomcat's library path (via -Djava.library.path in catalina.sh) to point to the client lib (ie. .../java-6-sun-1.6.0.26/jre/lib/i386/client) instead of the server lib. I also set DISPLAY=:0:0 in catalina.sh. This got rid of the headless exception but now I get:
java.lang.InternalError: Can't connect to X11 window server using ':0:0' as the value of the DISPLAY variable.
sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
sun.awt.X11GraphicsEnvironment.access$100(X11GraphicsEnvironment.java:52)
sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:155)
java.security.AccessController.doPrivileged(Native Method)
sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:131)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:169)
java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:68)
java.awt.Window.init(Window.java:380)
java.awt.Window.<init>(Window.java:433)
java.awt.Frame.<init>(Frame.java:403)
java.awt.Frame.<init>(Frame.java:368)
javax.swing.JFrame.<init>(JFrame.java:158)
com.quinsoft.zeidon.objectbrowser.ObjectBrowser.startup(ObjectBrowser.java:60)
At this point I'm stuck. I've tried a bunch of different things (like explicitly setting "headless=false" and using different values for DISPLAY) and nothing changes. Does anybody have any ideas?
Version info:
Tomcat 6.0.28
Java 1.6
Ubuntu 10.4
Try setting '-Djava.awt.headless=true' if you have not already tried it.

Grails IncompatibleClassChangeError

I deploy a war made with "grails war" to a jetty server.
As far as I can determine, Grails builds with Sun JDK 1.6.0_17-b04 and jetty runs on Sun JDK 1.6.0.16 (both on linux).
2010-08-18 07:33:47.018:WARN::Nested in org.springframework.beans.factory.access.BootstrapException: Error executing bootstraps; nested exception is org.codehaus.groovy.runtime.InvokerInvocationException:
java.lang.IncompatibleClassChangeError: the number of constructors during runtime and compile time for java.lang.ClassLoader do not match. Expected 3 but got 2:
java.lang.IncompatibleClassChangeError: the number of constructors during runtime and compile time for java.lang.ClassLoader do not match. Expected 3 but got 2
at grails.plugin.scopedproxy.AlwaysReloadableSmartClassLoader.<init>(AlwaysReloadableSmartClassLoader.groovy:28)
at grails.plugin.scopedproxy.ScopedProxyUtils.wrapInSmartClassLoader(ScopedProxyUtils.groovy:154)
How can this problem be solved or debugged further?
Run grails clean before you run grails war.
According to another post, Groovy code that uses exceptions that was compiled with a version of Java prior to 7 is not compatible with Java 7.
More information can be found here.
You are probably running into a JAR conflict. Namely your build environment is using one jar, and runtime (Jetty) is using a conflicting jar. This used to often happen with various XML parsing stacks.
Try looking at the Jars used by jetty and compare them to the ones in your project.

Groovy: deploying a war file

I have a groovy application running locally on my desktop.
Apparently it runs error free. At least all unit tests I wrote are fulfilled.
I want to deploy the application using a war file. For this I use the command
grails war
in the home directory of the application. When doing this I am getting the following exception:
Error executing script War: java.lang.NullPointerException
gant.TargetExecutionException: java.lang.NullPointerException
at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:331)
at gant.Gant$_dispatch_closure6.doCall(Gant.groovy:334)
at gant.Gant$_dispatch_closure6.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:344)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:334)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.processTargets(Gant.groovy:495)
at gant.Gant.processTargets(Gant.groovy:480)
Caused by: java.lang.NullPointerException
at _GrailsWar_groovy$_run_closure5_closure25_closure26_closure28.doCall(_GrailsWar_groovy:289)
at _GrailsWar_groovy$_run_closure5_closure25_closure26_closure28.doCall(_GrailsWar_groovy)
at _GrailsWar_groovy$_run_closure5_closure25_closure26.doCall(_GrailsWar_groovy:282)
at _GrailsWar_groovy$_run_closure5_closure25_closure26.doCall(_GrailsWar_groovy)
at _GrailsWar_groovy$_run_closure5_closure25.doCall(_GrailsWar_groovy:258)
at _GrailsWar_groovy$_run_closure5.doCall(_GrailsWar_groovy:256)
at _GrailsWar_groovy$_run_closure4.doCall(_GrailsWar_groovy:239)
at War$_run_closure1.doCall(War.groovy:38)
at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:324)
... 10 more
Any hint why?
Thanks a lot in advance
I think you'll have to find the source of Gant.groovy and see what it's doing on that line. Apparently there is some problem caused by your project's specific configuration (since such a show-stopper bug would have been caught if it always occurred), but the error message does not contain much information.
Alternatively, you could try upgrading Grails to the latest version 1.1.1 if you haven't already.