Hot questions for Using Ubuntu in groovy

Question:

I am runnig into an error when trying to start the groovy-shell on ubuntu (Ubuntu 18.04.1 LTS):

Version is

falk@falkpc:~$ groovysh -version
@|green Groovy Shell|@ 2.4.15

But calling groovysh fails:

falk@falkpc:~$ groovysh 
Gtk-Message: 18:37:05.964: Failed to load module "canberra-gtk-module"
FATAL: java.lang.NoSuchMethodError: java.nio.ByteBuffer.limit(I)Ljava/nio/ByteBuffer;
java.lang.NoSuchMethodError: java.nio.ByteBuffer.limit(I)Ljava/nio/ByteBuffer;
    at jline.internal.InputStreamReader.<init>(InputStreamReader.java:104)
    at jline.console.ConsoleReader.setInput(ConsoleReader.java:330)
    at jline.console.ConsoleReader.<init>(ConsoleReader.java:248)
    at jline.console.ConsoleReader.<init>(ConsoleReader.java:236)
    at jline.console.ConsoleReader.<init>(ConsoleReader.java:228)
    at org.codehaus.groovy.tools.shell.PatchedConsoleReader.<init>(PatchedConsoleReader.groovy:31)
    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.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83)
    at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:59)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:238)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:258)
    at org.codehaus.groovy.tools.shell.InteractiveShellRunner.<init>(InteractiveShellRunner.groovy:56)
    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.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83)
    at org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke(CachedConstructor.java:77)
    at org.codehaus.groovy.runtime.callsite.ConstructorSite.callConstructor(ConstructorSite.java:45)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:59)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:238)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:258)
    at org.codehaus.groovy.tools.shell.Groovysh.run(Groovysh.groovy:588)
    at org.codehaus.groovy.tools.shell.Groovysh$run$0.callCurrent(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:157)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:169)
    at org.codehaus.groovy.tools.shell.Groovysh.run(Groovysh.groovy:574)
    at org.codehaus.groovy.tools.shell.Groovysh$run.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:136)
    at org.codehaus.groovy.tools.shell.Main.startGroovysh(Main.groovy:184)
    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 org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:71)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:136)
    at org.codehaus.groovy.tools.shell.Main.main(Main.groovy:150)
    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 org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:116)
    at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:138)

I was using this installation successfully for a while. I have no clue which change causes this behaviour.

Any ideas anyone?

Edit: the line "Gtk-Message: ..." no longer appers after installing

sudo apt install libcanberra-gtk-module

However this does not yet fix the error.


Answer:

You need to run groovysh using Java 9 (see https://github.com/blynkkk/blynk-server/issues/752)

If you don't mind upgrading to the latest version then do:

# install Java 11 OpenJDK
sudo apt install openjdk-11-jdk

# update JAVA_HOME (you can get dir via: update-java-alternatives -l)
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64

groovysh

Question:

I am using Intellij on ubuntu:

IntelliJ IDEA 2018.2.5 (Ultimate Edition)
Build #IU-182.4892.20, built on October 16, 2018
Subscription is active until November 3, 2018
JRE: 1.8.0_152-release-1248-b19 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.15.0-38-generic

Recently I began running into the following error appearing after a couple of seconds after startup of IntelliJ: The editor freezes. Killing the process and starting again allows to get an error message about the last crash:

java.lang.StackOverflowError
    at com.intellij.util.CachedValueBase.isDependencyOutOfDate(CachedValueBase.java:138)
    at com.intellij.psi.impl.PsiCachedValue.isDependencyOutOfDate(PsiCachedValue.java:74)
    at com.intellij.util.CachedValueBase.isUpToDate(CachedValueBase.java:128)
    at com.intellij.psi.impl.PsiCachedValue.isUpToDate(PsiCachedValue.java:65)
    at com.intellij.util.CachedValueBase.getUpToDateOrNull(CachedValueBase.java:107)
    at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:214)
    at com.intellij.psi.impl.PsiCachedValue.getValueWithLock(PsiCachedValue.java:60)
    at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:38)
    at com.android.tools.idea.databinding.DataBindingProjectComponent.getDataBindingEnabledFacets(DataBindingProjectComponent.java:96)
    at com.android.tools.idea.databinding.DataBindingProjectComponent.hasAnyDataBindingEnabledFacet(DataBindingProjectComponent.java:92)
    at com.android.tools.idea.databinding.BrClassFinder.isEnabled(BrClassFinder.java:95)
    at com.android.tools.idea.databinding.BrClassFinder.findClass(BrClassFinder.java:54)
    at com.intellij.psi.impl.JavaPsiFacadeImpl.doFindClass(JavaPsiFacadeImpl.java:125)
    at com.intellij.psi.impl.JavaPsiFacadeImpl.findClass(JavaPsiFacadeImpl.java:102)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiManager.createTypeByFQClassName(GroovyPsiManager.java:88)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GrMapTypeFromNamedArgs.getAllKeyTypes(GrMapTypeFromNamedArgs.java:119)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GrMapType$1.compute(GrMapType.java:31)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GrMapType$1.compute(GrMapType.java:27)
    at com.intellij.openapi.util.VolatileNotNullLazyValue.getValue(VolatileNotNullLazyValue.java:34)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GrMapType.getParameters(GrMapType.java:80)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GrLiteralClassType.getCanonicalText(GrLiteralClassType.java:128)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil.getQualifiedName(TypesUtil.java:838)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil.getLeastUpperBound(TypesUtil.java:474)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil.getLeastUpperBoundNullable(TypesUtil.java:395)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GrLiteralClassType.getLeastUpperBound(GrLiteralClassType.java:178)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GrMapType$1.compute(GrMapType.java:37)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GrMapType$1.compute(GrMapType.java:27)
    at com.intellij.openapi.util.VolatileNotNullLazyValue.getValue(VolatileNotNullLazyValue.java:34)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GrMapType.getParameters(GrMapType.java:80)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GrLiteralClassType.getCanonicalText(GrLiteralClassType.java:128)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil.getQualifiedName(TypesUtil.java:838)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil.getLeastUpperBound(TypesUtil.java:474)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil.getLeastUpperBoundNullable(TypesUtil.java:395)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GrLiteralClassType.getLeastUpperBound(GrLiteralClassType.java:178)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GrMapType$1.compute(GrMapType.java:37)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GrMapType$1.compute(GrMapType.java:27)
    at com.intellij.openapi.util.VolatileNotNullLazyValue.getValue(VolatileNotNullLazyValue.java:34)

The stack trace continues, repeating like that for hundreds of times. Any clues how to fix this?

Edit: As recommended in a comment I disabled the Android-Plugin. The error still occurs in a similar fashion. Just the first couple of lines did change:

java.lang.StackOverflowError
    at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936)
    at com.intellij.util.pico.DefaultPicoContainer.getFromCache(DefaultPicoContainer.java:66)
    at com.intellij.util.pico.DefaultPicoContainer.getComponentInstance(DefaultPicoContainer.java:212)
    at com.intellij.openapi.components.ServiceManager.doGetService(ServiceManager.java:47)
    at com.intellij.openapi.components.ServiceManager.getService(ServiceManager.java:30)
    at com.intellij.openapi.roots.ProjectFileIndex.getInstance(ProjectFileIndex.java:44)
    at com.intellij.openapi.roots.ProjectFileIndex$SERVICE.getInstance(ProjectFileIndex.java:38)
    at com.intellij.openapi.roots.impl.ProjectRootManagerImpl.getFileIndex(ProjectRootManagerImpl.java:123)
    at com.intellij.psi.impl.search.JavaSourceFilterScope.<init>(JavaSourceFilterScope.java:49)
    at com.intellij.psi.impl.search.JavaSourceFilterScope.<init>(JavaSourceFilterScope.java:38)
    at com.intellij.lang.aspectj.search.AjSourceFilterScope.<init>(AjSourceFilterScope.java:22)
    at com.intellij.lang.aspectj.index.stub.AjShortClassNameIndex.get(AjShortClassNameIndex.java:29)
    at com.intellij.lang.aspectj.search.AjClassFinder.findClass(AjClassFinder.java:23)
    at com.intellij.psi.impl.JavaPsiFacadeImpl.doFindClass(JavaPsiFacadeImpl.java:125)
    at com.intellij.psi.impl.JavaPsiFacadeImpl.findClass(JavaPsiFacadeImpl.java:102)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GrLiteralClassType.resolve(GrLiteralClassType.java:149)
    at com.intellij.psi.PsiPrimitiveType.getUnboxedType(PsiPrimitiveType.java:180)
    at com.intellij.psi.PsiPrimitiveType.getOptionallyUnboxedType(PsiPrimitiveType.java:191)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil.getNumericLUB(TypesUtil.java:484)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil.getLeastUpperBound(TypesUtil.java:412)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil.getLeastUpperBoundNullable(TypesUtil.java:395)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GrLiteralClassType.getLeastUpperBound(GrLiteralClassType.java:178)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GrMapType$1.compute(GrMapType.java:37)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GrMapType$1.compute(GrMapType.java:27)
    at com.intellij.openapi.util.VolatileNotNullLazyValue.getValue(VolatileNotNullLazyValue.java:34)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GrMapType.getParameters(GrMapType.java:80)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GrLiteralClassType.getCanonicalText(GrLiteralClassType.java:128)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil.getQualifiedName(TypesUtil.java:838)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil.getLeastUpperBound(TypesUtil.java:474)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil.getLeastUpperBoundNullable(TypesUtil.java:395)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GrLiteralClassType.getLeastUpperBound(GrLiteralClassType.java:178)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GrMapType$1.compute(GrMapType.java:37)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GrMapType$1.compute(GrMapType.java:27)
    at com.intellij.openapi.util.VolatileNotNullLazyValue.getValue(VolatileNotNullLazyValue.java:34)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GrMapType.getParameters(GrMapType.java:80)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GrLiteralClassType.getCanonicalText(GrLiteralClassType.java:128)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil.getQualifiedName(TypesUtil.java:838)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil.getLeastUpperBound(TypesUtil.java:474)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil.getLeastUpperBoundNullable(TypesUtil.java:395)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GrLiteralClassType.getLeastUpperBound(GrLiteralClassType.java:178)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GrMapType$1.compute(GrMapType.java:37)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GrMapType$1.compute(GrMapType.java:27)
    at com.intellij.openapi.util.VolatileNotNullLazyValue.getValue(VolatileNotNullLazyValue.java:34)

Answer:

Thanks to the IntelliJ support, this issue was resolved. I did deactivate and later reactivate the groovy-Plugin. After that the problem no longer appeared.

Question:

I installed Ubuntu 12.04(precise)64-bit alongside MacBookPro OS which its processor :Intel® Core™ i5-3210M CPU @ 2.50GHz × 4. Then I am trying for several days to install eucalyptus 3.2.0 by following this guide.

When I reached the build phase, it failed due to this issue :

 BUILD FAILED
/home/asma/eucalyptus-3.2.0/clc/build.xml:111: The following error occurred while executing this line:
java.lang.UnsupportedClassVersionError: org/codehaus/groovy/ant/Groovy : Unsupported major.minor version 51.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:643)
    at org.apache.tools.ant.AntClassLoader.defineClassFromData(AntClassLoader.java:1124)
    at org.apache.tools.ant.AntClassLoader.getClassFromStream(AntClassLoader.java:1295)
    at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1351)
    at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1311)
    at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1064)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
    at org.apache.tools.ant.AntTypeDefinition.innerGetTypeClass(AntTypeDefinition.java:194)
    at org.apache.tools.ant.AntTypeDefinition.getTypeClass(AntTypeDefinition.java:168)
    at org.apache.tools.ant.AntTypeDefinition.icreate(AntTypeDefinition.java:215)
    at org.apache.tools.ant.AntTypeDefinition.create(AntTypeDefinition.java:206)
    at org.apache.tools.ant.ComponentHelper.createComponent(ComponentHelper.java:286)
    at org.apache.tools.ant.ComponentHelper.createComponent(ComponentHelper.java:264)
    at org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:417)
    at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:163)
    at org.apache.tools.ant.Task.perform(Task.java:347)
    at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:622)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:622)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:390)
    at org.apache.tools.ant.Target.performTasks(Target.java:411)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
    at org.apache.tools.ant.Main.runBuild(Main.java:809)
    at org.apache.tools.ant.Main.startAnt(Main.java:217)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

Total time: 0 seconds
make[1]: *** [build] Error 1
make[1]: Leaving directory `/home/asma/eucalyptus-3.2.0/clc'
make: *** [build] Error 2

Ff course I searched and googled, but all solutions state that make sure that java and javac versions are the same since this issue occurs when with java version of compile and run is conflicting. I have the same version for java and javac which is :

asma@asma-MacBookPro:~$ java -version
java version "1.6.0_31"
OpenJDK Runtime Environment (IcedTea6 1.13.3) (6b31-1.13.3-1ubuntu1~0.12.04.2)
OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)
asma@asma-MacBookPro:~$ javac -version 
javac 1.6.0_31

Here is ant version :

asma@asma-MacBookPro:~$ ant -version 
Apache Ant(TM) version 1.8.2 compiled on December 3 2011

I have only openjdk-6-jdk installed on my Ubuntu right now and I removed java7. Also I tried to have only openjdk-7-jdk but the build still was not successful.

What would be the reason for this error ? Any thoughts or suggestions? May I need to alter build.xml?


Answer:

During the build process for Eucalyptus, it will perform a submodule checkout of github.com/euaclyptus/eucalyptus-cloud-libs which contains the jars necessary to build from source. When building older versions of Eucalyptus, it doesn't always checkout the correct tag/branch for cloud-libs. If you go into eucalyptus/clc/lib and do a git status you should be able to see which branch is checked out. If it is #testing, then the build will not work because the dependencies have changed quite a bit since 3.2.0. I believe there is a tag for 3.2.2 that may work correctly. Because of the way that the build process does the checkout on that folder, it may not be as easy as doing git checkout. Instead, you may have to delete that folder and manually checkout the eucalyptus-cloud-libs repository which is a large-ish download.

Btw - while working on Eucalyptus, we use Java7, so you are better off installing it instead of 6.

If you are building from source, I would suggest trying to build from #testing, rather than an older release. Although Ubuntu is not supported, I have built Eucalyptus and run it on Ubuntu in the past. That guide is as good as any, but be prepared to perform some hackery. I vaguely remember commenting out some unit tests in Makefiles to make the build succeed.