1

RMIを使用していくつかの Bean を作成しSpring、それらをエクスポートしようとしています...

これが私のコードです:

<bean class="org.springframework.remoting.rmi.RmiServiceExporter">
    <property name="serviceName" value="OfferService" />
    <property name="service" ref="offerService" />
    <property name="serviceInterface" value="ro.project.services.OfferService" />
    <property name="registryPort" value="1199" />
</bean>

ルート フォルダーに「policy.all」というファイルを作成し、その引数を使用して VM を実行していますが、まだ次のエラーが発生します。

java.lang.ClassNotFoundException: org.springframework.remoting.rmi.RmiInvocationHandler (no security manager: RMI class loader disabled)

何をすべきかわかりません... Linuxでは、まったく同じプロジェクトが正常に実行されています(jdk 1.7.0.4を使用)が、Windowsではそうではありません... Java 1.5(Windows)では機能しています..しかし、Java 1.7. 0.4 (windows) 動かない…

編集:

私のエラーは次のとおりです。

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.remoting.rmi.RmiServiceExporter#0' defined in class path resource [spring/services.xml]: Invocation of init method failed; nested exception is java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: 
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: 
java.lang.ClassNotFoundException: org.springframework.remoting.rmi.RmiInvocationHandler (no security manager: RMI class loader disabled)

この行を追加した後:

if (System.getSecurityManager() == null)
{ 
    RMISecurityManager manager = new RMISecurityManager();
    System.setSecurityManager(manager); 
}

このエラーがあります:

Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [spring/application-context.xml]; nested exception is java.io.FileNotFoundException: class path resource [spring/application-context.xml] cannot be opened because it does not exist

前もって感謝します

4

4 に答える 4

2

ここでのポイントは、セキュリティ マネージャをインストールすることではなく、クラスを見つけることです。デプロイメントから一部の JAR ファイルが欠落しています。

于 2012-05-23T21:46:28.277 に答える
0

コードの一部にこれを含める必要があります。

System.setSecurityManager(new RMISecurityManager());

別のセキュリティ マネージャを使用することもできますが、セキュリティ マネージャがインストールされている必要があります。

実際、私が投稿した行は、スタンドアロン デスクトップ アプリケーションのメイン クラスで簡単に起動できますが、あなたの場合はわかりません。おそらくこれを行う構成オプションを探す必要があります。

于 2012-05-23T18:22:04.303 に答える