"Object: null is not a known entity type" when refreshing JPAContainer

It seems the container cannot be refreshed twice after a remove?

To reproduce:


container.removeItem(id);
container.refresh();//this one works
container.refresh();//this one will throw exception

Exception is the following


SEVERE: Terminal error:
com.vaadin.event.ListenerMethod$MethodException
Cause: java.lang.IllegalArgumentException: Object: null is not a known entity type.
	at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:532)
	at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:164)
	at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1219)
	at com.vaadin.ui.Button.fireClick(Button.java:550)
	at com.vaadin.ui.Button.changeVariables(Button.java:217)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.changeVariables(AbstractCommunicationManager.java:1451)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1399)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1318)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:763)
	at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:296)
	at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:501)
	at org.vaadin.navigator7.NavigableApplicationServlet.service(NavigableApplicationServlet.java:46)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at com.springsource.insight.collection.tcserver.request.HttpRequestOperationCollectionValve.invoke(HttpRequestOperationCollectionValve.java:84)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:279)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: Object: null is not a known entity type.
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.contains(EntityManagerImpl.java:946)
	at com.vaadin.addon.jpacontainer.provider.LocalEntityProvider.refreshEntity(LocalEntityProvider.java:825)
	at com.vaadin.addon.jpacontainer.JPAContainerItem.refresh(JPAContainerItem.java:617)
	at com.vaadin.addon.jpacontainer.JPAContainer.refreshItem(JPAContainer.java:1655)
	at com.vaadin.addon.jpacontainer.JPAContainer.refresh(JPAContainer.java:1670)

Hi,

The issue is solved in this ticket:
http://dev.vaadin.com/ticket/8416

If you have a change, please test with the latest snapshot build from our snapshot repository:
https://oss.sonatype.org/content/repositories/vaadin-snapshots/
https://oss.sonatype.org/content/repositories/vaadin-snapshots/com/vaadin/addon/jpacontainer-addon-agpl-3.0/2.0.1-SNAPSHOT/

Let me know if it works and also any new findings that you make.

cheers,
matti

Thank you Matti, It works now. Now I’m using this maven
com.vaadin.addon
jpacontainer-addon-agpl-3.0
2.0.1-SNAPSHOT