Cannot build Grails app in Eclipse with Java 1.8 - eclipse

I've inherited a Grails project and am trying to build it in eclipse with Java 1.8. I can successfully build a war file with Java 1.7 but when I switch to 1.8 and rebuild I get the following error:
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
| Error java.lang.reflect.InvocationTargetException
| Error at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
| Error at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
| Error at java.lang.reflect.Method.invoke(Method.java:483)
| Error at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:234)
| Error at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:262)
| Error Caused by: java.lang.NoClassDefFoundError: [Ljava/util/HashMap$Entry;
| Error at java.lang.Class.getDeclaredMethods0(Native Method)
| Error at java.lang.Class.privateGetDeclaredMethods(Class.java:2693)
| Error at java.lang.Class.getDeclaredMethods(Class.java:1967)
| Error at org.codehaus.groovy.reflection.CachedClass$3$1.run(CachedClass.java:84)
| Error at java.security.AccessController.doPrivileged(Native Method)
| Error at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:81)
| Error at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:79)
| Error at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
| Error at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
| Error at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:250)
| Error at groovy.lang.MetaClassImpl.populateMethods(MetaClassImpl.java:334)
| Error at groovy.lang.MetaClassImpl.fillMethodIndex(MetaClassImpl.java:284)
| Error at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:2928)
| Error at groovy.lang.ExpandoMetaClass.initialize(ExpandoMetaClass.java:483)
| Error at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:166)
| Error at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:182)
| Error at groovy.util.ConfigObject.$getStaticMetaClass(ConfigObject.groovy)
| Error at groovy.util.ConfigObject.<init>(ConfigObject.groovy)
| Error at grails.util.AbstractBuildSettings.<init>(AbstractBuildSettings.java:33)
| Error at grails.util.BuildSettings.<init>(BuildSettings.groovy)
| Error at grails.util.BuildSettings.<init>(BuildSettings.groovy:749)
| Error at org.codehaus.groovy.grails.cli.GrailsScriptRunner.main(GrailsScriptRunner.java:164)
| Error ... 6 more
| Error Caused by: java.lang.ClassNotFoundException: java.util.HashMap$Entry
| Error at org.codehaus.groovy.tools.RootLoader.findClass(RootLoader.java:156)
| Error at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
| Error at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:128)
| Error at org.codehaus.groovy.grails.cli.support.GrailsRootLoader.loadClass(GrailsRootLoader.java:48)
| Error at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
| Error ... 28 more
I've tried downgrading to java 1.8 u31 and even u25 as suggested by other posts, but I still get the same error. I've also tried in Windows & Linux – same error.
I'm using grails version 2.1.2, could that have something to do with it?
I'm brand new to grails, is it possible there is some config in the project that is causing the problem?

Because Grails v2.1.2 does not support java8. Java8 support is available from 2.4.x onwards.
Ref# GRAILS-11063

Related

How to install camel-http feature on Karaf

I am using Fuse 7.7 on Apache Karaf.
I am getting this error
2020-09-28 18:08:57,689 | ERROR | lueprint Extender: 2 | o.a.a.b.c.BlueprintContainerImpl | 51 - org.apache.aries.blueprint.core - 1.10.2 |
Unable to start container for blueprint bundle com.esb.iis-to-rm-vr/1.0.0 due to unresolved dependencies [(&(component=http)(objectClass=org.apache.camel.spi.ComponentResolver))]
java.util.concurrent.TimeoutException: null
I did the below steps. camel-http is not installed.
karaf#root()> features:install camel-http
karaf#root()> features:list | grep camel-http
camel-http4
karaf#root()> list | grep camel-http
67 | Active | 50 | 2.21.0.fuse-770013-redhat-00001 | camel-http-common
255 | Active | 50 | 2.21.0.fuse-770013-redhat-00001 | camel-http4
Please let me know apart from the below step, what are the steps i need to follow to install camel-http.
karaf#root()> features:install camel-http
Be careful that camel-http is only meant to be a producer. You won't be able to do from("http://...") only with him. To be able to do it, you need to add a camel component that will allow your route to bind itself to the karaf's jetty. You can try to install camel-jetty.
Moreover, you're feature:list | grep camel-http seemed to have only returned camel-http4. I'm note sure camel-http feature has been dropped, but you could always install http4 component

Reading sbt dependency tree

I'm upgrading some libraries within a Play! project. During the process I'm trying to resolve errors like this:
java.lang.ClassNotFoundException: akka.event.slf4j.Slf4jLoggingFilter
Which I am assuming comes from incompatible transitive dependencies?
But I'm struggling to effectively use sbt-dependency-graph to help me track down the problem.
[info] +-ch.qos.logback:logback-classic:1.1.3
[info] | +-ch.qos.logback:logback-core:1.1.3
[info] | +-org.slf4j:slf4j-api:1.7.21
[info] | +-org.slf4j:slf4j-api:1.7.7 (evicted by: 1.7.21)
Why are there 2 versions of slf4j-api listed 👆🏻
I'm assuming, the newer version (1.7.21) is taking precedence over 1.7.7 But then, why in some instances, do I see as many as 5 different versions of the same dependency (all but 1 evicted):
| | | | +-org.slf4j:slf4j-ext:1.7.12
| | | | +-ch.qos.cal10n:cal10n-api:0.8.1
| | | | +-org.slf4j:slf4j-api:1.6.2 (evicted by: 1.7.21)
| | | | +-org.slf4j:slf4j-api:1.6.4 (evicted by: 1.7.21)
| | | | +-org.slf4j:slf4j-api:1.7.12 (evicted by: 1.7.21)
| | | | +-org.slf4j:slf4j-api:1.7.2 (evicted by: 1.7.21)
| | | | +-org.slf4j:slf4j-api:1.7.21
Once the conflict is found -- do I need to upgrade all dependencies to be using the same version?
Is there another approach I should be taking?
Discovered that "the SLF4J API is backward compatible for all versions". Despite java.lang.ClassNotFoundException being called from an slf4j. So digging a little deeper:
Akka Kindly provides binary compatibility rules which show that backwards compatibility is violated between major versions.
Looking at the dependency tree we were seeing different major versions of akka dependencies (2.3.x and 2.4.x): com.typesafe.akka:akka-actor_2.11:2.3.13 (evicted by: 2.4.11) and com.typesafe.akka:akka-slf4j_2.11:2.3.13
Standardizing all akka dependencies around a major version fixed it:
Our original dependencies only provided the "com.typesafe.akka" %% "akka-actor" % "2.4.11" and play was providing "akka-slf4j" % "2.3.13" transitively which was breaking binary compatibility.
+-com.typesafe.akka:akka-slf4j_2.11:2.3.13 [S]
| +-com.typesafe.akka:akka-actor_2.11:2.3.13 (evicted by: 2.4.11)
Providing both akka-slf4j and akka-actor with the same major version solved this issue.

GGTS 3.2 console timout failure on new Grails project

I tried upgrading to GGTS 3.2 on windows7 64bit and java 7.0.21. running on works pc with a proxy config enabled in internet settings
i create a new project in a new workspace. I then try and run the console for the app.
the console fires up and you can use for ~60 seconds. After that the sts ide throws a timeout error and the console is killed
error in log looks like this :
!ENTRY org.grails.ide.eclipse.core 4 0 2013-06-18 22:08:15.103
!MESSAGE Problem executing: console
!STACK 1
org.eclipse.core.runtime.CoreException: The command 'C:\Program Files (x86)\Java\jdk1.7.0_21\bin\javaw.exe (18 Jun 2013 22:06:14)' was terminated because it didn't produce new output for some time.
See details for the output produced so far.
If you think the command simply needed more time, you can increase the time limit in the Grails preferences page.
See menu Windows >> Preferences >> Grails >> Launch
at org.grails.ide.eclipse.core.launch.SynchLaunch$LaunchResult.getCoreException(SynchLaunch.java:168)
at org.grails.ide.eclipse.core.launch.SynchLaunch.synchExec(SynchLaunch.java:57)
at org.grails.ide.eclipse.commands.GrailsExecutor.synchExec(GrailsExecutor.java:131)
at org.grails.ide.eclipse.commands.GrailsCommand.synchExec(GrailsCommand.java:169)
at org.grails.ide.eclipse.ui.internal.inplace.GrailsLaunchUtils$1.run(GrailsLaunchUtils.java:120)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Contains: ------System.out:-----------
| Loading Grails 2.2.1
| Configuring classpath.
| Environment set to development.....
| Packaging Grails application....
| Compiling 1 source files.....
| Packaging Grails application.
| Compiling 1 source files.....
Contains: ------System.err:-----------
Terminating process: Timeout: no new output for 60000 milliseconds
!SUBENTRY 1 org.grails.ide.eclipse.core 4 4 2013-06-18 22:08:15.103
!MESSAGE The command 'C:\Program Files (x86)\Java\jdk1.7.0_21\bin\javaw.exe (18 Jun 2013 22:06:14)' was terminated because it didn't produce new output for some time.
See details for the output produced so far.
If you think the command simply needed more time, you can increase the time limit in the Grails preferences page.
See menu Windows >> Preferences >> Grails >> Launch
!SUBENTRY 2 org.grails.ide.eclipse.core 4 0 2013-06-18 22:08:15.103
!MESSAGE ------System.out:-----------
| Loading Grails 2.2.1
| Configuring classpath.
| Environment set to development.....
| Packaging Grails application....
| Compiling 1 source files.....
| Packaging Grails application.
| Compiling 1 source files.....
!SUBENTRY 2 org.grails.ide.eclipse.core 4 0 2013-06-18 22:08:15.103
!MESSAGE ------System.err:-----------
Terminating process: Timeout: no new output for 60000 milliseconds
There was something like this is the sts/ggts forum which claimed it had been fixed in 3.3m2. and might have been to do with pref>groovy>grails>launch - keep running flag - however i enebaled and diabsled this and it made no difference
i tried installing 3.3m2 and tried the same - new workspace - new project. I run the console, 60 seconds later i get a timeout buty the console stays up - error now reads
| Configuring classpath.
| Environment set to development.....
| Packaging Grails application....
| Compiling 1 source files.....
| Packaging Grails application.
| Compiling 1 source files.....
Contains: ------System.err:-----------
!SUBENTRY 1 org.grails.ide.eclipse.core 4 4 2013-06-18 23:27:11.110
!MESSAGE Command terminated with an exception: java.io.IOException: Cannot run program "jps": CreateProcess error=2, The system cannot find the file specified (see details for partial output)
!STACK 0
java.io.IOException: Cannot run program "jps": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
at org.grails.ide.eclipse.longrunning.client.GrailsProcessStackTracer.exec(GrailsProcessStackTracer.java:104)
at org.grails.ide.eclipse.longrunning.client.GrailsProcessStackTracer.getGrailsProcessId(GrailsProcessStackTracer.java:72)
at org.grails.ide.eclipse.longrunning.client.GrailsProcessStackTracer.getStackTraces(GrailsProcessStackTracer.java:92)
at org.grails.ide.eclipse.longrunning.client.GrailsClient.executeCommand(GrailsClient.java:381)
at org.grails.ide.eclipse.longrunning.client.GrailsCommandExecution.execute(GrailsCommandExecution.java:85)
at org.grails.ide.eclipse.longrunning.LongRunningProcessGrailsExecutor.synchExec(LongRunningProcessGrailsExecutor.java:82)
at org.grails.ide.eclipse.commands.GrailsCommand.synchExec(GrailsCommand.java:169)
at org.grails.ide.eclipse.ui.internal.inplace.GrailsLaunchUtils$1.run(GrailsLaunchUtils.java:127)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 10 more
!SUBENTRY 2 org.grails.ide.eclipse.core 4 0 2013-06-18 23:27:11.110
!MESSAGE ------System.out:-----------
Loading Grails 2.2.2
| Configuring classpath.
| Environment set to development.....
| Packaging Grails application....
| Compiling 1 source files.....
| Packaging Grails application.
| Compiling 1 source files.....
!SUBENTRY 2 org.grails.ide.eclipse.core 4 0 2013-06-18 23:27:11.110
!MESSAGE ------System.err:-----------
Any one else had this and is there a workaround?
The "Execute Grails Command" function wasn't designed to support persistent processes. It worked previously by chance, but no longer does.
The recommended way to execute long-running grails processes in Eclipse/STS/GGTS is to configure an eclipse run configuration to execute the long-running grails commands. (Run -> Run Configurations...)

Unable to run unit test in GGTS 3.2 with grails 2.2.1

I've had an auto-generated unit test file as follows:
package com.yuanjianlvye.szws
import grails.test.mixin.*
import org.junit.*
/**
* See the API for {#link grails.test.mixin.services.ServiceUnitTestMixin} for usage instructions
*/
#TestFor(ScreenResolutionService)
class ScreenResolutionServiceTests {
void testSomething() {
fail "Implement me"
}
}
If I run the unit test with grails command in GGTS as follows: "test-app com.yuanjianlvye.szws.ScreenResolutionService", I can get the expected answer.
Loading Grails 2.2.1
| Environment set to test.....
| Compiling 1 source files..
| Compiling 1 source files.....
| Running 1 unit test... 1 of 1
| Failure: testSomething(com.yuanjianlvye.szws.ScreenResolutionServiceTests)
| junit.framework.AssertionFailedError: Implement me
at junit.framework.Assert.fail(Assert.java:50)
at com.yuanjianlvye.szws.ScreenResolutionServiceTests.testSomething(ScreenResolutionServiceTests.groovy:15)
| Completed 1 unit test, 1 failed in 207ms
However, if I run the unit test by right clicking the file and select "Run As->JUnit Test" in the popup menu, I got the following error message:
Class not found com.yuanjianlvye.szws.ScreenResolutionServiceTests
java.lang.ClassNotFoundException: com.yuanjianlvye.szws.ScreenResolutionServiceTests
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)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:693)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:429)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Does anybody have any idea about this?
I've experienced this periodically. Stopping any 'grails run-app' commands from running in the background and cleaning the app using the 'Project/Clean...' menu option sometimes helps.

failed to start error while executing apache archiva

I have installed apache archiva stand alone in my system.But when i try to start it,itshows the error apache archiva failed to start.My codes are given below
D:\apache-archiva-1.3.5>java -version
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)
D:\apache-archiva-1.3.5>PATH=c:\Windows\system32;C:\Program Files (x86)\Java\jdk
1.6.0_10\bin
D:\apache-archiva-1.3.5>PATH=c:\Windows\system32;C:\Program Files (x86)\Java\jdk
1.6.0_10\bin;D:\apache-archiva-1.3.5\bin
D:\apache-archiva-1.3.5>archiva.bat install
wrapper | Apache Archiva installed.
D:\apache-archiva-1.3.5>archiva.bat start
wrapper | Starting the Apache Archiva service...
wrapper | The Apache Archiva service was launched, but failed to start.
Press any key to continue . . .
Instead of using
C:\apache-archiva-2.2.1\bin>archiva start
if you use console it will work.
C:\apache-archiva-2.2.1\bin>archiva console
wrapper | --> Wrapper Started as Console
wrapper | Launching a JVM...
jvm 1 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
jvm 1 | Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
jvm 1 |
jvm 1 | 2016-06-05 01:11:49.022:WARN:oejd.ContextDeployer:ContextDeployer is deprecated. Use ContextProvider
jvm 1 | 2016-06-05 01:11:49.022:WARN:oejd.WebAppDeployer:WebAppDeployer is deprecated. Use WebAppProvider
jvm 1 | 2016-06-05 01:11:49.147:INFO:oejs.Server:jetty-8.1.14.v20131031
jvm 1 | 2016-06-05 01:11:49.178:INFO:oejs.NCSARequestLog:Opened C:\apache-archiva-2.2.1\logs\request-20160604.log
jvm 1 | 2016-06-05 01:11:49.225:INFO:oejd.ContextDeployer:Deploy C:\apache-archiva-2.2.1\contexts\archiva.xml -> o.e.j.w.WebAppContext{/,null},C:\apache-archiva-2.2.1/apps/archiva
jvm 1 | 2016-06-05 01:11:53.149:INFO:oejpw.PlusConfiguration:No Transaction manager found - if your webapp requires one, please configure one.
jvm 1 | 2016-06-05 01:11:53.453:INFO:oejw.StandardDescriptorProcessor:NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet
jvm 1 | 2016-06-05 01:11:54.755:INFO:/:Initializing Spring root WebApplicationContext
jvm 1 | Jun 05, 2016 1:12:09 AM org.apache.tomcat.jdbc.pool.ConnectionPool init
jvm 1 | WARNING: maxIdle is larger than maxActive, setting maxIdle to: 20
jvm 1 | 2016-06-05 01:12:25.275:INFO:oejs.AbstractConnector:Started SelectChannelConnector#0.0.0.0:8080