I recently--as in, today--became interested in learning to program with clojure. Now after having installed the latest version of java's jdk and downloading the leiningen script, I followed the installation instructions for the latter, specifically those given at: http:/www.lispcast.com/clojure-ubuntu.
Now, after the running lein version and downloading the relevant jar file, the program exits with an error about a class not being found. The error in question reads as follows:
Exception in thread "main" java.lang.ExceptionInInitializerError
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:375)>
at clojure.lang.RT.classForName(RT.java:2168)
at clojure.lang.RT.classForName(RT.java:2177)
at clojure.lang.RT.loadClassForName(RT.java:2196)
at clojure.lang.RT.load(RT.java:443)
at clojure.lang.RT.load(RT.java:419)
at clojure.core$load$fn__5677.invoke(core.clj:5893)
at clojure.core$load.invokeStatic(core.clj:5892)
at clojure.core$load.doInvoke(core.clj:5876)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core__init.load(Unknown Source)
at clojure.core__init.(Unknown Source)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:375)
at clojure.lang.RT.classForName(RT.java:2168)
at clojure.lang.RT.classForName(RT.java:2177)
at clojure.lang.RT.loadClassForName(RT.java:2196)
at clojure.lang.RT.load(RT.java:443)
at clojure.lang.RT.load(RT.java:419)
at clojure.lang.RT.doInit(RT.java:461)
at clojure.lang.RT.(RT.java:331)
at clojure.main.(main.java:20)
Caused by: java.lang.ClassNotFoundException: java/sql/Timestamp
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:375)
at clojure.lang.RT.classForName(RT.java:2168)
at clojure.lang.RT.classForNameNonLoading(RT.java:2181)
at clojure.instant$loading__5569__auto____6869.invoke(instant.clj:9)
at clojure.instant__init.load(Unknown Source)
at clojure.instant__init.(Unknown Source)
... 23 more
My java 9 jdk is installed in /usr/lib/jvm/java-9-oracle/bin/java, with my JAVA_HOME variable set to /usr/lib/jvm/java-9-oracle but I tried /usr/lib/jvm/java-9-oracle/bin as well, just in case. I am running xubuntu 16.04.3, if this is of any importance. I did try setting the default java jdk back to the openjdk which is bundled with xubuntu but this also was to no avail.
As an aside, the entire problem originated because I tried running the REPL
in intellij after installing the cursive plugin, which didn't work. I then surmised that it might be because I had not installed leiningen beforehand (I thought that the IDE and cursive would have this bundled along). However, the actual information on what intellij and clojure require to run successfully has eluded me, since much of the information is rather 'scattered' and I'm not sure whether I missed something along the way.
In any case, I am having quite a hard time of getting everything to work--probably because I'm not yet that savvy when it comes to these kinds of issues, having only been on a linux distro for a short while as well as being completely unfamiliar with clojure. If I'm missing something obvious, I apologize, but it stands to reason that something can only be obvious once it is shown to be so.
Any and all suggestions will be greatly appreciated.
That looks like a problem caused by Java 9's new concept of "modules": Clojure expects to be able to access java.sql.Timestamp, but it can't. I haven't kept up with Java development or Clojure development, so I can't say for sure that's your problem, but it looks that way to me. Try with an earlier JDK.
If you cant downgrade your JAVA version, run lein upgrade 2.8.1 or the latest Leiningen would do. Leiningen has been updated to include support for Java 9.
I installed LibGDX and IntelliJ15.
Then I built my LibGDX App and followed the instructions in this guide :
https://github.com/libgdx/libgdx/wiki/Gradle-and-Intellij-IDEA
I imported the programm with gradle into IntelliJ.
Whenever I try to start the DesktopLauncher, I get the following errors: Exception in thread "main" java.lang.ClassNotFoundException: com.hit.game.desktop.DesktopLauncher
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)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:122)
I also tried to shorten the DesktopLauncher to:
System.out.println("asdfasdasd");
//LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
//new LwjglApplication(new HitGame(), config);
But I still get those errors :/
Does anybody have an idea or a hint what I am doing wrong ?
Wow,
after spending now more like 2 hours on this problem, it is a specific BUG in intellij 15.0.x ...
https://youtrack.jetbrains.com/issueMobile/IDEA-147788
One way to "build" properly is described in a Reddit post of User anubiann00b :
1. Run gradlew cleanIdea and gradlew idea, specifically in the InteilliJ terminal.
2. A popup comes up asking you to reload the project. Hit accept.
3. Ignore the message to import an unlinked gradle project.
4. Error message on make tells you there isn't an Android SDK. Go to the android module and change the SDK from Java to Android.
https://www.reddit.com/r/libgdx/comments/3tgjqi/using_libgdx_with_intellij_idea_desktop_module/
I've solved it by clicking on the desktop project then run>edit configurations>click on +>gradle>set Gradle project to Project:desktop and type run in tasks and apply and run
while starting my weblogic(having my app war file containing logback-classic-1.0.1.jar),i am getting below exception.Any suggestion ?
<Sep 9, 2015 9:27:13 AM UTC> <Warning> <Common> <BEA-000632> <Resource Pool "JDBC Data Source-0" shutting down, ignoring 3 resources still in use by applications..>
Exception in thread "Thread-12" java.lang.NoClassDefFoundError: ch/qos/logback/classic/spi/ThrowableProxy
at ch.qos.logback.classic.spi.LoggingEvent.<init>(LoggingEvent.java:125)
at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:468)
at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:424)
at ch.qos.logback.classic.Logger.log(Logger.java:824)
at org.apache.commons.logging.impl.SLF4JLocationAwareLog.error(SLF4JLocationAwareLog.java:225)
at org.springframework.transaction.interceptor.TransactionAspectSupport.completeTransactionAfterThrowing(TransactionAspectSupport.java:415)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:114)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.cache.interceptor.CacheInterceptor$1.invoke(CacheInterceptor.java:58)
at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:213)
at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:66)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622)
................
at java.lang.Thread.run(Thread.java:701)
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.classic.spi.ThrowableProxy
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:52)
... 18 more
Exception in thread "Thread-18" java.lang.NoClassDefFoundError: ch/qos/logback/classic/spi/ThrowableProxy
at ch.qos.logback.classic.spi.LoggingEvent.<init>(LoggingEvent.java:125)
at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:468)
at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:424)
at ch.qos.logback.classic.Logger.log(Logger.java:824)
at org.apache.commons.logging.impl.SLF4JLocationAwareLog.error(SLF4JLocationAwareLog.java:225)
at org.springframework.transaction.interceptor.TransactionAspectSupport.completeTransactionAfterThrowing(TransactionAspectSupport.java:415)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:114)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.cache.interceptor.CacheInterceptor$1.invoke(CacheInterceptor.java:58)
at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:213)
at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:66)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622)
.......................
at java.lang.Thread.run(Thread.java:701)
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.classic.spi.ThrowableProxy
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:52)
... 18 more
This error happens when spring applications jar are rebuilt, removed, or updated during execution.
Ref: https://github.com/spring-projects/spring-boot/issues/4968
I have been getting this same error when breaking out (ctrl-c) from Dropwizard server, I finally learned why I get it.
My Dropwizard is build into one fat jar, that I build with Gradle, and when running server on my local computer I run it directly from build/libs/...fat.jar
So this exception occurs when I have changed source code, built app-server again, and Gradle has overwritten the same jar I am currently running with "java -jar ...", so it's not that weird that classes that haven't been used before that session will not load ok :)
This type of exception occurs when your classpath does not contain this class. If the jar's class is in your classpath, you pay attention to what classpath application you using at runtime. Indeed, often, classpath can be overwritten during runtime, or simply you can use a different one (for example, in a startup script).
For us, appears this meant "you are running out of file handles, increase your open file handle limit." (too many sockets were being created, using them all up). Credit to the original answer here.
Other things I've seen: make sure your spring boot is at least 1.3.8
Also make sure the jars underneath aren't being overwritten/changed/unstable file system. FWIW.
I got this runtime error in my spring boot app using Spring Boot version 2.3.5.RELEASE. Resolved by adding following dependencies in my build.gradle file.
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
compile group: 'ch.qos.logback', name: 'logback-core', version: '1.2.3'
Two options I see(not enough information yet):
1. It happens right upon loading, I bet for classpath, see answers above.
2. It happens after some time, when app is runnig(my case), read next paragraphs.
When I got class not found errors and also have the same error like you right now, quite offten is issued with no space left on device aka full disk, full memory.
My environment, is spring boot, logback is included automagicaly, in maven have repackage, so wverithing I need is included.
This error occures after my app is runnig for 20 minutes or so, is has thousands of threads. If you do not limit memory for your virtual maschine, it can get very high even if it is not necessary.
Once(2 days ago) I spend 3 hours looking around claspath stuf, ... issue was full disk
If you exactly ensure that logback-class and logback-core already are in your classpath. See below.
In your Logback.xml, you need add debug="true"
<configuration debug="true">
I encountered the problem 'java.lang.NoClassDefFoundError: ch/qos/logback/classic/spi/ThrowableProxy' in my tomcat.
However, after adding debug = 'true', anything is ok.
The class that is missing definitely exists in the JAR you have, I checked logback-classic-1.0.1.jar:
2012-03-07 07:34:18 ..... 4729 2018 ch\qos\logback\classic\spi\ThrowableProxy.class
Make sure your classpath is set up correctly. By the way: if possible update logback because this version is 3 years old.
I solved this problem by doing "mvn install" instead of "mvn clean install".
I'm rewriting a client/server application using Akka 2.2.0, Java 1.7.0_25 and Eclipse Juno.
I had a sample client and server working with Akka 2.0.2.
I updated to the old stable release 2.1.4 and got everything working once again.
I've just moved to the latest stable release 2.2.0.
I created a new package to add some new functionality, leaving the existing code untouched.
Something changed and now I can't launch my test cases.
Here is the stacktrace I see when I try to create an ActorSystem:
Exception in thread "main" java.lang.ClassNotFoundException: [B
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at akka.actor.ReflectiveDynamicAccess.getClassFor(DynamicAccess.scala:94)
at akka.serialization.Serialization$$anonfun$4.apply(Serialization.scala:154)
at akka.serialization.Serialization$$anonfun$4.apply(Serialization.scala:153)
at scala.collection.TraversableLike$WithFilter$$anonfun$map$2.apply(TraversableLike.scala:697)
at scala.collection.immutable.HashMap$HashMap1.foreach(HashMap.scala:178)
at scala.collection.immutable.HashMap$HashTrieMap.foreach(HashMap.scala:347)
at scala.collection.TraversableLike$WithFilter.map(TraversableLike.scala:696)
at akka.serialization.Serialization.<init>(Serialization.scala:153)
at akka.serialization.SerializationExtension$.createExtension(SerializationExtension.scala:15)
at akka.serialization.SerializationExtension$.createExtension(SerializationExtension.scala:12)
at akka.actor.ActorSystemImpl.registerExtension(ActorSystem.scala:644)
at akka.actor.ExtensionId$class.apply(Extension.scala:34)
at akka.serialization.SerializationExtension$.apply(SerializationExtension.scala:12)
at akka.remote.RemoteActorRefProvider.init(RemoteActorRefProvider.scala:77)
at akka.actor.ActorSystemImpl._start(ActorSystem.scala:568)
at akka.actor.ActorSystemImpl.start(ActorSystem.scala:575)
at akka.actor.ActorSystem$.apply(ActorSystem.scala:103)
at akka.actor.ActorSystem$.apply(ActorSystem.scala:98)
at akka.actor.ActorSystem$.create(ActorSystem.scala:64)
at akka.actor.ActorSystem.create(ActorSystem.scala)
Its complaining that it can't class load a byte array via the method descriptor style string "[B".
#som-snytt pointed out two bug reports that exactly describe the error I'm seeing.
#paul-vargas called out -Dsun.lang.ClassLoader.allowArraySyntax=true which re-enables the old loadClass behavior.
The allowArraySyntax flag does make the ClassNotFoundException go away but other errors popped up. The errors lead me to believe that something has gone wrong with my Eclipse/m2e/Scala-ide/Akka setup.
I imported the project into Netbeans 7.3 and did a clean and build and it worked on the first try. I didn't even need to set allowArraySyntax.
May you need add the argument to VM:
-Dsun.lang.ClassLoader.allowArraySyntax=true
This won't be news to everyone:
http://bugs.sun.com/view_bug.do?bug_id=6500212
http://bugs.sun.com/view_bug.do?bug_id=6434149
I only looked that up due to #paul-vargas.
I observe that in trunk, ReflectiveDynamicAccess uses Class.forName as the bug report says is recommended. See the code on master.
Possibly, you'll want to upgrade your Akka together with your Java version.
Or, perhaps your production runtime is stuck on 1.5 but you develop on 1.7.
Old akka and scala jars were on the classpath along with the updated versions. Not sure why it caused the above exception but the problem became obvious once Paul pointed out the allowArraySyntax flag.
I have a really strange problem. I can successfully start my Eclipse internal JBoss Server (7.0.2). I can access the website and everything is fine. But after restarting or shutting down and starting again I always receive the following error out of nowhere:
Exception in thread "main" java.lang.NoClassDefFoundError: /Users/path/Coding/JBoss
Caused by: java.lang.ClassNotFoundException: .Users.robin.Coding.JBoss
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
I googled and looked in the JBoss forums. Some ppl had a problem with using the JRE Version instead of the JDK. I checked I am using the JDK 1.6..
Here some other informations:
Eclipse Indigo (3.7.1)
JBoss (jboss-as-web-7.0.2.Final) also tested with the newer version 7.1
JBoss Tools (3.3.x)
Java version "1.6.0_29"
Mac Os X 10.7.3 (Lion)
After deleting the internal Server in Eclipse and recreating I can again start it successfully the first time. The path to the external JBoss directory is correct.
Did anyone have the same problem or any idea what it could be?
Thanks for your help!
I found the solution. It's very strange but somehow after executing the Server a second time it's crashing because of the space in the path:
/Users/robin/Coding/JBoss Servers/..'
After removing the space I could also run the Server several times without crashing. Thanks to Perception, his comment was leading me to the solution.