Running tests on intellij throwing OutOfMemoryError - java

java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
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:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:126)
at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:110)
at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:234)
at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:168)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:943)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:605)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:584)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:623)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:594)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrap.invoke(PogoMetaMethodSite.java:190)
java.lang.OutOfMemoryError: PermGen space
I am on the latest Fedora distro, running Intellij Ultimate. I have also configured Maven Runnger VM Options as -Xmx4g -XX:MaxPermSize=4g
How could I debug why the VM Options are not getting applied to the test or why the tests even dont run with default options. Same project works perfectly fine on another machine running Ubuntu Trusty.

How could I debug why the VM Options are not getting applied to the
test or why the tests even dont run with default options. Same project
works perfectly fine on another machine running Ubuntu Trusty.
You can apply a process of elimination to find out which argument is causing trouble. I suspect in this case it's either the MaxPermSize flag being equal to Xmx, or the Xmx value being set to 4gb (if the system in question is a 32-bit architecture).
Try modifying the flags (of course make a backup!) to test those hypothesis and iterate from there.

Installing https://copr.fedorainfracloud.org/coprs/jschwart/openjdk-7/ fixed the issue. Binaries are here https://schwart6.home.xs4all.nl/fedora25/binaries/

Related

Minecraft 1.12, server does not start. "Linux external server" [duplicate]

This question already has answers here:
How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version
(51 answers)
Closed 5 years ago.
I have a minecraft server running on a linux server i have at home, the server has been running fine in "snapshot 17w06a" for months without any issue. But now i want to update it to the "Minecraft 1.12-pre-release". I can easily set the server up locally on my PC, but when i try to run it on the server, it fails and gives the message below.
I have literally tried everything but it does not seem to work, i have even tried to copy the exact same folder that worked local on this PC onto the server. But it just won't start.
jens#clipster:~/Mc$ java -Xms1024M -Xmx2048M -jar minecraft_server.1.12.jar
Exception in thread "main" java.lang.UnsupportedClassVersionError: net/minecraft/server/MinecraftServer : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
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:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
jens#clipster:~/Mc$
I would really appreciate any help i can get, than
If you look at Java docs of UnsupportedClassVersionError class it says:
Thrown when the Java Virtual Machine attempts to read a class
file and determines that the major and minor version numbers
in the file are not supported.
So JVM on your linux server doesn't support the version of JDK used to compile the new code. Version 52, implies your new code was compiler using JDK 1.8 and my guess is your Linux server runs any older Java version and hence this error.

Eclipse latest chrome version not supported in linex

I am run in eclipse getting below error
Please Any one tell me the solution
java.lang.UnsupportedClassVersionError: org/openqa/selenium/WebDriver : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:803)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
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:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2625)
at java.lang.Class.privateGetPublicMethods(Class.java:2743)
at java.lang.Class.getMethods(Class.java:1480)
at org.testng.internal.TestNGClassFinder.(TestNGClassFinder.java:70)
at org.testng.internal.TestNGClassFinder.(TestNGClassFinder.java:40)
at org.testng.TestRunner.initMethods(TestRunner.java:400)
at org.testng.TestRunner.init(TestRunner.java:252)
at org.testng.TestRunner.init(TestRunner.java:222)
at org.testng.TestRunner.(TestRunner.java:171)
at org.testng.remote.support.RemoteTestNG6_9_10$1.newTestRunner(RemoteTestNG6_9_10.java:28)
at org.testng.remote.support.RemoteTestNG6_9_10$DelegatingTestRunnerFactory.newTestRunner(RemoteTestNG6_9_10.java:61)
at org.testng.SuiteRunner$ProxyTestRunnerFactory.newTestRunner(SuiteRunner.java:604)
at org.testng.SuiteRunner.init(SuiteRunner.java:170)
at org.testng.SuiteRunner.(SuiteRunner.java:117)
at org.testng.TestNG.createSuiteRunner(TestNG.java:1359)
at org.testng.TestNG.createSuiteRunners(TestNG.java:1346)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1200)
at org.testng.TestNG.runSuites(TestNG.java:1124)
at org.testng.TestNG.run(TestNG.java:1096)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:236)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:81)
The problem is that your Java installation is out of date.
The version number (52) is Java 8, so if you are getting an exception that says 52 is not understood, then you must be running those tests using a JVM that is Java 7 or earlier. Code that is compiled for that Java 8 platform will not run on a Java 7 (or earlier) JVM.
Java 7 is out of date, and well beyond the official "end-of-life" (April 2015) .... and you should upgrade.
If you insist on using an out-of-date Java platform for your development, then you are going to need to download the source code for the selenium libraries, and recompile them using a Java 7 compiler. (And, if selenium is starting to use Java 8 features, you will need to roll back to an earlier selenium release ... or backport.)

NoClassDefFoundError resolved by renaming the JAR file

I have a large java application running on a Red Hat Enterprise Linux server. This application has around 100 jars. On most RHEL systems the application runs fine, however, on certain RHEL systems (all RHEL versions are the same) I get a NoClassDefFoundError on startup (before my application gets a chance to do anything). If I rename the JAR file which contains the class (e.g. com-test-1.3.4.jar -> com-test-1.3.4-2.jar) everything starts up great even though the renameing doesn't change the order of the JAR in my directory listing. If I add the JAR file to the beginning of the classpath it works great. On other systems with the exact same OS/classpath/java/jars it works great. If I try to run the class that java says is missing (before renaming), java reports that the class does not have a main method so I know the class itself is loadable/findable. I have tried the latest version of Java 1.7 with no luck. The classpath is specified using the wildcard operator (e.g. CLASSPATH=/home/test/*).
The actual exception:
Exception in thread "main" java.lang.NoClassDefFoundError: com/test/testpath/TestClass
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
at java.lang.Class.getMethod0(Class.java:2774)
at java.lang.Class.getMethod(Class.java:1663)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException: com.test.testpath.TestClass
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:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 6 more

Eclipse won't stop using Java SE1.8

I have been receiving errors when trying to run a Java program with my plugin that look like this:
Caused by: java.lang.UnsupportedClassVersionError: REALDrummer/myCoreLibrary : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.7.0_55]
at java.lang.ClassLoader.defineClass(ClassLoader.java:800) ~[?:1.7.0_55]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[?:1.7.0_55]
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) ~[?:1.7.0_55]
at java.net.URLClassLoader.access$100(URLClassLoader.java:71) ~[?:1.7.0_55]
at java.net.URLClassLoader$1.run(URLClassLoader.java:361) ~[?:1.7.0_55]
at java.net.URLClassLoader$1.run(URLClassLoader.java:355) ~[?:1.7.0_55]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.7.0_55]
at java.net.URLClassLoader.findClass(URLClassLoader.java:354) ~[?:1.7.0_55]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:77) ~[spigot.jar:git-Spigot-1496]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:62) ~[spigot.jar:git-Spigot-1496]
at java.lang.ClassLoader.loadClass(ClassLoader.java:425) ~[?:1.7.0_55]
at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ~[?:1.7.0_55]
at java.lang.Class.forName0(Native Method) ~[?:1.7.0_55]
at java.lang.Class.forName(Class.java:270) ~[?:1.7.0_55]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:40) ~[spigot.jar:git-Spigot-1496]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:127) ~[spigot.jar:git-Spigot-1496]
... 6 more
From what I understand from other posts, this means that I'm compiling my plugin in Java 8 while running it on a JVM with Java 7. I know that I'm running a Java 7 JVM; I'm actually doing that on purpose to make sure that it's compatible with Java 7 for other people's use.
The problem is that I can't seem to get Eclipse to stop compiling in Java 8 and use Java 7. I have set the default JRE to Java 7 (OpenJDK Java 7) within the "Installed JREs" preference and I've noted that the Java 7 JRE is the one whose standard library now appears in the project. The Java 7 JRE is also the one that appears in the "Libraries" tab in the Java Build Path.
Despite all this, I'm still getting this error. Is there another setting I need to change to make Eclipse compile in Java 7 instead of Java 8? I don't have any Java 8 elements in my code.
Embarrassingly, I finally found the answer after I posted this question. There is in fact another setting.
Changing Project > Properties > Java Compiler > Compiler compliance level to "1.7" finally got it to compile with Java 7.

Cannot Get JOGL to run, compiles fine but error during execution

I followed the installation here:
http://jogamp.org/wiki/index.php/Setting_up_a_JogAmp_project_in_your_favorite_IDE#IntelliJ_IDEA
and
http://jogamp.org/wiki/index.php/Downloading_and_installing_JOGL
I'm using IntelliJ IDEA Community 13. Everything compiles nicely but when i go to run the code i get the error:
Exception in thread "main" java.lang.ClassNotFoundException: com.helljogl.OneTriangleSwingGLJPanel
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:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:113)
I have OpenGL and Java experience, but for some reason this is giving me a huge headache.
I've been at it for hours and have seen similar problems, but found no solutions...
Any ideas?
Rather than adding the dependencies to the project through the IDE, use maven (or Gradle). There's no need to manually download the jogl jar files and mess around with your classpath. See How to set up IntelliJIdea for development using JOGL on Linux and Windows?
After so many Installation Attempts I had jogl.jars all over the place. After cleaning up my environment everything is going smoothly!

Categories