1

I have a grails application that runs perfectly fine in windows and also when deployed as a WAR file into the Amazon elastic beanstalk. But it won't run on an amazon EC2 machine. Why would this be? Here is the output that I get when I try to run it:

| 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
Anonymous Human
  • 1,858
  • 1
  • 21
  • 47
  • You haven't provided enough information to get a full answer. It looks like you're compiling on your EC2 instance, why are you doing that? You probably don't have all the libraries and environment variables set up on EC2 so it's bombing out. Why aren't you compiling locally and deploying the WAR on your EC2 instance? – david Jun 02 '14 at 00:13

3 Answers3

4

grails-set-version appears to be working fine for me.

I think what happend was you did not follow the upgrade instructions:

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

you need to upgrade your version of scaffolding (and a bunch of other stuff), however ofcourse using the version that you created the project will work, but if you want to upgrade to 2.4 you will need to follow those instructions.

Shaun Stone
  • 626
  • 1
  • 5
  • 19
  • Ayeeee! Had this with the first demo from "Grails in Action 2nd ed.": *"Application expects grails version [2.3.7], but GRAILS_HOME is version [2.5.1]..* Note that the latest Grails 3 is "grails-3.0.5" and the latest Grails 2 is "grails-2.5.1". Time for downgrade? As this is an Amazon EC2 Linux machine, no problem: Download old Grails, set PATH and GRAILS_HOME ... but then I actually need [JDK7](http://stackoverflow.com/questions/22517916/does-grails-2-3-x-support-jdk-8) ... oh well. Downgrade to JDK7 then, which will do until I know more, I guess. – David Tonhofer Sep 06 '15 at 19:41
1

Did you maybe change grails versions using grails-set-version? I have found this doesn't work on Ec2. You need to keep using the version of grails you initially started with. Try that.

0

I was getting the following error when I moved a Grails application from 2.3.11 to 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

To fix these errors, I changed the scaffolding plugin from 2.0.3 to 2.1.2:

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

After the change to version 2.1.2, the errors went away.

Brad Rippe
  • 3,405
  • 1
  • 18
  • 20