我试图在`conf / application.yml'中设置我的应用程序的根上下文路径。像这样:
server:
'context-path': '/'
但是,在尝试启动grails> run-app
时,我遇到以下异常:
失败:构建因异常而失败。
* What went wrong:
Execution failed for task ':bootRun'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
答案 0 :(得分:6)
来自Grails 3.0.3,source code,骆驼的情况,而不是连字符。因此,server:
contextPath: '/my-path'
中的正确设置是:
application.groovy
或者,如果您使用server.contextPath='/my-path'
:
if (File.Exists(pathToMyFile))
{
try
{
using (var fs = new FileStream(pathToMyFile, FileMode.Open, FileAccess.Read))
{
BinaryReader br = new BinaryReader(fs);
Byte[] bytes = br.ReadBytes((Int32) fs.Length);
br.Close();
fs.Close();
myFile = Convert.ToBase64String(bytes);
}
}
catch
{
// Log exception
}
}
答案 1 :(得分:2)
我应该更加关注run-app
的错误日志输出。正确的设置是:
server:
'context-path': ''
> = Grails 3.0.3:
server:
contextPath: ''