Cannot `run-app` from intellij - grails

Cannot run-app from intellij 14, I am using grails 2.5.0
run-app outside intellij works!!
Error
"C:\Program Files\Java\jdk1.8.0_45\bin\java" -Dgrails.home=C:\opt\grails-2.5.3 -Dbase.dir=C:\Projects\SIM "-Dtools.jar=C:\Program Files\Java\jdk1.8.0_45\lib\tools.jar" -Dgroovy.starter.conf=C:\opt\grails-2.5.3/conf/groovy-starter.conf -Djline.WindowsTerminal.directConsole=false -javaagent:C:\opt\grails-2.5.3\lib\org.springframework\springloaded\jars\springloaded-1.2.4.RELEASE.jar -noverify -Dspringloaded=profile=grails;cacheDir=. -Dgrails.project.fork.run.debugArgs=-Xrunjdwp:transport=dt_socket,server=n,suspend=n,address=1326 -Dgrails.project.fork.test.debugArgs=-Xrunjdwp:transport=dt_socket,server=n,suspend=n,address=1326 -classpath "C:\Program Files (x86)\JetBrains\IntelliJ IDEA 15.0.4\lib\idea_rt.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 15.0.4\lib\util.jar" -Dfile.encoding=UTF-8 com.intellij.rt.execution.CommandLineWrapper C:\Users\shay\AppData\Local\Temp\classpath0.tmp org.codehaus.groovy.grails.cli.support.GrailsStarter --main org.codehaus.groovy.grails.cli.GrailsScriptRunner --conf C:\opt\grails-2.5.3/conf/groovy-starter.conf "run-app -plain-output"
java.lang.NoClassDefFoundError: org/springsource/loaded/ri/ReflectiveInterceptor
Error starting Grails: org/springsource/loaded/ri/ReflectiveInterceptor
at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:224)
at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:264)
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:497)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426)
at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:46)
Caused by: java.lang.ClassNotFoundException: org.springsource.loaded.ri.ReflectiveInterceptor
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 8 more
Process finished with exit code 1

Re-importing the project and changing to grails 2.5.3 fixed it.

In my case I could not change grails version due to project requirements.
When changed version from latest to jdk1.8.0_65 all became normal. So have a look if you did upgrade java or having latest one (8.0_111 in my case).

I have the same problem, I just click event log (in the button right angle) and click Configure Grails SDK select grails SDK and it start work.

Related

upgarding grails 1.1.1 to 1.2.1

I am trying to upgrade my grails project from grails 1.1.1 to grails 1.2.1.
when I am trying to run my application I am getting below error message:
I am using java 1.7._09 and GGTS 3.6.4.
This is my application.properties file:
when I am trying to add tomcat 1.2.1 in my application.properties file I am getting below error:
My GGTS is using default groovy compiler 2.3. Should I need to change the groovy complier?
I have searched in Google but I didn't understand:
search result from google
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:266)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:51)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:44)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:143)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:155)
at gant.Gant.processTargets(Gant.groovy:480)
at org.codehaus.groovy.grails.cli.GrailsScriptRunner.callPluginOrGrailsScript(GrailsScriptRunner.java:485)
at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeCommand(GrailsScriptRunner.java:301)
at org.codehaus.groovy.grails.cli.GrailsScriptRunner.main(GrailsScriptRunner.java:115)
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:601)
at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:215)
at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:240)
Caused by: java.lang.IllegalArgumentException: addChild: Child name 'grails-errorhandler' is not unique
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:781)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardContext.addChild(StandardContext.java:2128)
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:601)
at org.apache.tomcat.util.IntrospectionUtils.callMethod1(IntrospectionUtils.java:925)
at org.apache.tomcat.util.digester.SetNextRule.end(SetNextRule.java:193)
at org.apache.tomcat.util.digester.Rule.end(Rule.java:229)
at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1140)
... 438 more
startup.ContextConfig Occurred at line 7 column 422
startup.ContextConfig Marking this application unavailable due to previous error(s)
core.StandardContext Error getConfigured
core.StandardContext Context [/BASF_bdw] startup failed due to previous errors
Server running. Browse to http://localhost:8080/BASF_bdw
plugins.DefaultGrailsPluginManager Started to scan for plugin changes in every 5000ms.
I have found duplicate servlet name in .grails/***/resource/web.xml while running the run-app command in GGTS.
<servlet>
<servlet-name>grails-errorhandler</servlet-name>
<servlet-class>org.codehaus.groovy.grails.web.servlet.ErrorHandlingServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>grails-errorhandler</servlet-name>
<servlet-class>org.codehaus.groovy.grails.web.servlet.ErrorHandlingServlet</servlet-class>
</servlet>
may I know why it is generating duplicate servlet name and how to fix this ?
The blog says that you should search for every class that extends the class Exception or a subclass of it and convert it from a groovy to a java class. However, it looks like it is not your code, but the internal Grails code that throws the exception.
Looking at your previous questions, it seems your final goal is to make your war runnable in a Java 7 Environment.
You should stick to java 6 on your upgrade-journey until you hit a Grails version that just runs on Java 7.
After every successful upgrade, compile your project with Java 6 and try to run it in a servlet container that runs on Java 7. Perhaps you'r lucky and it just works.
I'm pretty sure that this will not the last problem.
I don't know how many lines of code your project has, perhaps it's an option to reimplement the whole project in grails 3.

Build the grails application war file using the jenkins is failing

I have configured the jenkins job for building the grails application war file as shown in the picture. I have checked the output console i got the following error.
Output console Error: [JENKINS-7702] sanitizing $JAVA_OPTS
[workspace] $ cmd.exe /C '"G:\practice\jenkins\tools\com.g2one.hudson.grails.GrailsInstallation\grails-2.2.4\bin\grails.bat -Dgrails.work.dir=/G:/practice/jenkins/jobs/Grails-Jenkins/workspace//target clean --non-interactive --plain-output && exit %%ERRORLEVEL%%"'
Can't load log handler "1catalina.org.apache.juli.FileHandler"
java.lang.ClassNotFoundException: 1catalina.org.apache.juli.FileHandler
java.lang.ClassNotFoundException: 1catalina.org.apache.juli.FileHandler
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.util.logging.LogManager$4.run(LogManager.java:808)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.loadLoggerHandlers(LogManager.java:802)
at java.util.logging.LogManager.addLogger(LogManager.java:1008)
at java.util.logging.LogManager$1.run(LogManager.java:209)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.<clinit>(LogManager.java:181)
at java.util.logging.Logger.demandLogger(Logger.java:339)
at java.util.logging.Logger.getLogger(Logger.java:393)
at org.codehaus.groovy.runtime.DefaultGroovyMethodsSupport.<clinit>(DefaultGroovyMethodsSupport.java:33)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:96)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:73)
at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:33)
at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:62)
at groovy.lang.GroovyObjectSupport.<init>(GroovyObjectSupport.java:32)
at groovy.lang.Closure.<init>(Closure.java:221)
at groovy.lang.Closure.<init>(Closure.java:238)
at groovy.lang.Closure$1.<init>(Closure.java:205)
at groovy.lang.Closure.<clinit>(Closure.java:205)
at org.codehaus.groovy.grails.cli.GrailsScriptRunner.<clinit>(GrailsScriptRunner.java:84)
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.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:234)
at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:262)
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.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:234)
at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:262)
Please assist me on the grails build configuration.
Refresh dependiences before compile:
clean refresh-dependencies "war target/ROOT.war"
btw we usually use field Exec command and add there custom bash script to control flow and place of generated files.
Updated:
Basing on this thread:
That looks like your logging.properties file contains invalid
settings.
or
It appears that the JMX agent is using Tomcat's logging.properties but
with the unmodified java.util.logging package from the JRE rather than
JULI from Tomcat. Can you show us what the eventual command line is
that launches Tomcat? The parameter specifying
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager looks like it's missing.

Exception in thread "main" java.lang.ClassNotFoundException: org.codehaus.groovy.grails.cli.support.GrailsStarter in Intellij using grails 3.0.0

I imported a Grails project in IntelliJ 14.1 and I got this exception when I tried to run the project using run-app command:
C:\Program Files\Java\jdk1.8.0_40\bin\java" -Dgrails.home=C:\grails-3.0.0 -Dbase.dir=E:\Aurora\Cloned\funned\src300\papafund-web "-Dtools.jar=C:\Program Files\Java\jdk1.8.0_40\lib\tools.jar" -Dgroovy.starter.conf=C:\grails-3.0.0/conf/groovy-starter.conf -Xmx768M -Xms768M -XX:MaxPermSize=256m -XX:PermSize=256m -Djline.WindowsTerminal.directConsole=false -javaagent:C:\grails-3.0.0\lib\org.springframework\springloaded\jars\springloaded-1.2.3.RELEASE.jar -noverify -Dspringloaded=profile=grails -Didea.launcher.port=7532 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.1\bin" -Dfile.encoding=windows-1252 -classpath "C:\grails-3.0.0\dist\grails-bootstrap-3.0.0.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.1\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.groovy.grails.cli.support.GrailsStarter --main org.codehaus.groovy.grails.cli.GrailsScriptRunner --conf C:\grails-3.0.0/conf/groovy-starter.conf "run-app -plain-output"
Exception in thread "main" java.lang.ClassNotFoundException: org.codehaus.groovy.grails.cli.support.GrailsStarter
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)
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=256m; support was removed in 8.0
Process finished with exit code 1
IntelliJ doesn't support Grails 3 yet - it has been requested in their bug tracker.
You can easily run the app from a commandline and use the IDE as an editor.
Intellij Idea 15 supports Grails 3 or higher. You can see from the following:
https://www.jetbrains.com/help/idea/2016.1/getting-started-with-grails-3.html

Cannot build maven application on Jenkins with JDK1.5

I am trying to build a maven 2.2.1 project on Jenkins ver. 1.596. The project uses JDK 1.5 and it is not an option to upgrade to a newer JDK.
When building the project I get the following stacktrace:
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
at hudson.maven.agent.Main.main(Main.java:143)
at hudson.maven.agent.Main.main(Main.java:68)
I have seen a lot of posts about this issue with Jenkins and JDK1.5, but noone has come up with a solution. Hope that somebody has found a workaround.
Regards
Steffen

workspace corrupted grails 2.2.4, Intellij Idea 12.1.4, Windows 7

Somehow my workspace is corrupted. When I try to run my app in the intellij IDEA I get the following error:
"C:\Program Files\Java\jdk1.7.0_40\bin\java" -Dgrails.home=C:\catalysts\sdks\grails\grails-2.2.4\grails-2.2.4 -Dbase.dir=C:\catalysts\src\mediacenter\mm-web "-Dtools.jar=C:\Program Files\Java\jdk1.7.0_40\lib\tools.jar" -Dgroovy.starter.conf=C:\catalysts\sdks\grails\grails-2.2.4\grails-2.2.4/conf/groovy-starter.conf -Xmx768M -Xms768M -XX:MaxPermSize=256m -XX:PermSize=256m -Djline.WindowsTerminal.directConsole=false -javaagent:C:\catalysts\sdks\grails\grails-2.2.4\grails-2.2.4\lib\org.springsource.springloaded\springloaded-core\jars\springloaded-core-1.1.3.jar -noverify -Dspringloaded=profile=grails -Didea.launcher.port=7535 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.1.4\bin" -classpath "C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.1.4\lib\idea_rt.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.1.4\lib\util.jar" -Dfile.encoding=UTF-8 com.intellij.rt.execution.CommandLineWrapper C:\Users\Catalysts\AppData\Local\Temp\classpath4359768120270928639.tmp com.intellij.rt.execution.application.AppMain org.codehaus.groovy.grails.cli.support.GrailsStarter --main org.codehaus.groovy.grails.cli.GrailsScriptRunner --conf C:\catalysts\sdks\grails\grails-2.2.4\grails-2.2.4/conf/groovy-starter.conf run-app
Exception in thread "main" java.lang.reflect.InvocationTargetException
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.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1259)
at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:121)
Caused by: java.lang.NoClassDefFoundError: org/springsource/loaded/ri/ReflectiveInterceptor
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:113)
... 6 more
Caused by: java.lang.ClassNotFoundException: org.springsource.loaded.ri.ReflectiveInterceptor
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:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
Process finished with exit code 1
Test cases work fine, I also can start the app with run-app in the intellij console (CTRL+Alt+G).
I hope you might can help me.
delete folder ~/.grails/.slcache
I recently was getting the exact same error (latest versions at this time: IDEA 14/grails 2.4.4). After fighting with it for a bit I recalled being asked a question earlier (by IDEA) something about the classpath, which I just blindly answered yes to. Trying to find this setting led me to this question: What does the dynamic.classpath flag do? (IntelliJ project settings)
After editing my .iws file and setting dynamic classpath back to false the 'ClassNotFoundException: org.springsource.loaded.ri.ReflectiveInterceptor' went away.
IntelliJ Idea needs to be upgraded to the last version

Resources