VGrails : A Vaadin+Grails Application Framework

Guys,
I have post a new project called VGrails in GoogleCode, please feel free to get the source and you can leave comments, suggestions,critics and contributions for this very early framework

http://code.google.com/p/vgrails/

regards

Abiel Hakim
Jakarta

Very nice!

Now if we could do this kind of scaffolding without having to step outside Java proper ! I don’t want to learn Groovy, even though it is obviously Java-related and Java-like. I have built a simple application to interact with GAE and PayPal (
http://2010-en.concordia-international.org/registration
). I used Siena for persistence because it was completely trivial. Now if only I could get automagic containers and UI based on a trivial model, I’d be in heaven.

Thank you Jean-Francois,

Actually I made this framework because I faced difficult situations: My developers mostly fresh-graduates, and it’s very hard to find Java developers in Indonesia.(even ‘Java’ is in Indonesia but you can find millions VB and PHP developers there), so I should take a ‘pragmatic’ approach, how if we could build a Java web apps, enterprise ready and have a great UI?..and easy to program like VB programming? So I mix Grails + Vaadin then make some helper codes to ease those ex-VB and PH developer jobs.

Currently this framework is being used for small ERP application called RTM, I also planned to use this for making a financial service/banking application

Really great work!

I tried out to the code but found some issues while working with the sources. Is it possible that grails/conf-folder is currently missing?
Additionally I the setMainWindow in VGrailsApplication is unimplemented.

If possible somehow, can you provide a solution for these issues, thx in advance!

– cheers, volker

This is my stumbling block at the moment.

time.InvokerInvocationException: java.lang.Exception: Integrity constraint violation - no parent FK1C92FE2FF3744CB2 table: ROLE_TYPE

Not sure if this is related to NOT using mysql?

00000000000000000000 Instructions 0000000000000000000000000000000000000000000

Create Grails application:

grails create-app [Your app]

Checkout the source from http://code.google.com/p/vgrails/source/checkout

copy all checked out files to your created grails application folder

install Vaadin Grails plugin:

grails install-plugin vaadin 1.0
grails install-plugin dbunit-operator

Prepare your MySQL database, create a database as described in conf/DataSource.groovy

in DataSource.groovy and Bootstrap.groovy find and uncomment these lines

Bootstrap.groovy: // DbUnitOperator.create() 

Datasource.groovy:

   //dbunitXmlType = "flat"
   //initialData = "data/dev/data.xml" // dbunit-operator Flat-XML or XML data file
   //initialOperation = "CLEAN_INSERT" // dbunit-operator operation

Now run your app:

grails run-app 

00000000000000000000000000000000000000000000000000000000000000000000000000000000000

Concur, missing
/conf
/data - referred to by the instructions to modify the DataSource.groovy

//dbunitXmlType = "flat"

//initialData = “data/dev/data.xml” // dbunit-operator Flat-XML or XML data file
//initialOperation = “CLEAN_INSERT” // dbunit-operator operation

grails install-plugin http://dbunit-plugin.googlecode.com/files/grails-dbunit-plugin-0.1.zip

?? grails install-plugin dbunit-operator may automatically install a copy of dbunit? not sure.

Assume:

== DataSource.groovy ==
dataSource {
pooled = true
driverClassName = “org.hsqldb.jdbcDriver”
username = “sa”
password = “”
}
hibernate {
cache.use_second_level_cache=true
cache.use_query_cache=true
cache.provider_class=‘com.opensymphony.oscache.hibernate.OSCacheProvider’
}

environments {
development {
dataSource
{
dbCreate = “create-drop” // one of ‘create’, ‘create-drop’,‘update’
url = “jdbc:hsqldb:mem:devDB”

                dbunitXmlType = "flat"
                initialData = "data/dev/data.xml" // dbunit-operator Flat-XML or XML data file
                initialOperation = "CLEAN_INSERT" // dbunit-operator operation		
            }
    }

}

== Bootstrap.groovy ==

class BootStrap
{

 def init = { servletContext ->

    DbUnitOperator.create() 
 }
 def destroy = {
     
 }

}

0000000000000000000000000000000000000000000000000000000000000000000000000000

Grails home is set to: c:\apps\grails-1.2-M3

Base Directory: C:\grails\vgrails
Resolving dependencies…
Dependencies resolved in 8672ms.
Running script c:\apps\grails-1.2-M3\scripts\RunApp.groovy
Environment set to development
[groovyc]
Compiling 2 source files to C:\grails\vgrails\target\classes
[groovyc]
Compiling 2 source files to C:\grails\vgrails\target\classes
[copy]
Copying 1 file to C:\grails\vgrails\target\classes
[Vaadin]
Loading default config file: class VaadinConfig.groovy …
[Vaadin]
Loaded Vaadin config file:
[Vaadin]
-Production mode: false
[Vaadin]
-Application class: com.mycompany.MyVaadinApplication
Running Grails application…
2010-05-25 17:27:43,891 [main]
ERROR context.ContextLoader - Context initialization failed
org.springframework.beans.factory.access.BootstrapException: Error executing bootstraps; nested exception is org.codehaus.groovy.run
time.InvokerInvocationException: java.lang.Exception: Integrity constraint violation - no parent FK1C92FE2FF3744CB2 table: ROLE_TYPE
in statement [insert into PARTY_ROLE (PARTY_ID, ROLE_TYPE_ID, THRU_DATE, FROM_DATE, VERSION) values (?, ?, ?, ?, ?)]

    at org.codehaus.groovy.grails.web.context.GrailsContextLoader.createWebApplicationContext(GrailsContextLoader.java:74)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3961)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4456)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:515)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:708)
    at org.apache.catalina.startup.Tomcat.start(Tomcat.java:252)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.ja

va:229)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:121)
at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:115)
at grails.web.container.EmbeddableServer$start.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:129)
at _GrailsRun_groovy$_run_closure5_closure11.doCall(_GrailsRun_groovy:155)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.ja
va:266)

It’s really a very good job. I recently check out the source code. When trying to run the project, I get an exception:

Did you remember to setMainWindow()

I think this is required for newer versions of vaadin than the v1.0 you are currently using. Can I use the framework in this case??

I’m really interested in this project. It would be great if I can try it in a simple way. I need some help :grin:

Thanks in advance

I cant make it to work!
Can someone please help me?