2012-03-17 7 views
2

誰もこれを通過しましたか?

私のOSGiアプリケーションではサーバー側でサービスをエクスポートしています。ここでは春のファイルコードは次のとおりです。

<!-- 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> 

マイIntegrationServiceExecutorクラスはIntegrationServiceインターフェイスを拡張し、メソッドを実装します。

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

IntegrationServiceインタフェースは別のコンポーネントで定義され、これと同じコンポーネントが私の.warに使用されていますクライアント側で

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

この最後の文が例外をスローします:

そのコンポーネントでは、また、私はこのようにリモートサービスを呼び出す

... 
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(); 
} 
} 

私の.warを通じて呼び出さリモート要求の実装を持っています

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) 

ここには何かがありますか? ありがとうございます。 カレン

答えて

1

これまでに見ましたが、インタフェースメソッドに 'RemoteExceptionをスローする'を追加する必要があります。クライアントはNoSuchMethodExceptionをスローしますが、実際にはRemoteExceptionが不足していると不平を言っています。

+0

よろしくお願い致します。 – jasonoriordan

関連する問題