有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

春爪哇。lang.NoSuchMethodException:$Proxy205。调度(int,my.package.beans.AdapterHeader,my.package.beans.AdapterInfo)

有人经历过吗

在服务器端,在我的OSGi应用程序中,我导出一个服务。以下是spring文件代码:

    <!-- RMI SERVICE EXPORT -->
<bean class="org.springframework.remoting.rmi.RmiServiceExporter">
    <property name="serviceName" value="IntegrationRemoteService" />
    <property name="service" ref="integrationExecutor" />
    <property name="serviceInterface" value="my.package.services.IntegrationService" />
    <property name="registryPort" value="$system{integration.port}" />
</bean>

<!-- INTEGRATION EXECUTOR -->
<bean id="integrationExecutor" class="my.package.engine.IntegrationServiceExecutor">
    <property name="integrationServiceImpl" ref="integrationEngine" />      
</bean>

My IntegrationServiceExecutor类扩展了IntegrationService接口并实现了以下方法:

public class IntegrationServiceExecutor implements IntegrationService {
...
@Override
public GenericResult dispatch(int serviceCode, AdapterHeader adapterHeader,    AdapterInfo  adapterInfo) {

IntegrationService接口是在另一个组件中定义的,该组件在my中使用。客户端的战争。在该组件中,我还通过我的。战争

...
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.remoting.rmi.RmiProxyFactoryBean;
...

    public class GenericRmiFactory implements RemoteConnectionFactory {

private ProxyFactory proxyFactory;

public GenericRmiFactory(ServerTransport transport) throws ClassCastException, IllegalFormatException {
    RmiServerTransport rmiTransport = (RmiServerTransport) transport;

    RmiProxyFactoryBean rmiProxyFactoryBean = new RmiProxyFactoryBean();

    rmiProxyFactoryBean.setLookupStubOnStartup( false );
    rmiProxyFactoryBean.setCacheStub( false );
    rmiProxyFactoryBean.setRefreshStubOnConnectFailure( true );
    rmiProxyFactoryBean.setServiceUrl(String.format("rmi://%s:%s/%s", rmiTransport.getHostname(), rmiTransport.getPort(), rmiTransport.getServiceName() ));
    rmiProxyFactoryBean.setServiceInterface(rmiTransport.getRemoteInterface());
    rmiProxyFactoryBean.afterPropertiesSet();

    this.proxyFactory = new ProxyFactory(rmiTransport.getRemoteInterface(), rmiProxyFactoryBean);
}

private ProxyFactory getproxyFactory() {
    return proxyFactory;
}

@Override
public Object getRemoteService() {
    return getproxyFactory().getProxy();
}
}

我用这种方式调用远程服务:

    ...
    IntegrationService integrationService = (IntegrationService) getGenericRemoteFactory().getRemoteService();
integrationService.dispatch(myInt, myAdapterHeader, myAdapterInfo);
...

最后一条语句引发异常:

Invocation of method [public abstract my.package.result.GenericResult my.package.services.IntegrationService.dispatch(int,my.package.beans.AdapterHeader,my.package.beans.AdapterInfo)] failed in RMI service [rmi://127.0.0.1:2260/IntegrationRemoteService]; nested exception is java.lang.NoSuchMethodException: $Proxy205.dispatch(int, my.package.beans.AdapterHeader, my.package.beans.AdapterInfo)

我有什么遗漏吗? 提前谢谢, 凯伦


共 (0) 个答案