Eclipse Scout Neon:服务注册表不包含类型的服务
Eclipse Scout Neon : service registry does not contain a service of type
我尝试从 Scout Form 调用 scout 服务,所以我在共享文件夹中创建接口
@TunnelToServer
public interface IPersonsFormService extends IService {
void test();
}
并且在服务器中我创建了这个接口的实现
public class PersonsFormService implements IPersonsFormService {
@Override
public void test() {
System.out.println("TEST");
}
}
但我得到
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
看起来接口没有注册,但在 Neon 中我认为服务是用 @TunnelToServer
注释注册的。
我还应该在哪里注册服务?
本项目是主项目的扩展项目。
在主项目中,所有服务都正常工作,....
此注释是为 Remote-Service 请求的(另请参阅 3.5.1. @TunnelToServer 部分)。实现 class(或接口)应该有 @ApplicationScoped
注释。
对于 Local-Service,使用 @Bean
或 @ApplicationScoped
注释来注册服务。
如果您的注释正确,则您的 Jandex 索引可能已损坏。
使用 -Djandex.rebuild=true
启动应用程序以在启动时重建应用程序。
这将重新计算您的每个 target/classes/META-INF/jandex.idx
文件。
当然,您也可以手动删除每个文件。 运行 mvn clean
也清理那些文件。
解决方案:将scout.xml
和默认内容放在服务器项目的src/main/resources/META-INF
文件夹中。
为什么会这样?由于这是一个扩展,我们显然忘记了复制此文件,而 Scout Neon 似乎忽略了不包含此文件的项目。
通过在该项目中放置一个 PlatformListener 来解决这个问题,因为它从未触发,所以更容易追踪问题。
我尝试从 Scout Form 调用 scout 服务,所以我在共享文件夹中创建接口
@TunnelToServer
public interface IPersonsFormService extends IService {
void test();
}
并且在服务器中我创建了这个接口的实现
public class PersonsFormService implements IPersonsFormService {
@Override
public void test() {
System.out.println("TEST");
}
}
但我得到
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
看起来接口没有注册,但在 Neon 中我认为服务是用 @TunnelToServer
注释注册的。
我还应该在哪里注册服务?
本项目是主项目的扩展项目。
在主项目中,所有服务都正常工作,....
此注释是为 Remote-Service 请求的(另请参阅 3.5.1. @TunnelToServer 部分)。实现 class(或接口)应该有 @ApplicationScoped
注释。
对于 Local-Service,使用 @Bean
或 @ApplicationScoped
注释来注册服务。
如果您的注释正确,则您的 Jandex 索引可能已损坏。
使用 -Djandex.rebuild=true
启动应用程序以在启动时重建应用程序。
这将重新计算您的每个 target/classes/META-INF/jandex.idx
文件。
当然,您也可以手动删除每个文件。 运行 mvn clean
也清理那些文件。
解决方案:将scout.xml
和默认内容放在服务器项目的src/main/resources/META-INF
文件夹中。
为什么会这样?由于这是一个扩展,我们显然忘记了复制此文件,而 Scout Neon 似乎忽略了不包含此文件的项目。
通过在该项目中放置一个 PlatformListener 来解决这个问题,因为它从未触发,所以更容易追踪问题。