Eclipse Scout Neon : service registry does not contain a service of type

丶灬走出姿态 提交于 2019-12-11 09:58:55

问题


I try to call scout service from Scout Form, so I create interface in shared folder

@TunnelToServer
public interface IPersonsFormService extends IService {

  void test();
}

and in server I created implementation of this interface

public class PersonsFormService implements IPersonsFormService {

  @Override
  public void test() {

    System.out.println("TEST");

  }

}

but I get

o.e.scout.rt.platform.exception.ExceptionHandler - SecurityException:service registry does not contain a service of type com.sixt.leasing.contract.scout.shared.person.IPersonsFormService [majorPrincipal: 'marko']
java.lang.SecurityException: service registry does not contain a service of type com.sixt.leasing.contract.scout.shared.person.IPersonsFormService

It looks like interface is not registered, but in Neon I thought that service is registered with @TunnelToServer annotation.

Where else should I register service ?

This project is extension project of main project.

In Main project all services works,....


回答1:


Solution: put scout.xml with default content in src/main/resources/META-INF folder of the server project.

Why did this happen? Since this is an extension we apparently forgot to copy this file and Scout Neon seems to ignore projects that don't contain this file.

Figured this out by putting a PlatformListener in that project and since that never triggered it was easier to track down the issue.




回答2:


This annotation is requested for Remote-Service (see also the 3.5.1. @TunnelToServer section). The implementation class (or the interface) should have the @ApplicationScoped annotation.

For Local-Service, use either the @Bean or the @ApplicationScoped annotation to register the service.


If your annotations are correct, your Jandex index might be broken. Start the application with -Djandex.rebuild=true to rebuild the application on startup.

This will recalculate each of your target/classes/META-INF/jandex.idx files.

Of course, you can also delete each file manually. Running mvn clean also clean those files.



来源:https://stackoverflow.com/questions/34673540/eclipse-scout-neon-service-registry-does-not-contain-a-service-of-type

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!