Grails Flex Scaffold – GFSv0.2.2

GFSv0.2.2 Released!!

After the success of the last release, Cubika Labs is glad to announce that the new version of GFS in now available. GFSv0.2.2 includes new functionalities and some fixes.

Among important features you will find the spring-security integration, this was the feature most requested by GFS users.

Although other functionalities that we consider vital for a complete integration are still missing, this is an initial approach and the basis to continue working in the new versions.

Some included improvements in this version are:

  • spring-security Integration (we use stark-security)
  • Tabs group (Thank you so much Nicolas Domina)
  • actions into datagrid

If you want report a bug / improvement or vote our Backlog features’ you are welcome to do it in our Jira

See our Confluence for technical documentation

See our SVN if you want to try the code

See new Screencast

In order to explain how this features work, we are going to write some code for a dummy todo-list app

Prerequisites

  • Grails 1.1 or major
  • GFSv0.2.2
  • Flex 3.0.0 or major

FLEX_HOME and GRAILS_HOME must be defined as environment variable!!

Domain Model

1 – Create Project and Install Plugin


gfs@gfs $ grails create-app todo-list gfs@todo-list $ grails install-plugin \ [path-plugin]/grails-flex-scaffold-0.2.2.zip #or gfs@todo-list $ grails install-plugin flex-scaffold

2 - Generate User, Role and Task


#Generets User and Role for spring-security integration gfs@todo-list $ grails stark-security-install-full gfs@todo-list $ grails create-domain-class task

3 - Edit User

class User implements UserDetails {

    String name
    String lastName
    String username
    String password
	String email

    static transients = [
            'authorities',
            'accountNonExpired',
            'enabled',
            'credentialsNonExpired',
            'accountNonLocked'
    ]

    static hasMany = [ roles: Role ]

    //Generates TAB "ADM User" that contains User's tab
    static groupName = "ADM User" 

    // Need to eagerly fetch role relations, because they'll be asked for later
    // by Spring Security when the hibernate session is no longer available
    static mapping = {
      roles lazy:false

    }

    static constraints = {
      name(blank:false)
      lastName(blank:false)
	  email(email:true)	
      username(blank:false)
      //Generate 2 textinput to validate password.
      password(widget:"password")
      roles(inPlace:false)
    }

    GrantedAuthority[] getAuthorities() {
        return roles as GrantedAuthority[]
    }

    boolean isAccountNonLocked() {
        return true
    }
    def setAccountNonLocked(boolean nonLocked) {}

    boolean isCredentialsNonExpired() {
        return true
    }
    def setCredentialsNonExpired(boolean nonExpired) {}

    boolean isAccountNonExpired() {
        return true
    }
    def setAccountNonExpired(boolean acctNonExpired) {}

    boolean isEnabled() {
        return true
    }
    def setEnabled(boolean enabled) {}
}

4 - Edit Role

class Role implements GrantedAuthority {

    String description
    String authority

    static final ANONYMOUS = 'IS_AUTHENTICATED_ANONYMOUSLY'
    // Add your roles here so you can reference them, for instance:
    // static final ADMIN_USER = 'ROLE_ADMIN_USER'

    // This list holds all roles, convenient when you're declaring controller methods
    // that should be available to everybody (see AccessController for instance).  When
    // you add roles to your system, make sure you add them to this list as well.
    static final ALL_ROLES = [  ANONYMOUS ]

    //Generates TAB "ADM User" that contains Role's tab
    static groupName = "ADM User"

    int compareTo(Object o) {
        if (o instanceof Role) {
            return this.authority.compareTo(o.authority)
        }
         return 0
    }

    String toString() {
        return authority
    }
}

5 - Edit Task

class Task {

	String name
	String description
	Long priority

	//multiselection:true - A Checkbox appears in all rows on the first datagrid column
	//actions:["postpone"] - show an action button (label=postpone) in each row so you can 
	//add bussines logic into postpone method at TaskService
	//You could declare as many actions buttons as you need eg: actions:["postpone","complete"]
	static action = [datagrid:[multiselection:true,actions:["postpone"]]]

    static constraints = {
		name(blank:false)
		priority(widget:"hslider", range:1..10)
		description(minSize:5, maxSize:255)
    }
}

6 - Add to Config.groovy


gfs.security = true

7 - Edit StarkSecurityConfig.groovy and change:

    authorizations = [
        '/': Role.ALL_ROLES,
        '/js/**': Role.ALL_ROLES,
        '/css/**': Role.ALL_ROLES,
        '/images/**': Role.ALL_ROLES,
        '/j_spring_security_logout': Role.ALL_ROLES
    ]

to:

    authorizations = [
        '/**': Role.ALL_ROLES,
        '/js/**': Role.ALL_ROLES,
        '/css/**': Role.ALL_ROLES,
        '/images/**': Role.ALL_ROLES,
        '/j_spring_security_logout': Role.ALL_ROLES
    ]

8 - Edit BootStrap.groovy as below

    import org.codehaus.groovy.grails.plugins.starksecurity.PasswordEncoder

	class BootStrap {

	 def init = { servletContext ->

	  if (!User.findByUsername("admin")) {

      def superUser = new User(username: 'admin',
		           password: PasswordEncoder.encode('admin', 'SHA-256', true),name:"admin",lastName:"admin",
																			email:"admin@admin.com")

	   def role = new Role(authority:"ROLE_USER",description:"Role users")													

	   superUser.addToRoles(role)
	   
	   superUser.save()
	 }

	}

	def destroy = {
	}
   }

9 - Generate Flex Artifacts


gfs@todo-list $ grails generate-all-flex role gfs@todo-list $ grails generate-all-flex user gfs@todo-list $ grails generate-all-flex task

10 - Compile Flex and run app


gfs@todo-list $ grails flex-tasks gfs@todo-list $ grails run-app

11 - Access to application

On the login dialog enter the username and password already setted into BootStrap.groovy (admin/admin for this example).

Tips

For this version, we are not taking care of roles regarding functionality.

If you used FlexBuilder you must set-define=GFS::security,false to true ("-define=GFS::security,true") in the Flex Compiler options (flex arguments), this property will show login dialog if is setted to true. By default it's false and in command-line compiling (grails flex-tasks) this property will be retrieved from Config.groovy (gfs.security = [true|false]).

About these ads

Tags: , , , ,

53 Responses to “Grails Flex Scaffold – GFSv0.2.2”

  1. tomas Says:

    Congratulations. What is the reason for using stark-security instead of the traditional Spring Security plugin?

    • Ezequiel Apfel Says:

      Hi Tomas, we used stark-security because it’s lighter than acegi plugin and cover all our needs. On Acegi plugin, generated user and role have many to many relation and this is a low performance on Flex due to lazy loading.
      Regards

  2. Haibin Says:

    Great work!

    I tried and everything worked fine except that I failed to login with username admin and password admin.

    It threw out this message:
    There was an unhandled failure on the server. Bad credentials

    Any idea?

    • Ezequiel Apfel Says:

      Hi Haibin,
      The problem is when the user is inserted into the bootstrap.
      User contains name and lastname nullable=false and I didn’t put it into the bootstrap, it’s my mistake.
      You can try changing bootstrap for this:
      def superuser = new User (username: ‘admin’, password: PasswordEncoder.encode ( ‘admin’, ‘SHA-256′, true), name: “admin”, lastName: “admin”).
      I’ll edit the post to fix this error.
      Thank you.

  3. Haibin Says:

    Thanks for your prompt reply

    I made the change accordingly in the bootstrap but the issue remains.

  4. Haibin Says:

    The stark security plugin prevents session fixation attach, with
    invalidateSessionOnSuccessfulAuthentication: true
    in the config file.

    But I tried the example and found the JSESSIONID was not changed after successfully login.

    Cookie: JSESSIONID=ks5fupwg1os5

    Any idea?

    • Ezequiel Apfel Says:

      Hi, Flex create session before authentication occurs. if you use two users you should see the jsession change. If you use two browsers (Firefox, safari) you should see two jsessions. We’re using start security due to providers (userdao, ldap) and fixation attach should be handled by BlazeDS. Regardings the BlazeDS feature we’re evaluating it to be included on the next version
      Regards

  5. Haibin Says:

    Does the current version support https?

    I tried editing services-config.xml

    And put the war in Tomcat.

    It threw out 404 error when I accessed the login page.

    • Haibin Says:
      • Haibin Says:

        I tried putting the xml content up but it did not show up.

        Basically I just changed the , from

        mx.messaging.channels.AMFChannel

        to

        mx.messaging.channels.SecureAMFChannel

      • Ezequiel Apfel Says:

        Hi, you can try

        endpoint url=”https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure” class=”flex.messaging.endpoints.AMFEndpoint”

        then compile flex

        Regards

  6. Haibin Says:

    I realized that user password is changed every time submit button is clicked even when users did not change password.

  7. Sebastien Arbogast Says:

    I’m trying to install GFS 0.2.2 in Grails 1.2 but when I run “grails install-plugin flex-scaffold”; I get the following exception:

    org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Compile error during compilation with javac.
    [groovyc] /Users/sarbogast/.grails/1.2.0/projects/server/plugins/flex-scaffold-0.2.2/src/java/org/cubika/labs/scaffolding/security/SecurityAnnotationAttributes.java:25: package org.springframework.metadata does not exist
    [groovyc] import org.springframework.metadata.Attributes;
    [groovyc] ^
    [groovyc] /Users/sarbogast/.grails/1.2.0/projects/server/plugins/flex-scaffold-0.2.2/src/java/org/cubika/labs/scaffolding/security/SecurityAnnotationAttributes.java:35: cannot find symbol
    [groovyc] symbol: class Attributes
    [groovyc] public class SecurityAnnotationAttributes implements Attributes {
    [groovyc] ^
    [groovyc] Note: /Users/sarbogast/.grails/1.2.0/projects/server/plugins/flex-scaffold-0.2.2/src/java/org/cubika/labs/scaffolding/response/ReportingResponseWrapper.java uses or overrides a deprecated API.
    [groovyc] Note: Recompile with -Xlint:deprecation for details.

    Any idea? Is there a workaround for this issue?

  8. Tami Wright Says:

    Hi Guys,

    I truly appreciate all your hard work with this tool. I’m getting a stack trace error when I run “grails generate-all-flex role”. I’m using Grails 1.2.0 and your latest build of GFSv0.2.3…

    Here’s the stack trace:
    Building en:Error executing script GenerateAllFlex: tried to access class org.cubika.labs.scaffolding.i18n.I18nBuilder$_marshallMap_closure7 from class org.cubika.labs.scaffolding.i18n.I18nBuilder
    java.lang.IllegalAccessError: tried to access class org.cubika.labs.scaffolding.i18n.I18nBuilder$_marshallMap_closure7 from class org.cubika.labs.scaffolding.i18n.I18nBuilder
    at org.cubika.labs.scaffolding.i18n.I18nBuilder.marshallMap(I18nBuilder.groovy:310)
    at org.cubika.labs.scaffolding.i18n.I18nBuilder.this$2$marshallMap(I18nBuilder.groovy)
    at org.cubika.labs.scaffolding.i18n.I18nBuilder$this$2$marshallMap.callCurrent(Unknown Source)
    at org.cubika.labs.scaffolding.i18n.I18nBuilder.fillDefaultMessages(I18nBuilder.groovy:246)
    at org.cubika.labs.scaffolding.i18n.I18nBuilder.this$2$fillDefaultMessages(I18nBuilder.groovy)
    at org.cubika.labs.scaffolding.i18n.I18nBuilder.fillDefaultMessages(I18nBuilder.groovy)
    at org.cubika.labs.scaffolding.i18n.I18nBuilder.this$2$fillDefaultMessages(I18nBuilder.groovy)
    at org.cubika.labs.scaffolding.i18n.I18nBuilder$this$2$fillDefaultMessages.callCurrent(Unknown Source)
    at org.cubika.labs.scaffolding.i18n.I18nBuilder.changeLocale(I18nBuilder.groovy:59)
    at org.cubika.labs.scaffolding.i18n.I18nBuilder$changeLocale.call(Unknown Source)
    at GenerateAllFlex$_generatesI18n_closure3.doCall(GenerateAllFlex:84)
    at GenerateAllFlex.generatesI18n(GenerateAllFlex:81)
    at GenerateAllFlex$_run_closure2.doCall(GenerateAllFlex:64)
    at GenerateAllFlex$_run_closure2.call(GenerateAllFlex)
    at GenerateAllFlex$_generateAllFlex_closure2.doCall(GenerateAllFlex:91)
    at GenerateAllFlex.generateAllFlex(GenerateAllFlex:77)
    at GenerateAllFlex$_run_closure1.doCall(GenerateAllFlex:57)
    at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:324)
    at gant.Gant$_dispatch_closure6.doCall(Gant.groovy:334)
    at gant.Gant$_dispatch_closure6.doCall(Gant.groovy)
    at gant.Gant.withBuildListeners(Gant.groovy:344)
    at gant.Gant.this$2$withBuildListeners(Gant.groovy)
    at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
    at gant.Gant.dispatch(Gant.groovy:334)
    at gant.Gant.this$2$dispatch(Gant.groovy)
    at gant.Gant.invokeMethod(Gant.groovy)
    at gant.Gant.processTargets(Gant.groovy:495)
    at gant.Gant.processTargets(Gant.groovy:480)
    Error executing script GenerateAllFlex: tried to access class org.cubika.labs.scaffolding.i18n.I18nBuilder$_marshallMap_closure7 from class org.cubika.labs.scaffolding.i18n.I18nBuilder

    Any ideas?

  9. Tami Wright Says:

    Hi,

    Okay, I just ran the “grails generate-all-flex User” first, then “grails generate-all-flex Role” and it worked! Just a note for your entry above!

    Tami

    • Ezequiel Apfel Says:

      HI,
      The problem is when you run for the first time GFS. The error occurs in the i18n Builder and we could not fix it. This error does not occur if you run “grails compile” after installing GFS this is the only time you have to do this.
      That’s why when you run “generate-all-flex” for the second time it worked fine, because grails compiled the gfs’ source.
      Regards,

      • Andreas Says:

        hi,

        I ran into the same problem. A grails compile runs without any error but does not solve the problem

        gfs-scaffolding 0.2.3
        grails-1.3.1
        jdk1.6.0_18
        fedora 12

        regards

        andreas

        [andreas@euler dummy]$ grails compile
        Welcome to Grails 1.3.1 – http://grails.org/
        Licensed under Apache Standard License 2.0
        Grails home is set to: /opt/grails

        Base Directory: /home/andreas/NetBeansProjects/dummy
        Resolving dependencies…
        Dependencies resolved in 5589ms.
        Running script /opt/grails/scripts/Compile.groovy
        Environment set to development
        [groovyc] Compiling 2 source files to /home/andreas/.grails/1.3.1/projects/dummy/plugin-classes
        [andreas@euler dummy]$ grails generate-all-flex company
        Welcome to Grails 1.3.1 – http://grails.org/
        Licensed under Apache Standard License 2.0
        Grails home is set to: /opt/grails

        Base Directory: /home/andreas/NetBeansProjects/dummy
        Resolving dependencies…
        Dependencies resolved in 5427ms.
        Running script /home/andreas/.grails/1.3.1/projects/dummy/plugins/flex-scaffold-0.2.3/scripts/GenerateAllFlex.groovy
        Error executing script GenerateAllFlex: startup failed:
        GenerateAllFlex: 21: unable to resolve class org.cubika.labs.scaffolding.utils.ConstraintValueUtils
        @ line 21, column 1.
        GenerateAllFlex: 23: unable to resolve class org.cubika.labs.scaffolding.utils.I18nUtils
        @ line 23, column 1.
        GenerateAllFlex: 22: unable to resolve class org.cubika.labs.scaffolding.generator.DefaultFlexTemplateGenerator
        @ line 22, column 1.
        3 errors

        org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
        GenerateAllFlex: 21: unable to resolve class org.cubika.labs.scaffolding.utils.ConstraintValueUtils
        @ line 21, column 1.
        GenerateAllFlex: 23: unable to resolve class org.cubika.labs.scaffolding.utils.I18nUtils
        @ line 23, column 1.
        GenerateAllFlex: 22: unable to resolve class org.cubika.labs.scaffolding.generator.DefaultFlexTemplateGenerator
        @ line 22, column 1.
        3 errors

        at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:296)
        at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:847)
        at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:519)
        at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:495)
        at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:472)
        at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:456)
        at gant.Gant.compileScript(Gant.groovy:635)
        at gant.Gant.this$2$compileScript(Gant.groovy)
        at gant.Gant$_closure1.doCall(Gant.groovy:129)
        at gant.Gant$_closure1.call(Gant.groovy)
        at gant.Gant.loadScript(Gant.groovy:266)
        at gant.Gant$loadScript.callCurrent(Unknown Source)
        at gant.Gant.loadScript(Gant.groovy:248)
        Error executing script GenerateAllFlex: startup failed:
        GenerateAllFlex: 21: unable to resolve class org.cubika.labs.scaffolding.utils.ConstraintValueUtils
        @ line 21, column 1.
        GenerateAllFlex: 23: unable to resolve class org.cubika.labs.scaffolding.utils.I18nUtils
        @ line 23, column 1.
        GenerateAllFlex: 22: unable to resolve class org.cubika.labs.scaffolding.generator.DefaultFlexTemplateGenerator
        @ line 22, column 1.
        3 errors

      • Ezequiel Apfel Says:

        Hi, try with grails 1.2.1, we don’t test it on 1.3 already.
        Regards

  10. Govind Says:

    Hi ,

    When i use GFS-0.2.3 and i type the command

    grails generate-flex-all <> it gives the following error :

    Error executing script GenerateAllFlex: startup failed, GenerateAllFlex: 21: unable to resolve class org.cubika.labs.scaffolding.utils.ConstraintValueUtils
    @ line 21, column 1.GenerateAllFlex: 22: unable to resolve class org.cubika.labs.scaffolding.generator.DefaultFlexTemplateGenerator
    @ line 22, column 1.GenerateAllFlex: 23: unable to resolve class org.cubika.labs.scaffolding.utils.I18nUtils
    @ line 23, column 1.
    3 errors

    org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, GenerateAllFlex: 21: unable to resolve class org.cubika.labs.scaffolding.utils.ConstraintValueUtils
    @ line 21, column 1.GenerateAllFlex: 22: unable to resolve class org.cubika.labs.scaffolding.generator.DefaultFlexTemplateGenerator
    @ line 22, column 1.GenerateAllFlex: 23: unable to resolve class org.cubika.labs.scaffolding.utils.I18nUtils
    @ line 23, column 1.
    3 errors

    at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:296)
    at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:835)
    at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:513)
    at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:489)
    at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:466)
    at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:450)
    at gant.Gant.compileScript(Gant.groovy:506)
    at gant.Gant.this$2$compileScript(Gant.groovy)
    at gant.Gant$_closure1.doCall(Gant.groovy:121)
    at gant.Gant$_closure1.call(Gant.groovy)
    at gant.Gant.loadScript(Gant.groovy:250)
    at gant.Gant$loadScript.callCurrent(Unknown Source)
    at gant.Gant.loadScript(Gant.groovy:233)
    Error executing script GenerateAllFlex: startup failed, GenerateAllFlex: 21: unable to resolve class org.cubika.labs.scaffolding.utils.ConstraintValueUtils
    @ line 21, column 1.GenerateAllFlex: 22: unable to resolve class org.cubika.labs.scaffolding.generator.DefaultFlexTemplateGenerator
    @ line 22, column 1.GenerateAllFlex: 23: unable to resolve class org.cubika.labs.scaffolding.utils.I18nUtils
    @ line 23, column 1.
    3 errors

    • Ezequiel Apfel Says:

      HI,
      The problem is when you run for the first time GFS. The error occurs in the i18n Builder and we could not fix it. This error does not occur if you run “grails compile” after installing GFS this is the only time you have to do this.

  11. Sebastien Arbogast Says:

    I’m sorry but I just noticed your plugin modifies far too many things, especially in configuration files. It just doesn’t work if you install it in an existing application with plenty of configuration customizations. Why do you need to reset Datasources.groovy and Config.groovy like that?

  12. Grails BlazeDS 4 Integration Plugin | Epseelon IT Says:

    [...] The problem is that none of the existing plugins suited my needs. All of them cover Flex 3 only, some of them introduce a lot of complexity for CRUD generation, some of them use GraniteDS instead of BlazeDS, [...]

  13. Iceraven Says:

    Hi.
    I’ve got a problem with PaginationView, it’s embedded search control doesn’t correctly handle Cyrillic symbols. I there a way to fix that? Or may be it’s possible to disable this control. I tried overriding embedded PromptedTextInput but it didn’t work out.

  14. Arian Says:

    Hi Ezequiel, first of all congrats for this plugin, its pretty impressive your progress on this tool.
    I also notice that you have been implementing support for reporting, is it already fully functional? it seams ok on your code, but I didn’t find any example, could you please give me an example telling me how should we define the ‘reportable’ property on a domains class to support reports?

    best,
    Arian

    • Ezequiel Apfel Says:

      Hi Arian, today reporting is fully functional but it’s pretty basic since we put effort in other features such us security, widgets, etc.
      Regarding the example you should install dynamic-jasper plugin, make your domain class look like this:

      class aClass
      {
      static def reportable = [:]
      }

      and finally run grails generate-all aClass && grails flex-tasks && grails run-app.

      when you login into application you will see Reporting sub tab in the aClass tab.

      If you need something information, please let me know.

      Best regards,
      Ezequiel

      • Arian Says:

        tks for your answer, I’ve been voting for the next features at jira today. i’ll be watching the next steps. I’m studying your code and if I find something I can help I would be happy to contribute

        []‘s
        Arian

      • Arian Says:

        tks for your answer, from start I didn’t notice it was a third party plugin. it works fine.
        I’ve been voting for the next features at jira today and i’ll be watching the next steps. I’m studying your code and if I find something I can help I would be happy to contribute

        []‘s
        Arian

  15. Wellington Moscon Says:

    Hello,
    I’ve got a problem while trying to execute grails flex-tasks command.
    I’m using grails 1.2.0 and GFSv0.2.3.

    Here’s the stack trace:
    Error executing script FlexTasks: taskdef class flex.ant.MxmlcTask cannot be fou
    nd
    : taskdef class flex.ant.MxmlcTask cannot be found
    at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:609)

    at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:228)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
    a:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at FlexTasks.run(FlexTasks:28)
    at FlexTasks$run.call(Unknown Source)
    at gant.Gant.processTargets(Gant.groovy:494)
    at gant.Gant.processTargets(Gant.groovy:480)
    Caused by: java.lang.ClassNotFoundException: flex.ant.MxmlcTask
    at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoa
    der.java:1400)
    at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:134
    1)
    at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:108
    8)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:242)
    at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:583)

    … 7 more
    — Nested Exception —
    java.lang.ClassNotFoundException: flex.ant.MxmlcTask
    at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoa
    der.java:1400)
    at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:134
    1)
    at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:108
    8)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:242)
    at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:583)

    at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:228)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
    a:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at FlexTasks.run(FlexTasks:28)
    at FlexTasks$run.call(Unknown Source)
    at gant.Gant.processTargets(Gant.groovy:494)
    at gant.Gant.processTargets(Gant.groovy:480)
    Error executing script FlexTasks: taskdef class flex.ant.MxmlcTask cannot be found

    Thanks.

  16. IceRaven Says:

    Hi.
    I’ve faced a nasty problem related to http session.
    Our application is a distributed one – server side (grails) runs in one place, while flex part is running in another. Problem appears when user does something on the flash side after some period of inactivity. Requests to the services are not working until user refreshes his browser.
    Seems that client (flex) sends service request with session is that is already invalidated on the server by timeout. Is there a possible way how to make either client reset session id or server side to recreate session if old one is invalidated?

  17. Ray Hooker Says:

    Help!!! So I double checked and indeed the GFS plugin breaks Tomcat deployment.. which is a real problem for me. I was having this problem and finally decided to start from scratch and try the project in the tutorial to see if it works. I built a new project (grails 1.2.1, Flex 3.5) as above.

    I then added the appropriate tomcat variables to (tomcat.deploy .username, tomcat.deploy.password, tomcat.deploy.url) config.groovy. When try to deploy, it gets the same error I reported in another post.. and the war file cannot be manually deployed.

    I pasted the errors below from both the deployment and from the catalina.out… no other errors were generated.

    Ray

    ***************Deployment Error **************************
    Done creating WAR C:\Projects\VideoPOC\VideoPCMS\target\VideoPCMS-0.1.war
    Deploying application /VideoPCMS to Tomcat
    [deploy] FAIL – Failed to deploy application at context path /VideoPCMS
    Error executing script Tomcat: : FAIL – Failed to deploy application at context
    path /VideoPCMS
    gant.TargetExecutionException: : FAIL – Failed to deploy application at context
    path /VideoPCMS
    at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:331)
    at gant.Gant$_dispatch_closure6.doCall(Gant.groovy:334)
    at gant.Gant$_dispatch_closure6.doCall(Gant.groovy)
    at gant.Gant.withBuildListeners(Gant.groovy:344)
    at gant.Gant.this$2$withBuildListeners(Gant.groovy)
    at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
    at gant.Gant.dispatch(Gant.groovy:334)
    at gant.Gant.this$2$dispatch(Gant.groovy)
    at gant.Gant.invokeMethod(Gant.groovy)
    at gant.Gant.processTargets(Gant.groovy:495)
    at gant.Gant.processTargets(Gant.groovy:480)
    Caused by: : FAIL – Failed to deploy application at context path /VideoPCMS
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
    a:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at Tomcat$_run_closure1.doCall(Tomcat:29)
    at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:324)
    … 10 more
    Caused by: FAIL – Failed to deploy application at context path /VideoPCMS
    … 14 more
    Error executing script Tomcat: : FAIL – Failed to deploy application at context
    path /VideoPCMS

    *************catalina.out ***********
    Mar 9, 2010 8:05:14 PM org.apache.catalina.util.ExtensionValidator validateManifestResources
    INFO: ExtensionValidator[/VideostatsFlex][commons-attributes-api-2.2.jar]: Required extension “ant” not found.
    Mar 9, 2010 8:05:14 PM org.apache.catalina.util.ExtensionValidator validateManifestResources
    INFO: ExtensionValidator[/VideostatsFlex][commons-attributes-api-2.2.jar]: Required extension “qdox” not found.
    Mar 9, 2010 8:05:14 PM org.apache.catalina.util.ExtensionValidator validateManifestResources
    INFO: ExtensionValidator[/VideostatsFlex]: Failure to find 2 required extension(s).
    Mar 9, 2010 8:05:14 PM org.apache.catalina.core.StandardContext start
    SEVERE: Error getConfigured
    Mar 9, 2010 8:05:14 PM org.apache.catalina.core.StandardContext start
    SEVERE: Context [/VideostatsFlex] startup failed due to previous errors
    Mar 9, 2010 8:05:14 PM org.apache.catalina.core.StandardContext stop
    INFO: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/VideostatsFlex] has not been started
    Mar 10, 2010 5:23:53 AM org.apache.catalina.startup.HostConfig deployWAR
    INFO: Deploying web application archive VideoPCMS.war

    • Ezequiel Apfel Says:

      Hi Ray, what tomcat version use? We deployment on tomcat 5.5.
      Check to rename VideoPCMS-0.1.war for VideoPCMS.war or add context=/VideoPCMS

      Regards,
      Ezequiel

    • Iceraven Says:

      Hi Ray! Itś a known issue when deploying on Tomcat. I also got this.
      There is a way how to fix this:
      1) go to the .grails/projects/$PROJECT_NAME/plugins/flex-scaffold/lib
      2) remove this jar file commons-attributes-api-2.2.jar
      3) do a fresh war package

      Problem goes away….

      • Ray Hooker Says:

        That works!! I can finally and run the app on Tomcat. Just curious why this work? Is this duplicating and collidng with one supplied from Grails? Anyhow it works.

        Ray

  18. Ray Hooker Says:

    I really like GFS but have a persistent problem. For example, I suddenly started getting:

    ReferenceError: Error #1056: Cannot create property metaClass on com.cubika.labs.pagination.PageFilter.

    As a result the menus retrieve none of the data!! What is wrong here?

    Ray

  19. IceRaven Says:

    Hi Ezequiel!
    Do you have plans to release a new version with lazy loading enabled? As far as I remember there were such plans. We really need this feature.
    Thanks, Alex.

  20. Arilson Says:

    I’v had the same Wellington Moscon’s problem with flex-tasks

    arilson@arilson-laptop:/opt/gteste$ grails flex-tasks
    /opt/grails-1.2.2/bin/grails: 6: [[: not found
    Welcome to Grails 1.2.2 – http://grails.org/
    Licensed under Apache Standard License 2.0
    Grails home is set to: /opt/grails-1.2.2

    Base Directory: /opt/gteste
    Resolving dependencies…
    Dependencies resolved in 1891ms.
    Running script /home/arilson/.grails/1.2.2/projects/gteste/plugins/flex-scaffold-0.2.3/scripts/FlexTasks.groovy
    Error executing script FlexTasks: taskdef class flex.ant.MxmlcTask cannot be found
    : taskdef class flex.ant.MxmlcTask cannot be found
    at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:609)
    at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:228)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at FlexTasks.run(FlexTasks:28)
    at FlexTasks$run.call(Unknown Source)
    at gant.Gant.processTargets(Gant.groovy:494)
    at gant.Gant.processTargets(Gant.groovy:480)
    Caused by: java.lang.ClassNotFoundException: flex.ant.MxmlcTask
    at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1400)
    at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1341)
    at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1088)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:583)
    … 7 more
    — Nested Exception —
    java.lang.ClassNotFoundException: flex.ant.MxmlcTask
    at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1400)
    at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1341)
    at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1088)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:583)
    at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:228)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at FlexTasks.run(FlexTasks:28)
    at FlexTasks$run.call(Unknown Source)
    at gant.Gant.processTargets(Gant.groovy:494)
    at gant.Gant.processTargets(Gant.groovy:480)
    Error executing script FlexTasks: taskdef class flex.ant.MxmlcTask cannot be found

    • Ezequiel Apfel Says:

      Hi, check if FLEX_HOME is correctly setted or check if exist ant folder into sdk version folder.

      Regards,
      Ezequiel

  21. Gregory Fontenele Says:

    When a new version comes with support for flex 4?

  22. Gregory Fontenele Says:

    which IDE you use to work with flex and grails?

  23. Gregory Fontenele Says:

    Hi Ezequiel,

    where do I change the search field, which
    appears in pages *ListView.mxml

    Thanks

  24. Ryan Says:

    Hi there – Great plugin.. Any plans to make it compatible with Grails 1.3???

    Particularly the org.cubika.labs.scaffolding.generator.DefaultFlexTemplateGenerator class not found bug… Running “grails compile” does not fix this. It works fine when I switch over to Grails 1.2 so it’s an issue with version incompatibility.

    Thanks

  25. Gregory Fontnele Says:

    Hi Ezequiel,
    I’m here again =]

    How to remove the opacity toogleButtonBar?

    Thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

%d bloggers like this: