Search code examples
eclipseeclipse-scout

UndeclaredThrowableException with a client only eclipse scout application


I am trying to do a client only Eclipse Scout application.

I selected the menu “New Scout Project…” and in the first step of the wizard I checked only:

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

Everything seems to be fine, but when I start my client application, I get following 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)

Why does the Client application needs to connect to a server that do not exists?


Solution

  • This is an issue of the Scout SDK.

    When you create your new scout project, the generated client code rely on a server, even if you have unchecked the server in the wizard.

    You need to remove the elements that produce calls to the server.

    In <your app>.client.ClientSession.execLoadSession() remove the lines:

    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);
    

    In <your app>.client.ui.desktop.Desktop remove the inner-class:

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

    Your client only application will start.