SpringRooPlugin - NullPointerException

Hi all,
As a vaadin greenhorn I see myself forced to ask for help regarding this problem.

After installing the spring.roo.addon I bootstraped a new project using the roo script “pizzashop.roo” located in the addons samples folder.
That resulted in a project not working out of the box.
The entity manager related error messages got away after I added the following exclusion to the pom.xml:


    <dependency>
            <groupId>com.vaadin.addon</groupId>
            <artifactId>[b]
jpacontainer-addon
[/b]</artifactId>
            <version>1.0.2</version>
            <exclusions>
            	<exclusion>
            		<groupId>javax.persistence</groupId>
            		<artifactId>persistence-api</artifactId>
            	</exclusion>
            </exclusions>
        </dependency>

Now the project is runable with jetty:run and I can actually create entries for all involved Entities.

But when I try to edit one of the existing entities via the webapp exceptions show up.
I managed to get rid of some by eagerly loading relations. But now I got stuck with these NullPointerException and have no idea about how to get rid of them too.

The exception gets triggeret when getForm().commit(); is called in the
ButtonClickListener
of the generated abstract class AbstractEntityView.


Caused by: com.vaadin.data.Buffered$SourceException
	at com.vaadin.ui.Form.commit(Form.java:362)
	at org.vaadin.roo.pizzashop.web.ui.AbstractEntityView$ButtonClickListener.buttonClick(AbstractEntityView.java:47)
	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 com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:487)
	... 35 more
Caused by: com.vaadin.data.Buffered$SourceException
	at com.vaadin.ui.AbstractField.commit(AbstractField.java:247)
	at com.vaadin.ui.Form.commit(Form.java:336)
	... 41 more
Caused by: java.lang.NullPointerException
	at com.vaadin.data.util.BeanItemContainer.getContainerProperty(BeanItemContainer.java:482)
	at com.vaadin.ui.AbstractSelect.getContainerProperty(AbstractSelect.java:744)

Any ideas how I can fix this?

Andreas

roo project attached
vaadin 6.4.2
java version “1.6.0_20”
mac osx 10.6.4
11428.zip (69.8 KB)

Sorry for the late reply.

There are now quite a few changes in the Roo add-on since the version you used, including also the use of JPAContainer 1.0.3 which might resolve some dependency issues. The version of the Roo add-on you used seems to have been the very first one with partial support for JPAContainer. In the current version in SVN, JPAContainer is used by default (but for the moment only for relations).

I hope the current version would work better for you, but it is still work in progress with many things to do. Even the “static” (generated only once upon “vaadin setup”) classes will change somewhat, so if you create a project with the add-on now, be prepared not to be able to use future versions of the add-on in the same project.

That said, I was able to create a new project and run it without any changes - at least using a Roo version that I have checked out very soon after 1.1.0.M3. If you want to use BeanItemContainer instead of JPAContainer, the entities currently need to implement id-based equals() and hashCode() methods.