请教一个RMIUsing Activation: Persistence抛出异常的问题!!

08-08-25 greentree
请教一个RMI调用异常的问题,我在运行JDK教程中RMI的例子/jdk-6-doc/docs/technotes/guides/rmi/activation/persistence.html#3

,Using Activation: Persistence一节目中抛出不能激活的异常,

步骤如下

1:编译类

2: start rmid -J-Djava.security.policy=rmid.policy -J-Dexamples.activation.policy=group.policy

3: start rmiregistry

4:运行Setup程序:

E:\demo\rmi\activation\persistence>java -cp .;E:\demo\rmi\activation\persistence

\s -Djava.security.policy=setup.policy -Djava.rmi.server.codebase=file:./s/

-Dexamples.activation.setup.codebase=file:. -Dexamples.activation.impl.codebas

e=file:./s/ -Dexamples.activation.name=counter -Dexamples.activation.policy=g

roup.policy -Dexamples.activation.file=state Setup CounterImpl

Activation group descriptor registered.

Activation descriptor registered.

Stub bound in registry.

运行成功××××××××××××××××××××××××××××××××××

5: 运行客户端,然后就报错,找了老长时间没找出原因,不知道出问题在那里,请高手指教!

E:\demo\rmi\activation\persistence>java -cp .;E:\demo\rmi\activation\persistenc

e\c -Djava.security.policy=client.policy -Dexamples.activation.client.codebas

e=file:./c/ -Dexamples.activation.name=counter CounterClient localhost

Obtained stub from the registry.

Invoking increment method...

Exception in thread "main" java.rmi.activation.ActivateFailedException: activati

on failed; nested exception is:

java.rmi.activation.ActivationException: exception in object constructor

; nested exception is:

java.io.EOFException

at sun.rmi.server.ActivatableRef.activate(Unknown Source)

at sun.rmi.server.ActivatableRef.invoke(Unknown Source)

at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(Unkn

own Source)

at java.rmi.server.RemoteObjectInvocationHandler.invoke(Unknown Source)

at $Proxy0.increment(Unknown Source)

at CounterClient.main(CounterClient.java:47)

Caused by: java.rmi.activation.ActivationException: exception in object construc

tor; nested exception is:

java.io.EOFException

at sun.rmi.server.ActivationGroupImpl.newInstance(ActivationGroupImpl.ja

va:297)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.

java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces

sorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)

at sun.rmi.transport.Transport$1.run(Transport.java:159)

at java.security.AccessController.doPrivileged(Native Method)

at sun.rmi.transport.Transport.serviceCall(Transport.java:155)

at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:5

35)

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTranspor

t.java:790)

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport

.java:649)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec

utor.java:886)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor

.java:908)

at java.lang.Thread.run(Thread.java:619)

at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Stream

RemoteCall.java:255)

at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:

233)

greentree
2008-08-25 14:28
我按照jdk上面的运行步骤试了很多便,但是还是抛出同样的错误。

banq
2008-08-27 16:47
>in object constructor

可能你代码的构造器有问题,如带参数的,或构造内部出错。

猜你喜欢