Clara plugin - NPE when attempting multiple views

Using Clara 1.4.0 and Vaading 7.4.7.

So in my main view I load it via Spring like so:

@VaadinView(name = "") @Scope("ui") public class MainView extends HorizontalLayout implements View In my main view I load the clara xml file like so:

/** * This is where we load our XML component/layout file. */ private void loadClaraFile() { // 'this' == class containing annotations the xml file binds against HorizontalLayout layout = (HorizontalLayout) Clara.create("MainView.xml", this); getUI().setContent(layout); } This loads the main view with no issues. The problem occurs when I want to ‘replace’ this view with another view defined via a Clara XML file.

So the MainView has a button that when clicked I want to ‘drill down’ into another view. I’ve got several applications where I do this using standard Vaadin with no issues. No matter WHAT I try to do using CLARA I get an NPE. :frowning:

If I changed the “StatesView” Spring annotation to match the MainView and give the MainView a bogus item with something like this:

[code]
@VaadinView(name = “crap”)
@Scope(“ui”)
public class MainView extends HorizontalLayout implements View {

@VaadinView(name = “”)
@Scope(“ui”)
public class StatesView extends HorizontalLayout implements View {
[/code]My StatesView screen loads via XML with NO ISSUES. But the odd thing is this.

Anything I try to do to swap out the view to the ‘drill down’ States View causes an NPE with very little help.
Any clue why this can’t easily scale with Clara to load views in and out via the Navigator?

Here is my full stack trace:

Jun 16, 2015 2:34:49 PM com.vaadin.server.DefaultErrorHandler doDefault SEVERE: java.lang.NullPointerException at org.tiaacref.rules_engine.view.MainView.showEditStatesView(MainView.java:162) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.vaadin.teemu.clara.binder.Binder$ListenerInvocationHandler.invoke(Binder.java:258) at com.sun.proxy.$Proxy225.buttonClick(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:508) at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:198) at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:161) at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:977) at com.vaadin.ui.Button.fireClick(Button.java:393) at com.vaadin.ui.Button$1.click(Button.java:61) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:168) at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:118) at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:291) at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:184) at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:92) at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:41) at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1408) at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:350) at javax.servlet.http.HttpServlet.service(HttpServlet.java:844) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:341) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79) at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3367) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3333) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57) at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2220) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2146) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2124) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1564) at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:295) at weblogic.work.ExecuteThread.run(ExecuteThread.java:254) Here is my clickListener code. I’ve commented out different ways to try and get the view to load. Nothing worked. Anything here causes an NPE.

@UiHandler("addEditStates") public void showEditStatesView(ClickEvent event) { final StatesView view = new StatesView(); LOG.info("is view = null ? " + view == null); getUI().getNavigator().navigateTo("StatesView"); // // getUI().setContent(view); // getUI().getNavigator().getDisplay().showView(view); } Is there an example of Clara being used with multiple views ?

Someone please say yes. :slight_smile:

Cheers