【问题标题】:UndeclaredThrowableException with a client only eclipse scout applicationUndeclaredThrowableException 与仅客户端 Eclipse 侦察应用程序
【发布时间】:2014-07-15 17:15:58
【问题描述】:

我正在尝试做一个仅限客户端的 Eclipse Scout 应用程序。

我选择了菜单“New Scout Project...”,在向导的第一步中我只检查了:

  • com.company.app.ui.swt
  • com.company.app.client
  • com.company.app.shared

一切似乎都很好,但是当我启动我的客户端应用程序时,我得到以下 Stacktrace:

!ENTRY org.eclipse.scout.rt.client 4 0 2014-07-09 15:35:06.078
!MESSAGE org.eclipse.scout.rt.client.AbstractClientSession.startSession(AbstractClientSession.java:257) load session
!STACK 0
java.lang.reflect.UndeclaredThrowableException
    at com.sun.proxy.$Proxy17.getAllCodeTypeClasses(Unknown Source)
    at org.eclipse.scout.rt.client.services.common.code.CodeServiceClientProxy.getAllCodeTypeClasses(CodeServiceClientProxy.java:333)
    at org.eclipse.scout.rt.client.services.common.code.CodeServiceClientProxy.getAllCodeTypes(CodeServiceClientProxy.java:354)
    at org.eclipse.scout.rt.shared.services.common.code.CODES.getAllCodeTypes(CODES.java:97)
    at com.company.app.client.ClientSession.execLoadSession(ClientSession.java:33)
    at org.eclipse.scout.rt.client.AbstractClientSession.startSession(AbstractClientSession.java:252)
    at org.eclipse.scout.rt.client.services.common.session.internal.ClientSessionRegistryService$1.runVoid(ClientSessionRegistryService.java:64)
    at org.eclipse.scout.rt.client.ClientJob.runStatus(ClientJob.java:189)
    at org.eclipse.scout.rt.client.ClientJob.runTransactionWrapper(ClientJob.java:172)
    at org.eclipse.scout.rt.client.ClientJob.run(ClientJob.java:159)
    at org.eclipse.scout.commons.job.JobEx.runNow(JobEx.java:51)
    at org.eclipse.scout.rt.client.services.common.session.internal.ClientSessionRegistryService.createAndStartClientSession(ClientSessionRegistryService.java:68)
    at org.eclipse.scout.rt.client.services.common.session.internal.ClientSessionRegistryService.newClientSession(ClientSessionRegistryService.java:39)
    at org.eclipse.scout.rt.ui.swt.AbstractSwtEnvironment$4.run(AbstractSwtEnvironment.java:539)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

为什么客户端应用程序需要连接到一个不存在的服务器?

【问题讨论】:

    标签: eclipse eclipse-scout


    【解决方案1】:

    这是Scout SDK的问题。

    当您创建新的 scout 项目时,生成的客户端代码依赖于服务器,即使您在向导中取消选中了服务器。

    您需要删除对服务器产生调用的元素。

    <your app>.client.ClientSession.execLoadSession() 中删除这些行:

    setServiceTunnel(new ClientHttpServiceTunnel(this, UriUtility.toUrl(getBundle().getBundleContext().getProperty("server.url"))));
    
    //pre-load all known code types
    CODES.getAllCodeTypes(com.company.app.shared.Activator.PLUGIN_ID);
    

    <your app>.client.ui.desktop.Desktop 中删除内部类:

    @Order(25)
    public class BookmarkMenu extends AbstractBookmarkMenu {
      public BookmarkMenu() {
        super(Desktop.this);
      }
    }
    

    您的客户端应用程序将启动。

    【讨论】:

      【解决方案2】:

      Scout SDK 的新项目向导并不适合创建仅限客户端的应用程序。您需要在某些地方手动调整生成的代码。

      Scout book 中描述了最简单(也是最有限)的方法,我们在其中描述了一个 Scout 小部件演示应用程序。

      如需更详细的答案,您可能需要阅读此forum post

      【讨论】:

        猜你喜欢
        • 2020-05-17
        • 1970-01-01
        • 1970-01-01
        • 2015-06-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多