0

I am getting following exception while I am trying to get list of tasks, from services that I have written which are supporting hibernate 4, into web application which supports hibernate 3

java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.lang.ClassNotFoundException: org.hibernate.collection.internal.PersistentBag (no security manager: RMI class loader disabled)

             Services       ------------------>      WEB 
             (Hibernate 4)                           (Hibernate 3)

Web trying to get data from services through RMI and getting above excpetion

4

1 回答 1

0

显然,您的客户看不到您服务中的课程。实现此目的的方法之一是拥有一个共享的 rmi 代码库。考虑以下脚本,将 lib 文件夹中的所有 jar 和 dist 文件夹中的主 jar 添加到 rmi 代码库,并使它们对客户端可见:

#!/bin/bash
lib_path=lib
artefact=name-of-your.jar
for file in $(ls $lib_path); do
 lib=$lib:$lib_path/$file
 rmicodebase="$rmicodebase file:$PWD/$lib_path/$file"
done

lib=$lib:dist/$artefact:etc
rmicodebase="$rmicodebase file:$PWD/dist/$artefact"
CLASSPATH=classes:etc:$lib
echo CLASSPATH: $CLASSPATH
echo rmicodebase=$rmicodebase

java -Xmx64M -Xms64M -classpath $CLASSPATH -Djava.rmi.server.codebase="$rmicodebase" $*

我假设您在服务器的中央进程中有一个共享的 rmi 注册表。实现类可见性的另一种可能性是在服务器进程中运行一个单独的 rmi 注册表:

java.rmi.registry.LocateRegistry.createRegistry(port)

并让您的客户端连接到此注册表。

问候莱昂

于 2013-04-08T06:38:37.857 回答