[英]java.rmi.server.ExportException: remote object implements illegal remote interface
Getting this error:收到此错误:
1) Error injecting constructor, java.rmi.server.ExportException: remote object implements illegal remote interface; nested exception is:
java.lang.IllegalArgumentException: illegal remote method encountered: public abstract java.util.List com.mycompany.repository.CustomCodeRepository.getCustomCodeEntity(java.lang.String,java.lang.String,java.lang.String)
at com.mycompany.repository.impl.CustomCodeRepositoryImpl.<init>(CustomCodeRepositoryImpl.java:63)
while locating com.mycompany.repository.impl.CustomCodeRepositoryImpl
at com.mycompany.guice.GuiceConfigModule.configure(GuiceConfigModule.java:79)
while locating com.mycompany.repository.CustomCodeRepository
for field at com.mycompany.resource.ServerResource.customCodeRepository(ServerResource.java:53)
while locating com.mycompany.resource.ServerResource
For this code:对于这段代码:
@Override
protected void configure() {
bind(EntityRepository.class).to(EntityRepositoryImpl.class).in(Scopes.SINGLETON);
bind(CustomCodeRepository.class).to(CustomCodeRepositoryImpl.class).in(Scopes.SINGLETON);
}
public class CustomCodeRepositoryImpl extends UnicastRemoteObject
implements CustomCodeRepository {
@Inject
@Named("xodusRoot")
String xodusRoot;
@Inject
@Named("masterStore")
String masterStore;
@Inject
EntityRepository entityRepository;
public CustomCodeRepositoryImpl() throws RemoteException {
}
@Override
public String createCustomCode(String appId, String namespace, String customCodeName, String description, Long timeout, InputStream jar) {
}
@Override
public List<Map<String, Comparable>> getCustomCodeEntity(String appId, String namespace, String customCodeName) {
return entityRepository.getEntity(
appId,
namespace,
Constants.ENTITYSTORE_CUSTOMCODE,
Constants.CUSTOMCODE_NAME,
customCodeName,
new ArrayList<>());
}
As guice mention in its exception, it is a nested exception.正如 guice 在其异常中提到的那样,它是一个嵌套异常。 The inner exception is:内部异常是:
java.lang.IllegalArgumentException: illegal remote method encountered: public abstract java.util.List com.mycompany.repository.CustomCodeRepository.getCustomCodeEntity(java.lang.String,java.lang.String,java.lang.String)
I'd guess that you are overriding java.rmi.Remote
.我猜你正在覆盖java.rmi.Remote
。 If that is the case, so I'll quote from Illegal remote method in java :如果是这样,那么我将引用java 中的非法远程方法:
All of the methods on a RMI Remote interface must declare RemoteException in their throws clause. RMI Remote 接口上的所有方法都必须在其 throws 子句中声明 RemoteException。
That means that you need to add throws RemoteException
to the declaration of all methods in the interface that is extending Remote
.这意味着您需要将throws RemoteException
添加到扩展Remote
的接口中所有方法的声明中。 That is probably CustomCodeRepository
.那可能是CustomCodeRepository
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.