ObjectBox Java sometimes throws error java.lang.ClassNotFoundException: kotlin.text.Charsets - java

Sometimes when i run the application that using ObjectBox java with no kotlin coding, java throws this error. java.lang.ClassNotFoundException: kotlin.text.Charsets
dependencies {
// Optional: include all native libraries for distribution
implementation "io.objectbox:objectbox-linux:$objectboxVersion"
implementation "io.objectbox:objectbox-macos:$objectboxVersion"
implementation "io.objectbox:objectbox-windows:$objectboxVersion"
}
apply plugin: 'io.objectbox'
But run again the error gone and the application started normally... anything wrong? do i need to include kotlin lib in my gradle build manually? or its caused by the ide is building the project so get error on the first run its confusing here. I am using IntelliJ, Gradle,ObjectBox 2.8.1,Java 1.8
Stacktrace:
Exception in thread "Thread-109" java.lang.NoClassDefFoundError: kotlin/text/Charsets
at io.objectbox.reporting.BasicBuildTracker.sendEvent(BasicBuildTracker.kt:166)
at io.objectbox.reporting.BasicBuildTracker$sendEventAsync$1.run(BasicBuildTracker.kt:143)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: kotlin.text.Charsets
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
Caused by: java.lang.ClassNotFoundException: kotlin.text.Charsets
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 3 more
java.lang.ClassNotFoundException: kotlin.text.Charsets
Caused by: java.lang.ClassNotFoundException: kotlin.text.Charsets

Related

While running a spark-java program in eclipse, I am getting this error - java.lang.NoClassDefFoundError

I am using Spark 3.1.2 prebuilt with hadoop 3.2.0. I am using winutils instead of hadoop installation.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/spark/util/HadoopFSUtils$
at org.apache.spark.sql.execution.datasources.DataSource$.$anonfun$checkAndGlobPathIfNecessary$5(DataSource.scala:814)
at org.apache.spark.sql.execution.datasources.DataSource$.$anonfun$checkAndGlobPathIfNecessary$5$adapted(DataSource.scala:813)
at scala.collection.TraversableLike.$anonfun$partition$1(TraversableLike.scala:402)
at scala.collection.immutable.List.foreach(List.scala:392)
at scala.collection.TraversableLike.partition(TraversableLike.scala:402)
at scala.collection.TraversableLike.partition$(TraversableLike.scala:400)
at scala.collection.AbstractTraversable.partition(Traversable.scala:108)
at org.apache.spark.sql.execution.datasources.DataSource$.checkAndGlobPathIfNecessary(DataSource.scala:813)
at org.apache.spark.sql.execution.datasources.DataSource.checkAndGlobPathIfNecessary(DataSource.scala:590)
at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:415)
at org.apache.spark.sql.DataFrameReader.loadV1Source(DataFrameReader.scala:326)
at org.apache.spark.sql.DataFrameReader.$anonfun$load$3(DataFrameReader.scala:308)
at scala.Option.getOrElse(Option.scala:189)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:308)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:240)
at Main.main(Main.java:26)
Caused by: java.lang.ClassNotFoundException: org.apache.spark.util.HadoopFSUtils$
at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
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)
... 16 more

Cannot instantiate interface

When I tried to run my project(no build errors)there was an exception:
Exception in thread "main" java.lang.IllegalArgumentException: Cannot instantiate interface org.springframework.context.ApplicationListener : org.springframework.boot.autoconfigure.BackgroundPreinitializer
at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:438)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:420)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:413)
at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:270)
at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:250)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1214)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1203)
at com.inmobi.fuse.FuseServiceAppliaction.main(FuseServiceAppliaction.java:47)
Caused by: java.lang.NoClassDefFoundError: org/springframework/core/NativeDetector
at org.springframework.boot.autoconfigure.BackgroundPreinitializer.<clinit>(BackgroundPreinitializer.java:71)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:208)
at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:434)
... 7 more
Caused by: java.lang.ClassNotFoundException: org.springframework.core.NativeDetector
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)
... 14 more
I tried to resolve it, I updated my spring and jdk versions thinking it might be the reason but they all resulted in the same above exception.
Please see https://docs.spring.io/spring-native/docs/current/reference/htmlsingle/. It says
Spring Native 0.10.2 only supports Spring Boot 2.5.3, so change the version if necessary.
If you are running an older version of spring boot than 2.5.3, please try to upgrade and see if that helps.
See https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-parent for a list of available versions of spring boot.

Jenkins Build Error : java.lang.NoClassDefFoundError: org/tmatesoft/sqljet/core/table/SqlJetTimeoutBusyHandler

Error Log:
Started by user jenkins
Building in workspace /www/dev/apps/jenkins/workspace/app_11001
FATAL: org/tmatesoft/sqljet/core/table/SqlJetTimeoutBusyHandler
java.lang.NoClassDefFoundError: org/tmatesoft/sqljet/core/table/SqlJetTimeoutBusyHandler
at org.tmatesoft.svn.core.internal.db.SVNSqlJetDb.<clinit>(SVNSqlJetDb.java:49)
at org.tmatesoft.svn.core.internal.wc17.db.SVNWCDb.openDb(SVNWCDb.java:4775)
at org.tmatesoft.svn.core.internal.wc17.db.SVNWCDb.parseDir(SVNWCDb.java:1849)
at org.tmatesoft.svn.core.wc2.SvnOperationFactory.detectWcGeneration(SvnOperationFactory.java:1555)
at org.tmatesoft.svn.core.wc2.SvnOperationFactory.getImplementation(SvnOperationFactory.java:1219)
at org.tmatesoft.svn.core.wc2.SvnOperationFactory.run(SvnOperationFactory.java:1138)
at org.tmatesoft.svn.core.wc2.SvnOperation.run(SvnOperation.java:294)
at org.tmatesoft.svn.core.wc.SVNWCClient.doInfo(SVNWCClient.java:2485)
at hudson.scm.subversion.UpdateUpdater$TaskImpl.parseSvnInfo(UpdateUpdater.java:126)
at hudson.scm.subversion.UpdateUpdater$TaskImpl.getSvnCommandToUse(UpdateUpdater.java:88)
at hudson.scm.subversion.UpdateUpdater$TaskImpl.perform(UpdateUpdater.java:131)
at hudson.scm.subversion.WorkspaceUpdater$UpdateTask.delegateTo(WorkspaceUpdater.java:162)
at hudson.scm.SubversionSCM$CheckOutTask.perform(SubversionSCM.java:1001)
at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:977)
at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:953)
at hudson.FilePath.act(FilePath.java:1018)
at hudson.FilePath.act(FilePath.java:996)
at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:902)
at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:838)
at hudson.scm.SCM.checkout(SCM.java:495)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1278)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
at hudson.model.Run.execute(Run.java:1720)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:404)
Caused by: java.lang.ClassNotFoundException: org.tmatesoft.sqljet.core.table.SqlJetTimeoutBusyHandler
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 28 more
Finished: FAILURE
I've also added sqljet.jar file in my /lib folder but that doesn't helped me. when I click on build and within some sort of time I am getting same error and build failed.
I am using Apache Tomcat 8 for Jenkins.

Error java.lang.ClassNotFoundException: org.slf4j.LoggerFactory when trying to execute the jar

When I try to do java -jar app.jar I get this:
Exception in thread "JavaFX Application Thread" Exception in thread "main"
java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at tao.qaflash.GUI.<clinit>(GUI.java:14)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplicationWithArgs$156(LauncherImpl.java:352)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 12 more
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.NullPointerException
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:383)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
... 5 more
My environment is: Java 1.8.0_92, Gradle 2.16, Eclipse Mars 4.5.0, Java FX.
Also I have googled this error and I have tried everything from there , but with no success. I tried to add to the build.gradle as dependencies slfj-simple, log4j, logback-classic, slf4j-jdk14,junit,vaadin-slf4j-jdk14 but the error kept appearing.
When I run the application from Eclipse, everything works fine, the logs are written, only when I try to run the jar from command line, I get this ClassNotFoundException.
build.gradle looks like :
dependencies {
compile 'net.sf.staf:jstaf:3.4.4'
// SLF4J API module which will be used for logging
compile 'org.slf4j:slf4j-api:1.7.21'
// Log4J2 logging framework including the binding module to slf4j
compile 'org.apache.logging.log4j:log4j-slf4j-impl:2.5'
compile 'org.apache.logging.log4j:log4j-api:2.5'
compile 'org.apache.logging.log4j:log4j-core:2.5'
testCompile 'junit:junit:4.12'
testCompile "org.testfx:testfx-core:4.0.+"
testCompile "org.testfx:testfx-junit:4.0.+"
}
Any help is greately appreciated.
Simple: the classpath that you are using when trying to execute your JAR file does not contain the required sl4j logger library.
That is all there is to this. This is not about your build setup - it is about the setup that gets used when you run java on the command line!
See here for further reading.
I have unzipped the zip file that was created in the dist folder and it works :) because in the lib folder there was the sl4j-api.
It seems you need slf4j at runtime as well. Have a look at the gradle dependency configuration options

Grails not picking patched jar file

I am working on grails 2.0.3 project. On the way I noticed that following dependency of grails 2.0.3: org.grails:grails-datastore-core:1.1.4.RELEASE had a bug. So I patched the jar file and placed it in lib folder of grails. In BuildConfig.groovy excluded grails jar file and gave my own dependency as given below
inherits("global") {
excludes "grails-datastore-core"
}
dependencies {
compile 'org.grails:grails-datastore-core:1.1.4.RELEASE'
}
Then ran following steps:
grails clean
grails compile --refresh-dependencies
grails run-app
but got following error:
2013-06-05 16:39:14,613 20831 ERROR [org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager] (pool-7-thread-1:) Error configuring dynamic methods for plugin [domainClass:2.0.3]: java.lang.NoClassDefFoundError: org/grails/datastore/mapping/core/SoftThreadLocalMap
org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.NoClassDefFoundError: org/grails/datastore/mapping/core/SoftThreadLocalMap
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.NoClassDefFoundError: org/grails/datastore/mapping/core/SoftThreadLocalMap
at org.grails.datastore.mapping.core.AbstractDatastore.<clinit>(AbstractDatastore.java:46)
at java.lang.Class.forName(Class.java:171)
... 5 more
Caused by: java.lang.ClassNotFoundException: org.grails.datastore.mapping.core.SoftThreadLocalMap
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 7 more
2013-06-05 16:39:14,714 20932 ERROR [org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager] (pool-7-thread-1:) Error configuring dynamic methods for plugin [hibernate:2.0.3]: java.lang.NoClassDefFoundError: org.grails.datastore.mapping.core.AbstractDatastore
org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.NoClassDefFoundError: org.grails.datastore.mapping.core.AbstractDatastore
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.NoClassDefFoundError: org.grails.datastore.mapping.core.AbstractDatastore
at java.lang.Class.forName(Class.java:171)
... 5 more
I have tried renaming the jar file and changing scope of dependency to runtime but no luck.
I have also tried upgrading using this link but still get the same error.
Any kind of help is appreciated

Categories