我的开发人员在我的本地计算机上设置了一个基于Grails / Spring框架的应用程序。我不小心删除了他给我在我的浏览器中本地运行的Unix exe脚本,无法再访问该站点。不幸的是,在假期之后我无法与他取得联系,我需要尽快访问这个网站。
我现在的剧本是......
#!/bin/sh
grails -Dserver.port.https=443 -Dserver.port=80 run-app -https
它只会返回错误。任何人都可以帮我弄清楚如何在本地运行。这是unix错误。
Last login: Mon Dec 24 08:34:43 on ttys000
/Users/admin/Projects/.... ; exit;
gio-2:~ admin$ /Users/admin/Projects/.... ; exit;
| Configuring classpath
| Error java.io.FileNotFoundException: /Users/admin/.grails/.slcache/.index (Permission denied)
| Error at java.io.FileOutputStream.openAppend(Native Method)
| Error at java.io.FileOutputStream.<init>(FileOutputStream.java:192)
| Error at java.io.FileWriter.<init>(FileWriter.java:90)
| Error at com.springsource.loaded.MethodInvokerRewriter.addToCacheIndex(MethodInvokerRewriter.java:326 )
| Error at com.springsource.loaded.MethodInvokerRewriter.rewrite(MethodInvokerRewriter.java:271)
| Error at com.springsource.loaded.MethodInvokerRewriter.rewriteUsingCache(MethodInvokerRewriter.java:1 41)
| Error at com.springsource.loaded.TypeRegistry.methodCallRewriteUseCacheIfAvailable(TypeRegistry.java: 775)
| Error at com.springsource.loaded.agent.SpringLoadedPreProcessor.preProcess(SpringLoadedPreProcessor.j ava:251)
| Error at com.springsource.loaded.agent.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:89)
| Error at sun.instrument.TransformerManager.transform(TransformerManager.java:169)
| Error at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:365)
| Error at java.lang.ClassLoader.defineClass1(Native Method)
| Error at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
| Error at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
| Error at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
| Error at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
| Error at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
| Error at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
| Error at java.security.AccessController.doPrivileged(Native Method)
| Error at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
| Error at org.codehaus.groovy.tools.RootLoader.oldFindClass(RootLoader.java:152)
| Error at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:124)
| Error at org.codehaus.groovy.grails.cli.support.GrailsRootLoader.loadClass(GrailsRootLoader.java:43)
| Error at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
| Error at org.codehaus.groovy.grails.cli.GrailsScriptRunner.main(GrailsScriptRunner.java:228)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| Error at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| Error at java.lang.reflect.Method.invoke(Method.java:597)
| Error at com.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1231)
| 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 Error executing script RunApp: /Users/admin/.grails/ivy-cache/resolved-org.grails.internal-grails-2.0.3.xml (Permission denied) (Use --stacktrace to see the full trace)
logout
[Process completed]
我尝试使用sudo它会出现此错误...
/Users/admin/Projects/... 2 ; exit;
gio-2:~ admin$ /Users/admin/Projects/... 2 ; exit;
Password:
| Configuring classpath
| Error /Users/admin does not appear to be part of a Grails application.
| Error The following commands are supported outside of a project:
add-proxy
clear-proxy
create-app
create-plugin
help
list-plugins
package-plugin
plugin-info
remove-proxy
set-proxy
| Run 'grails help' for a complete list of available scripts.
logout
[Process completed]
我不知道这是否有帮助,但我在Users / admin / Tools目录中有一个grails-2.0.3文件。同样,我没有设置任何这个,所以我真的不知道如何设置的输入/输出。我只需要能够通过http在我的本地服务器上看到它,这样我就可以完成我的前端工作了。
这是有效的脚本......
#!/bin/sh
cd /Users/admin/Projects/...
sudo grails -Dserver.port.https=443 -Dserver.port=80 run-app -https
答案 0 :(得分:5)
要使用管理员权限运行应用,请尝试:
sudo grails -Dserver.port.https=443 -Dserver.port=80 run-app -https
消息说:
Error /Users/admin does not appear to be part of a Grails application.
因此,您没有在正确的项目目录中运行该命令。
例如,您的项目目录是/ Users / admin / workspace / myProject,您应该cd
到该路径。如果您的ls
命令显示以下内容:
application.properties scripts test
src stacktrace.log web-app
grails-app target
lib target-eclipse
然后你可以发出第一个run-app命令。