无法 运行 grails cmd
failed to run grails cmd
我正在使用 CentOS 和 grails 来托管网络应用程序。我在 /.bash_profile
中设置了以下内容:
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk
export PATH=$JAVA_HOME/bin:$PATH
export GRAILS_HOME=/usr/grails/grails-2.5.6
export PATH=$PATH:$GRAILS_HOME/bin
运行 echo $JAVA_HOME
:
/usr/lib/jvm/java-1.7.0-openjdk
运行 echo $GRAILS_HOME
:
/usr/grails/grails-2.5.6
运行 echo $PATH
:
......other_paths......
/usr/lib/jvm/java-1.7.0-openjdk/bin:
/usr/grails/grails-2.5.6/bin:
......other_paths......
运行 java -version
:
java version "1.7.0_221"
OpenJDK Runtime Environment (rhel-2.6.18.1.el7-x86_64 u221-b02)
OpenJDK 64-Bit Server VM (build 24.221-b02, mixed mode)
最后,当我 运行 grails --version
时,控制台向我抛出以下内容:
| Error java.lang.reflect.InvocationTargetException
| Error at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
| Error at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
| Error at java.lang.reflect.Method.invoke(Method.java:606)
| Error at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:236)
| Error at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:264)
| Error Caused by: java.lang.UnsatisfiedLinkError: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.221-2.6.18.1.el7.x86_64/jre/lib/amd64/libnet.so: libgconf-2.so.4: cannot open shared object file: No such file or directory
| Error at java.lang.ClassLoader$NativeLibrary.load(Native Method)
| Error at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1973)
| Error at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1898)
| Error at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1880)
| Error at java.lang.Runtime.loadLibrary0(Runtime.java:849)
| Error at java.lang.System.loadLibrary(System.java:1088)
| Error at sun.net.PortConfig.run(PortConfig.java:47)
| Error at sun.net.PortConfig.run(PortConfig.java:45)
| Error at java.security.AccessController.doPrivileged(Native Method)
| Error at sun.net.PortConfig.<clinit>(PortConfig.java:44)
| Error at java.net.SocketPermission.run(SocketPermission.java:1218)
| Error at java.net.SocketPermission.run(SocketPermission.java:1210)
| Error at java.security.AccessController.doPrivileged(Native Method)
| Error at java.net.SocketPermission.initEphemeralPorts(SocketPermission.java:1209)
| Error at java.net.SocketPermission.<clinit>(SocketPermission.java:235)
| Error at sun.security.util.SecurityConstants.<clinit>(SecurityConstants.java:259)
| Error at java.lang.Class.getProtectionDomain(Class.java:2194)
| Error at org.codehaus.groovy.reflection.ClassLoaderForClassArtifacts.define(ClassLoaderForClassArtifacts.java:44)
| Error at org.codehaus.groovy.reflection.ClassLoaderForClassArtifacts.run(ClassLoaderForClassArtifacts.java:77)
| Error at org.codehaus.groovy.reflection.ClassLoaderForClassArtifacts.run(ClassLoaderForClassArtifacts.java:75)
| Error at java.security.AccessController.doPrivileged(Native Method)
| Error at org.codehaus.groovy.reflection.ClassLoaderForClassArtifacts.defineClassAndGetConstructor(ClassLoaderForClassArtifacts.java:75)
| Error at org.codehaus.groovy.runtime.callsite.CallSiteGenerator.compileStaticMethod(CallSiteGenerator.java:246)
| Error at org.codehaus.groovy.reflection.CachedMethod.createStaticMetaMethodSite(CachedMethod.java:290)
| Error at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.createStaticMetaMethodSite(StaticMetaMethodSite.java:114)
| Error at groovy.lang.MetaClassImpl.createStaticSite(MetaClassImpl.java:3411)
| Error at groovy.lang.ExpandoMetaClass.createStaticSite(ExpandoMetaClass.java:1308)
| Error at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallStaticSite(CallSiteArray.java:77)
| Error at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallSite(CallSiteArray.java:162)
| Error at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
| Error at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
| Error at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
| Error at grails.util.BuildSettings.<init>(BuildSettings.groovy:836)
| Error at grails.util.BuildSettings.<init>(BuildSettings.groovy:832)
| Error at org.codehaus.groovy.grails.cli.GrailsScriptRunner.main(GrailsScriptRunner.java:156)
| Error ... 6 more
我花了一些时间解决这个问题,但仍然无法解决。有什么好的建议吗?
看起来您的 JVM 缺少一些依赖项。我会 uninstall/reinstall 那。
一些谷歌搜索让我在这里和其他地方的帖子暗示 CentOS 附带的 JDK and/or JVM 由于许可特别排除了某些项目,因此重新安装可以确保您有一个干净的和完整的副本。
我正在使用 CentOS 和 grails 来托管网络应用程序。我在 /.bash_profile
中设置了以下内容:
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk
export PATH=$JAVA_HOME/bin:$PATH
export GRAILS_HOME=/usr/grails/grails-2.5.6
export PATH=$PATH:$GRAILS_HOME/bin
运行 echo $JAVA_HOME
:
/usr/lib/jvm/java-1.7.0-openjdk
运行 echo $GRAILS_HOME
:
/usr/grails/grails-2.5.6
运行 echo $PATH
:
......other_paths......
/usr/lib/jvm/java-1.7.0-openjdk/bin:
/usr/grails/grails-2.5.6/bin:
......other_paths......
运行 java -version
:
java version "1.7.0_221"
OpenJDK Runtime Environment (rhel-2.6.18.1.el7-x86_64 u221-b02)
OpenJDK 64-Bit Server VM (build 24.221-b02, mixed mode)
最后,当我 运行 grails --version
时,控制台向我抛出以下内容:
| Error java.lang.reflect.InvocationTargetException
| Error at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
| Error at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
| Error at java.lang.reflect.Method.invoke(Method.java:606)
| Error at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:236)
| Error at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:264)
| Error Caused by: java.lang.UnsatisfiedLinkError: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.221-2.6.18.1.el7.x86_64/jre/lib/amd64/libnet.so: libgconf-2.so.4: cannot open shared object file: No such file or directory
| Error at java.lang.ClassLoader$NativeLibrary.load(Native Method)
| Error at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1973)
| Error at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1898)
| Error at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1880)
| Error at java.lang.Runtime.loadLibrary0(Runtime.java:849)
| Error at java.lang.System.loadLibrary(System.java:1088)
| Error at sun.net.PortConfig.run(PortConfig.java:47)
| Error at sun.net.PortConfig.run(PortConfig.java:45)
| Error at java.security.AccessController.doPrivileged(Native Method)
| Error at sun.net.PortConfig.<clinit>(PortConfig.java:44)
| Error at java.net.SocketPermission.run(SocketPermission.java:1218)
| Error at java.net.SocketPermission.run(SocketPermission.java:1210)
| Error at java.security.AccessController.doPrivileged(Native Method)
| Error at java.net.SocketPermission.initEphemeralPorts(SocketPermission.java:1209)
| Error at java.net.SocketPermission.<clinit>(SocketPermission.java:235)
| Error at sun.security.util.SecurityConstants.<clinit>(SecurityConstants.java:259)
| Error at java.lang.Class.getProtectionDomain(Class.java:2194)
| Error at org.codehaus.groovy.reflection.ClassLoaderForClassArtifacts.define(ClassLoaderForClassArtifacts.java:44)
| Error at org.codehaus.groovy.reflection.ClassLoaderForClassArtifacts.run(ClassLoaderForClassArtifacts.java:77)
| Error at org.codehaus.groovy.reflection.ClassLoaderForClassArtifacts.run(ClassLoaderForClassArtifacts.java:75)
| Error at java.security.AccessController.doPrivileged(Native Method)
| Error at org.codehaus.groovy.reflection.ClassLoaderForClassArtifacts.defineClassAndGetConstructor(ClassLoaderForClassArtifacts.java:75)
| Error at org.codehaus.groovy.runtime.callsite.CallSiteGenerator.compileStaticMethod(CallSiteGenerator.java:246)
| Error at org.codehaus.groovy.reflection.CachedMethod.createStaticMetaMethodSite(CachedMethod.java:290)
| Error at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.createStaticMetaMethodSite(StaticMetaMethodSite.java:114)
| Error at groovy.lang.MetaClassImpl.createStaticSite(MetaClassImpl.java:3411)
| Error at groovy.lang.ExpandoMetaClass.createStaticSite(ExpandoMetaClass.java:1308)
| Error at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallStaticSite(CallSiteArray.java:77)
| Error at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallSite(CallSiteArray.java:162)
| Error at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
| Error at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
| Error at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
| Error at grails.util.BuildSettings.<init>(BuildSettings.groovy:836)
| Error at grails.util.BuildSettings.<init>(BuildSettings.groovy:832)
| Error at org.codehaus.groovy.grails.cli.GrailsScriptRunner.main(GrailsScriptRunner.java:156)
| Error ... 6 more
我花了一些时间解决这个问题,但仍然无法解决。有什么好的建议吗?
看起来您的 JVM 缺少一些依赖项。我会 uninstall/reinstall 那。
一些谷歌搜索让我在这里和其他地方的帖子暗示 CentOS 附带的 JDK and/or JVM 由于许可特别排除了某些项目,因此重新安装可以确保您有一个干净的和完整的副本。