vaadin7:从视图调用导航器会导致堆栈溢出错误

时间:2013-12-21 18:53:01

标签: vaadin vaadin7

鉴于封装了vaadin Navigator的主UI,我需要从搜索视图中调用它,以便在另一个视图中显示搜索结果:

1)主要Ui

Navigator nav = new Navigator(this, content)
        nav.addView("/search", new SearchView())
...

所以一切正常(与其他视图一起),直到我实现搜索视图:

private static final String VIEW_SEARCH= "search"
        private static final String VIEW_RESULTS = "searchResults"

在构造函数中: public SearchView(){

UI.getCurrent().getNavigator().addView(VIEW_SEARCH, new SearchView())
UI.getCurrent().getNavigator().addView(VIEW_RESULTS, new SearchResultsView())

会导致堆栈溢出错误:

*********************************************************
*** java.lang.instrument ASSERTION FAILED ***: "!errorOutstanding" with message transform method call failed at ../../../src/share/instrument/JPLISAgent.c line: 844
*** java.lang.instrument ASSERTION FAILED ***: "!errorOutstanding" with message transform method call failed at ../../../src/share/instrument/JPLISAgent.c line: 844
2013-12-21 19:47:00,772 ERROR [DefaultErrorHandler] - 
com.vaadin.server.ServerRpcManager$RpcInvocationException: Unable to invoke method click in com.vaadin.shared.ui.button.ButtonServerRpc
    at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:170)
    at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:118)
    at com.vaadin.server.communication.ServerRpcHandler.handleBurst(ServerRpcHandler.java:207)
    at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:111)
    at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:91)
    at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:37)
    at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1382)
    at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:238)
    at grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter.doFilter(GrailsAnonymousAuthenticationFilter.java:53)
    at grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter.doFilter(RequestHolderAuthenticationFilter.java:49)
    at grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter.doFilter(MutableLogoutFilter.java:82)
    at grails.plugin.springsecurity.web.filter.DebugFilter.invokeWithWrappedRequest(DebugFilter.java:102)
    at grails.plugin.springsecurity.web.filter.DebugFilter.doFilter(DebugFilter.java:69)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.reflect.InvocationTargetException
    at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:168)
    ... 15 more
Caused by: com.vaadin.event.ListenerMethod$MethodException: Invocation of method buttonClick in com.webvibes.conquest.ui.KMUI$2 failed.
    at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:528)
    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:969)
    at com.vaadin.ui.Button.fireClick(Button.java:368)
    at com.vaadin.ui.Button$1.click(Button.java:57)
    ... 16 more
Caused by: java.lang.StackOverflowError
    at java.lang.ClassLoader.defineClass(ClassLoader.java:792)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at com.webvibes.conquest.ui.SearchView.<init>(SearchView.groovy:43)
    at com.webvibes.conquest.ui.SearchView.<init>(SearchView.groovy:43)

此处的目标非常基本,搜索视图会处理一个按钮,该按钮会打开带有参数的结果的新视图:

KMUI.getCurrent().getNavigator().navigateTo(VIEW_RESULTS)

感谢您的帮助。

* 更新:

好吧,好像放

UI.getCurrent().getNavigator().addView(VIEW_SEARCH, new SearchView())
UI.getCurrent().getNavigator().addView(VIEW_RESULTS, new SearchResultsView())

直接进入主UI完成工作,

但是,在这种情况下我想念结果构造函数来发送结果...将结果(HashMap)发送到reults视图的最佳方法是什么:

No signature of method: com.vaadin.navigator.Navigator.navigateTo() is applicable for argument types: (java.lang.String, java.util.HashMap) values: [/searchResults, [total:0, hits:org.compass.core.impl.DefaultCompassDetachedHits@340f9d23, ...]]
Possible solutions: navigateTo(java.lang.String)

        KMUI.getCurrent().getNavigator().navigateTo(VIEW_RESULTS, res)

1 个答案:

答案 0 :(得分:0)

您可以使用会话将参数传递给另一个视图。 请查看此链接以获取示例:

Setting and reading session attributes