Hi, I don’t understand what I’m doing wrong:
I’ve installed STS (Spring IDE) including Spring Roo, downloaded the Vaadin Spring Roo Plugin, followed all explainations from the pizza example.
I’ve successfully generated the Pizza example from scratch and tested it ! All is working great ! Super !
So, I would like to test automatic generation from existing DB. To achieve this, I create a new DB in postgresql with the following table (DDL):
CREATE TABLE personne (
id INTEGER NOT NULL,
valor INTEGER NOT NULL,
vedette CHARACTER VARYING(255),
nom CHARACTER VARYING(255),
prenom CHARACTER VARYING(255),
telephone1 CHARACTER VARYING(255),
fax CHARACTER VARYING(255),
courriel CHARACTER VARYING(255),
commentaire CHARACTER VARYING(255),
nom_epouse CHARACTER VARYING(255),
telephone2 CHARACTER VARYING(255),
adresse_adresse CHARACTER VARYING(255),
adresse_codepostal CHARACTER VARYING(255),
adresse_commune CHARACTER VARYING(255),
adresse_localite CHARACTER VARYING(255),
adresse_province CHARACTER VARYING(255),
adresse_rue CHARACTER VARYING(255),
adresse_numero CHARACTER VARYING(255),
adresse_boite CHARACTER VARYING(255),
adresse_pays CHARACTER VARYING(255),
adresse_telephone1 CHARACTER VARYING(255),
adresse_telephone2 CHARACTER VARYING(255),
adresse_fax CHARACTER VARYING(255),
adresse_email CHARACTER VARYING(255),
numero_niss CHARACTER VARYING(255),
birth_date TIMESTAMP(6) WITHOUT TIME ZONE,
encadrant_fk INTEGER,
coordinateur_daccueil_fk INTEGER,
accueillante_fk INTEGER,
view_perid CHARACTER VARYING(100),
view_accid CHARACTER VARYING(100),
PRIMARY KEY (id),
CONSTRAINT 2200_23162_1_not_null CHECK (id IS NOT NULL),
CONSTRAINT 2200_23162_2_not_null CHECK (valor IS NOT NULL)
);
So, only one table in my DB.
I’ve created a new project (in STS: New, Spring Roo Project) with the following informations:
Project Name: atl
Base Package: be.one
I leave all the rest by default.
STS crete the project then open the Roo Console, so I Type the following commands:
project --topLevelPackage be.one.atl
persistence setup --provider HIBERNATE --database POSTGRES
here, Roo ask to populate the “database.properties” file, so I fill it with my DB informations then test it with the command
database properties list
All is fine so I continue :
database introspect --schema public
database reverse engineer --schema public --package ~.database
controller all --package ~.web
perform tests
At this point, Spring Roo has generated my entities “Personne.java” so it can see my Database and access it.
I continue with the following command:
vaadin setup --applicationPackage ~.web --baseName Atlas --themeName theme1 --useJpaContainer false
Wonderfull, it create some others classes like:
AbstractEntityView.java
AbstractEntityView_Roo_AbstractEntityView.aj
AtlasApplication.java
AtlasEntityManagerView.java
AtlasEntityManagerView_Roo_VaadinEntityManagerView.aj
AtlasWindow.java
AutomaticEntityForm.java
EntityEditor.java
EntityFieldWrapper.java
EntitySetFieldWrapper.java
EntityTableColumnGenerator.java
It also created the “theme1” and adapted the web.xml. So the Vaadin Plugin work perfectly.
But now, the last command fail:
vaadin generate all --package ~.web.ui --visuallyComposable true
It stop with the following error:
NullPointerException at com.vaadin.spring.roo.addon.entityform.VisuallyComposableFormCreationHelper.<init>(VisuallyComposableFormCreationHelper.java:45)
What do I wrong ?
Following the full roo logs:
[i]
____ ____ ____
/ __ \/ __ \/ __ \
/ /_/ / / / / / / /
/ _, _/ /_/ / /_/ /
/_/ |_|\____/\____/ 1.1.1.RELEASE [rev 156ccd6]
Welcome to Spring Roo. For assistance press CTRL+SPACE or type "hint" then hit ENTER.
roo> [color=#FF0000]
persistence setup --provider HIBERNATE --database POSTGRES
[/color]
Updated ROOT\pom.xml [Removed redundant artifacts]
Updated SRC_MAIN_RESOURCES\META-INF\spring\applicationContext.xml
Created SRC_MAIN_RESOURCES\META-INF\persistence.xml
Created SRC_MAIN_RESOURCES\META-INF\spring\database.properties
Updated ROOT\pom.xml [Added dependencies postgresql:postgresql:8.4-701.jdbc3, org.hibernate:hibernate-core:3.6.0.Final, org.hibernate:hibernate-entitymanager:3.6.0.Final, org.hibernate.javax.persistence:hibernate-jpa-2.0-api:1.0.0.Final, org.hibernate:hibernate-validator:4.1.0.Final, javax.validation:validation-api:1.0.0.GA, cglib:cglib-nodep:2.2, javax.transaction:jta:1.1, org.springframework:spring-jdbc:${spring.version}, org.springframework:spring-orm:${spring.version}, commons-pool:commons-pool:1.5.4, commons-dbcp:commons-dbcp:1.3]
Updated ROOT\pom.xml [Added repository https://repository.jboss.org/nexus/content/repositories/releases]
Please enter your database details in src/main/resources/META-INF/spring/database.properties.
roo> [color=#FF0000]
database properties list
[/color]
database.driverClassName = org.postgresql.Driver
database.password = stef
database.url = jdbc:postgresql://localhost:5432/one-atl-saga2
database.username = postgres
roo> [color=#FF0000]
database introspect --schema public
[/color]
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.--><!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database_3_3.dtd">
<database name="public">
<table name="personne">
<column name="id" primaryKey="true" required="true" size="10" type="4,int4"/>
<column name="valor" primaryKey="false" required="true" size="10" type="4,int4"/>
<column name="vedette" primaryKey="false" required="false" size="255" type="12,varchar"/>
<column name="nom" primaryKey="false" required="false" size="255" type="12,varchar"/>
<column name="prenom" primaryKey="false" required="false" size="255" type="12,varchar"/>
<column name="telephone1" primaryKey="false" required="false" size="255" type="12,varchar"/>
<column name="fax" primaryKey="false" required="false" size="255" type="12,varchar"/>
<column name="courriel" primaryKey="false" required="false" size="255" type="12,varchar"/>
<column name="commentaire" primaryKey="false" required="false" size="255" type="12,varchar"/>
<column name="nom_epouse" primaryKey="false" required="false" size="255" type="12,varchar"/>
<column name="telephone2" primaryKey="false" required="false" size="255" type="12,varchar"/>
<column name="adresse_adresse" primaryKey="false" required="false" size="255" type="12,varchar"/>
<column name="adresse_codepostal" primaryKey="false" required="false" size="255" type="12,varchar"/>
<column name="adresse_commune" primaryKey="false" required="false" size="255" type="12,varchar"/>
<column name="adresse_localite" primaryKey="false" required="false" size="255" type="12,varchar"/>
<column name="adresse_province" primaryKey="false" required="false" size="255" type="12,varchar"/>
<column name="adresse_rue" primaryKey="false" required="false" size="255" type="12,varchar"/>
<column name="adresse_numero" primaryKey="false" required="false" size="255" type="12,varchar"/>
<column name="adresse_boite" primaryKey="false" required="false" size="255" type="12,varchar"/>
<column name="adresse_pays" primaryKey="false" required="false" size="255" type="12,varchar"/>
<column name="adresse_telephone1" primaryKey="false" required="false" size="255" type="12,varchar"/>
<column name="adresse_telephone2" primaryKey="false" required="false" size="255" type="12,varchar"/>
<column name="adresse_fax" primaryKey="false" required="false" size="255" type="12,varchar"/>
<column name="adresse_email" primaryKey="false" required="false" size="255" type="12,varchar"/>
<column name="numero_niss" primaryKey="false" required="false" size="255" type="12,varchar"/>
<column name="birth_date" primaryKey="false" required="false" size="29,6" type="93,timestamp"/>
<column name="encadrant_fk" primaryKey="false" required="false" size="10" type="4,int4"/>
<column name="coordinateur_daccueil_fk" primaryKey="false" required="false" size="10" type="4,int4"/>
<column name="accueillante_fk" primaryKey="false" required="false" size="10" type="4,int4"/>
<column name="view_perid" primaryKey="false" required="false" size="100" type="12,varchar"/>
<column name="view_accid" primaryKey="false" required="false" size="100" type="12,varchar"/>
<unique name="personne_pkey">
<unique-column name="id"/>
</unique>
<unique name="pk__personne__7feafd3e">
<unique-column name="id"/>
</unique>
</table>
</database>
roo> [color=#FF0000]
database reverse engineer --schema public --package ~.database
[/color]
Created SRC_MAIN_JAVA\be\one\database
Created SRC_MAIN_JAVA\be\one\database\Personne.java
Updated SRC_MAIN_RESOURCES\META-INF\persistence.xml
Created ROOT\.roo-dbre
Created SRC_MAIN_JAVA\be\one\database\Personne_Roo_ToString.aj
Created SRC_MAIN_JAVA\be\one\database\Personne_Roo_Configurable.aj
Created SRC_MAIN_JAVA\be\one\database\Personne_Roo_DbManaged.aj
Created SRC_MAIN_JAVA\be\one\database\Personne_Roo_Entity.aj
roo> [color=#FF0000]
controller all --package ~.web
[/color]
be.one.web roo> [color=#FF0000]
perform tests
[/color]
[INFO]
Scanning for projects...
[INFO]
[INFO]
------------------------------------------------------------------------
[INFO]
Building atl2 0.1.0.BUILD-SNAPSHOT
[INFO]
------------------------------------------------------------------------
[INFO]
[INFO]
--- aspectj-maven-plugin:1.0:compile (default) @ atl2 ---
[WARNING]
advice defined in org.springframework.scheduling.aspectj.AbstractAsyncExecutionAspect has not been applied [Xlint:adviceDidNotMatch]
[WARNING]
advice defined in org.springframework.mock.staticmock.AnnotationDrivenStaticEntityMockingControl has not been applied [Xlint:adviceDidNotMatch]
[WARNING]
advice defined in org.springframework.mock.staticmock.AbstractMethodMockingControl has not been applied [Xlint:adviceDidNotMatch]
[INFO]
[INFO]
--- maven-resources-plugin:2.4.2:resources (default-resources) @ atl2 ---
[INFO]
Using 'UTF-8' encoding to copy filtered resources.
[INFO]
Copying 4 resources
[INFO]
[INFO]
--- maven-compiler-plugin:2.1:compile (default-compile) @ atl2 ---
[INFO]
Nothing to compile - all classes are up to date
[INFO]
[INFO]
--- aspectj-maven-plugin:1.0:test-compile (default) @ atl2 ---
[INFO]
[INFO]
--- maven-resources-plugin:2.4.2:testResources (default-testResources) @ atl2 ---
[INFO]
Using 'UTF-8' encoding to copy filtered resources.
[INFO]
Copying 0 resource
[INFO]
[INFO]
--- maven-compiler-plugin:2.1:testCompile (default-testCompile) @ atl2 ---
[INFO]
Nothing to compile - all classes are up to date
[INFO]
[INFO]
--- maven-surefire-plugin:2.5:test (default-test) @ atl2 ---
[INFO]
Surefire report directory: C:\Datas\_Coder\Prj_Vaadin\atl2\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
There are no tests to run.
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
------------------------------------------------------------------------
[INFO]
BUILD SUCCESS
[INFO]
------------------------------------------------------------------------
[INFO]
Total time: 14.969s
[INFO]
Finished at: Sat Feb 05 16:29:42 CET 2011
[INFO]
Final Memory: 5M/15M
[INFO]
------------------------------------------------------------------------
be.one.web roo> [color=#FF0000]
vaadin setup --applicationPackage ~.web --baseName Atlas --themeName theme1 --useJpaContainer false
[/color]
Performing vaadin setup
Updated ROOT\pom.xml [Added dependency com.vaadin:vaadin:6.5.0.pre2]
Updated ROOT\pom.xml [Added dependency com.vaadin:com.vaadin.spring.roo.annotations:0.9.1.BUILD-SNAPSHOT]
Updated ROOT\pom.xml [Added dependency org.vaadin.addons:customfield:0.8.0]
Updated ROOT\pom.xml [Added dependency org.springframework:spring-web:${spring.version}]
Updated ROOT\pom.xml [Added repository vaadin-snapshots]
Updated ROOT\pom.xml [Added repository vaadin-addons]
Updated ROOT\pom.xml [Added dependency com.vaadin.addon:beanvalidation-addon:0.6.1]
Created SRC_MAIN_WEBAPP\VAADIN\themes\theme1
Created SRC_MAIN_WEBAPP\VAADIN\themes\theme1\styles.css
Created SRC_MAIN_WEBAPP\VAADIN\themes\theme1\img
Created SRC_MAIN_WEBAPP\VAADIN\themes\theme1\img\menu-item-separator.png
Created SRC_MAIN_WEBAPP\VAADIN\themes\theme1\img\new-button.png
Created SRC_MAIN_WEBAPP\VAADIN\themes\theme1\img\menu-item-sel-bg.png
Created SRC_MAIN_WEBAPP\VAADIN\themes\theme1\img\sidebar-bg.png
Created SRC_MAIN_WEBAPP\VAADIN\themes\theme1\img\edit-icon.png
Created SRC_MAIN_WEBAPP\VAADIN\themes\theme1\entityviews
Created SRC_MAIN_WEBAPP\VAADIN\themes\theme1\entityviews\entityviews.css
Created SRC_MAIN_WEBAPP\VAADIN\themes\theme1\entityviews\entitymanagerview.css
Created SRC_MAIN_WEBAPP\WEB-INF
Created SRC_MAIN_WEBAPP\WEB-INF\web.xml
Updated SRC_MAIN_WEBAPP\WEB-INF\web.xml
Updated ROOT\pom.xml [Updated project type to war]
Created SRC_MAIN_JAVA\be\one\web
Created SRC_MAIN_JAVA\be\one\web\AtlasApplication.java
Created SRC_MAIN_JAVA\be\one\web\AtlasWindow.java
Created SRC_MAIN_JAVA\be\one\web\AtlasEntityManagerView.java
Created SRC_MAIN_JAVA\be\one\web\AbstractEntityView.java
Created SRC_MAIN_JAVA\be\one\web\AutomaticEntityForm.java
Created SRC_MAIN_JAVA\be\one\web\EntityFieldWrapper.java
Created SRC_MAIN_JAVA\be\one\web\EntitySetFieldWrapper.java
Created SRC_MAIN_JAVA\be\one\web\EntityTableColumnGenerator.java
Created SRC_MAIN_JAVA\be\one\web\EntityEditor.java
Created SRC_MAIN_JAVA\be\one\web\AtlasEntityManagerView_Roo_VaadinEntityManagerView.aj
Created SRC_MAIN_JAVA\be\one\web\AbstractEntityView_Roo_AbstractEntityView.aj
be.one.web roo> [color=#FF0000]
vaadin generate all --package ~.web.ui --visuallyComposable true
[/color]
Created SRC_MAIN_JAVA\be\one\web\ui
Created SRC_MAIN_JAVA\be\one\web\ui\PersonneView.java
Undo create SRC_MAIN_JAVA\be\one\web\ui\PersonneView.java
Undo create SRC_MAIN_JAVA\be\one\web\ui
[color=#FF0000]
NullPointerException at com.vaadin.spring.roo.addon.entityform.VisuallyComposableFormCreationHelper.<init>(VisuallyComposableFormCreationHelper.java:45)
[/color]
be.one.web roo>
[/i]
Any idea ?
Thank’s
SteF