IntelliJ ClassNotFoundException AgentPremain - kotlin

I have IntelliJ IDEA 2022.3.1 (Community Edition)
When i started my spring boot project in debug mode, i have the below error
Connected to the target VM, address: '127.0.0.1:57235', transport: 'socket'
Exception in thread "main" java.lang.ClassNotFoundException: kotlinx.coroutines.debug.AgentPremain
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:431)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525)
*** java.lang.instrument ASSERTION FAILED ***: "result" with message agent load/premain call failed at ./src/java.instrument/share/native/libinstrument/JPLISAgent.c line: 422
FATAL ERROR in native method: processing of -javaagent failed, processJavaStart failed
Disconnected from the target VM, address: '127.0.0.1:57235', transport: 'socket'
I found this solution https://stackoverflow.com/a/68754169/4739210, but i don't found Kotlin under Data Views

Related

Exceptions running HotSwapAgent 1.4.1 with standalone JBoss 7.3 EAP

I just installed the HotSwapAgent 1.3.0 plugin in IntelliJ IDEA 2021.2.3 community edition and added the hotswap-agent.properties file with the watchResources=src/target/classes parameter in one of the modules from the multimodule project. I would like to deploy it in a standalone JBoss container, so I have added the -XXaltjvm and -javaagent options in the JBoss startup file. However, on JBoss, it does not work with the following exception:
[2022-06-02 15:46:57,810] [ ] [ERROR] [Controller Boot Thread] [org.jboss.as.controller.management-operation] [] [] [] [] WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "app.ear")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.subunit.\"app.ear\".\"app.war\".undertow-deployment" => "javax.servlet.ServletException: UT010013: Could not instantiate PROD DESIGN
Caused by: javax.servlet.ServletException: UT010013: Could not instantiate PROD DESIGN
Caused by: java.lang.IllegalStateException: WFLYEE0042: Failed to construct component instance
Caused by: javax.enterprise.inject.CreationException
Caused by: java.lang.Error: java.lang.reflect.InvocationTargetException
Caused by: java.lang.reflect.InvocationTargetException
Caused by: java.lang.NoClassDefFoundError: com/vaadin/flow/server/VaadinService
Caused by: java.lang.ClassNotFoundException: com.vaadin.flow.server.VaadinService"}}

How to fix ClassNotFoundException: kotlinx.coroutines.debug.AgentPremain in debug?

I am running several projects as spring boot applications, one of them specifically cannot start and is throwing:
java.lang.ClassNotFoundException: kotlinx.coroutines.debug.AgentPremain
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:304)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
Exception in thread "main" FATAL ERROR in native method: processing of -javaagent failed
Disconnected from the target VM, address: '127.0.0.1:64279', transport: 'socket'
Process finished with exit code 1
The command line has the option:
-javaagent:[...].m2/repository/org/jetbrains/kotlinx/kotlinx-coroutines-core/1.5.0/kotlinx-coroutines-core-1.5.0.jar
And this jar exists.
this happened after updating my Intellij'Idea to 2021.2
This issue happens only in debug mode.
Any idea how to solve this?
It is a known problem in the Kotlin plugin. As a workaround disable the coroutine agent option under Settings/Preferences | Build, Execution, Deployment | Debugger | Data Views | Kotlin | enable "Disable coroutine agent".
Please follow https://youtrack.jetbrains.com/issue/KTIJ-19345 , for updates.

Cannot deploy Java Adapter on IBM MobileFirst Platform 8.0

We have a java adapter that we are trying to deploy in IBM BFP 8.0. See error stack trace below:
[ERROR] logger.changeStateDeploymentException: FWLSE0321: State change failure. Caused by: java.lang.RuntimeException: User code thrown exception: java.lang.NoSuchMethodError: org/apache/http/impl/conn/CPool.setValidateAfterInactivity(I)V at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.<init>(PoolingHttpClientConnectionManager.java:181) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.<init>(PoolingHttpClientConnectionManager.java:163) at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:973) at org.apache.http.impl.client.HttpClients.createDefault(HttpClients.java:56) at com.mypackage.adapter.XYZJavaAdapterResource.init(XYZJavaAdapterResource.java:52) at com.mypackage.adapter.XYZJavaAdapterApplication.init(XYZJavaAdapterApplication.java:21) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56) at java.lang.reflect.Method.invoke(Method.java:620) at
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.531 s
[INFO] Finished at: 2018-10-05T18:28:03+08:00
[INFO] Final Memory: 10M/204M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.ibm.mfp:adapter-maven-plugin:8.0.2018082311:deploy (default-cli) on project com.mypackage.XYZJavaAdapter: Unexpected response from http://somehost:9080/mfpadmin/management-apis/2.0/runtimes/mfp/adapters -> [Help 1]
MFP version:
Name: IBM MobileFirst Platform Server
Installation directory: /opt/IBM/MFPDEVENV/MobileFirst_Platform_Server
Translations: English (en)
Architecture: 64-bit
[Package]
Name: IBM® MobileFirst Platform Server (com.ibm.mobilefirst.foundation.server)
Version: 8.0.0.20170220_1811 (8.0.0.20170220_1811)
CLI VERSION:
MobileFirst Platform Foundation Command Line Interface (CLI): 8.0.0-2018040312
MFP console log: see below
Caused by: java.lang.RuntimeException: User code thrown exception: java.lang.NoSuchMethodError: org/apache/http/impl/conn/CPool.setValidateAfterInactivity(I)V
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.<init>(PoolingHttpClientConnectionManager.java:181)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.<init>(PoolingHttpClientConnectionManager.java:163)
at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:973)
at org.apache.http.impl.client.HttpClients.createDefault(HttpClients.java:56)
[10/26/18 8:36:24:686 HKT] 00013f2d .worklight.admin.configservice.datastore.ConfigServiceClient E Unable to delete configuration with id ADAPTER_CONTENT due to exception FWLSE3208E: An invalid status code "404" was returned. The response content is "{"reason":"configuration_not_found","details":"CNFSRVE115: configuration with id 'ADAPTER_CONTENT' for schema 'mfp_default_schema' with version '1.0' not found"}"
Can anyone help us on how to solve this issue?
Thanks in advance

Not able to start Datastax Cassandra due to missing SystemInfo class

I have installed Datastax Cassandra 5.0.4 on my mac but when i try to start, it is giving me error for SystemInfo class.
Here is related log:
Exception (com.google.inject.ProvisionException) encountered during startup: Unable to provision, see the following errors:
1) Error injecting constructor, java.lang.NoClassDefFoundError: com/datastax/hadoop/hive/util/SystemInfo
at com.datastax.bdp.plugin.HiveMetaStorePlugin.(HiveMetaStorePlugin.java:39)
at com.datastax.bdp.DseHiveModule.configure(Unknown Source) (via modules: com.datastax.bdp.DseModule -> com.datastax.bdp.DseAnalyticsModule -> com.datastax.bdp.DseHiveModule)
while locating com.datastax.bdp.plugin.HiveMetaStorePlugin
1 error
com.google.inject.ProvisionException: Unable to provision, see the following errors:
1) Error injecting constructor, java.lang.NoClassDefFoundError: com/datastax/hadoop/hive/util/SystemInfo
at com.datastax.bdp.plugin.HiveMetaStorePlugin.(HiveMetaStorePlugin.java:39)
at com.datastax.bdp.DseHiveModule.configure(Unknown Source) (via modules: com.datastax.bdp.DseModule -> com.datastax.bdp.DseAnalyticsModule -> com.datastax.bdp.DseHiveModule)
while locating com.datastax.bdp.plugin.HiveMetaStorePlugin
1 error
at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1025)
at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1051)
at com.datastax.bdp.plugin.PluginManager.register(PluginManager.java:139)
at com.datastax.bdp.plugin.PluginManager.postSetup(PluginManager.java:68)
at com.datastax.bdp.server.DseDaemon.postSetup(DseDaemon.java:824)
at com.datastax.bdp.server.DseDaemon.setup(DseDaemon.java:447)
at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:568)
at com.datastax.bdp.DseModule.main(DseModule.java:91)
Caused by: java.lang.NoClassDefFoundError: com/datastax/hadoop/hive/util/SystemInfo
at com.datastax.bdp.plugin.HiveMetaStorePlugin.(HiveMetaStorePlugin.java:40)
at com.datastax.bdp.plugin.HiveMetaStorePlugin$$FastClassByGuice$$7e2893c3.newInstance()
at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)

Use IntelliJ to debug a Gradle Execute Task

I have the following Gradle task:
task execute(type:JavaExec, dependsOn:['build']) {
main = 'com.something.Main'
classpath = sourceSets.main.runtimeClasspath
}
When I debug the task in IntelliJ I get the following error:
ERROR: transport error 202: connect failed: Connection refused
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [debugInit.c:750]
:execute FAILED
It seems later versions of IntelliJ Idea cannot connect debuggers to forked test runners when using the Gradle Test runner.
In your sources root, add a gradle.properties file with the next two lines:
maxTestForks = 1
testForkEvery = 0
That should do the job.
I had a very similar problem. When I was invoking Gradle in IntelliJ, the Java environment by default contained
JAVA_OPTS=-agentlib:jdwp=transport=dt_socket,address=127.0.0.1:59842,suspend=y,server=n
I removed the JAVA_OPTS from the environment all together and voila, no more JDWP error because no more JDWP.