Grails应用程序不会在Amazon EC2中运行,但在Windows中运行良好

时间:2014-05-29 12:47:33

标签: grails amazon-web-services amazon-ec2

我有一个grails应用程序,它在Windows中运行得非常好,并且在作为WAR文件部署到Amazon弹性beanstalk时也是如此。但它不会在亚马逊EC2机器上运行。为什么会这样?这是我尝试运行时获得的输出:

| Compiling 134 source files.
| Error Compilation error: startup failed:
Compile error during compilation with javac.
/home/ec2-user/FatcaOne_0/target/work/plugins/scaffolding-2.0.3/src/java/org/codehaus/groovy/grails/scaffolding/view/ScaffoldingViewResolver.java:42: error: no interface expected here
public class ScaffoldingViewResolver extends GrailsViewResolver {
                                             ^
/home/ec2-user/FatcaOne_0/target/work/plugins/cache-1.1.2/src/java/grails/plugin/cache/web/

PageInfo.java:37: error: package net.sf.cglib.proxy does not exist
import net.sf.cglib.proxy.Callback;
                         ^
/home/ec2-user/FatcaOne_0/target/work/plugins/scaffolding-2.0.3/src/java/org/codehaus/groovy/grails/scaffolding/view/ScaffoldedGroovyPageView.java:87: error: method createResponseWriter in class GroovyPageView cannot be applied to given types;
                        out = createResponseWriter(response);
                              ^
  required: GrailsWebRequest,HttpServletResponse
  found: HttpServletResponse
  reason: actual and formal argument lists differ in length
/home/ec2-user/FatcaOne_0/target/work/plugins/scaffolding-2.0.3/src/java/org/codehaus/groovy/grails/scaffolding/view/ScaffoldedGroovyPageView.java:75: error: method does not override or implement a method from a supertype
        @Override
        ^
/home/ec2-user/FatcaOne_0/target/work/plugins/scaffolding-2.0.3/src/java/org/codehaus/groovy/grails/scaffolding/view/ScaffoldingViewResolver.java:88: error: cannot find symbol
                return super.createFallbackView(viewName);
                       ^
  symbol:   variable super
  location: class ScaffoldingViewResolver
/home/ec2-user/FatcaOne_0/target/work/plugins/scaffolding-2.0.3/src/java/org/codehaus/groovy/grails/scaffolding/view/ScaffoldingViewResolver.java:58: error: method does not override or implement a method from a supertype
        @Override
        ^
/home/ec2-user/FatcaOne_0/target/work/plugins/scaffolding-2.0.3/src/java/org/codehaus/groovy/grails/scaffolding/view/ScaffoldingViewResolver.java:97: error: cannot find symbol
                view.setApplicationContext(getApplicationContext());
                                           ^
  symbol:   method getApplicationContext()
  location: class ScaffoldingViewResolver
/home/ec2-user/FatcaOne_0/target/work/plugins/scaffolding-2.0.3/src/java/org/codehaus/groovy/grails/scaffolding/view/ScaffoldingViewResolver.java:98: error: cannot find symbol
                view.setServletContext(getServletContext());
                                       ^
  symbol:   method getServletContext()
  location: class ScaffoldingViewResolver
/home/ec2-user/FatcaOne_0/target/work/plugins/scaffolding-2.0.3/src/java/org/codehaus/groovy/grails/scaffolding/view/ScaffoldingViewResolver.java:99: error: cannot find symbol
                view.setTemplateEngine(templateEngine);
                                       ^
  symbol:   variable templateEngine
  location: class ScaffoldingViewResolver
/home/ec2-user/FatcaOne_0/target/work/plugins/cache-1.1.2/src/java/grails/plugin/cache/web/PageInfo.java:418: error: cannot find symbol
                        if (value instanceof Callback || value instanceof Callback[]) {
                                             ^
  symbol:   class Callback
  location: class PageInfo
/home/ec2-user/FatcaOne_0/target/work/plugins/cache-1.1.2/src/java/grails/plugin/cache/web/PageInfo.java:418: error: cannot find symbol
                        if (value instanceof Callback || value instanceof Callback[]) {
                                                                          ^
  symbol:   class Callback
  location: class PageInfo
11 errors


1 error

3 个答案:

答案 0 :(得分:4)

grails-set-version似乎对我有用。

我认为发生的事情是您没有按照升级说明进行操作:

http://grails.org/doc/2.4.x/guide/upgradingFrom23.html

你需要升级你的脚手架版本(以及其他一些东西),但是使用你创建项目的版本可以使用,但是如果要升级到2.4,你需要按照这些说明进行操作。 / p>

答案 1 :(得分:1)

您是否可以使用grails-set-version更改grails版本?我发现这对Ec2不起作用。您需要继续使用最初开始使用的grails版本。试试吧。

答案 2 :(得分:0)

当我将 Grails 应用程序从 2.3.11 移动到 Grails 2.5.6 时,出现以下错误:

Compilation error: startup failed:
Compile error during compilation with javac.
/Users/brippe/Projects/server/server/target/work/plugins/scaffolding-2.0.3/src/java/org/codehaus/groovy/grails/scaffolding/view/ScaffoldingViewResolver.java:42: error: no interface expected here
public class ScaffoldingViewResolver extends GrailsViewResolver {
                                             ^
/Users/brippe/Projects/server/server/target/work/plugins/scaffolding-2.0.3/src/java/org/codehaus/groovy/grails/scaffolding/view/ScaffoldedGroovyPageView.java:75: error: method does not override or implement a method from a supertype
    @Override

为了修复这些错误,我将脚手架插件从 2.0.3 更改为 2.1.2:

plugins {
        build: ..
        compile ":scaffolding:2.1.2" 
}

更改到 2.1.2 版本后,错误消失了。