java.rmi.server.ExportException: remote object implements illegal remote interface; nested exception

今天在进行RMI测试的时候出现了这样的异常:

H:\dev\Java\jdk1.8.0_65\bin\java "-javaagent:H:\idea\IntelliJ IDEA 2017.1.5\lib\idea_rt.jar=6444:H:\idea\IntelliJ IDEA 2017.1.5\bin" -Dfile.encoding=UTF-8 -classpath H:\dev\Java\jdk1.8.0_65\jre\lib\charsets.jar;H:\dev\Java\jdk1.8.0_65\jre\lib\deploy.jar;H:\dev\Java\jdk1.8.0_65\jre\lib\ext\access-bridge-64.jar;H:\dev\Java\jdk1.8.0_65\jre\lib\ext\cldrdata.jar;H:\dev\Java\jdk1.8.0_65\jre\lib\ext\dnsns.jar;H:\dev\Java\jdk1.8.0_65\jre\lib\ext\jaccess.jar;H:\dev\Java\jdk1.8.0_65\jre\lib\ext\jfxrt.jar;H:\dev\Java\jdk1.8.0_65\jre\lib\ext\localedata.jar;H:\dev\Java\jdk1.8.0_65\jre\lib\ext\nashorn.jar;H:\dev\Java\jdk1.8.0_65\jre\lib\ext\sunec.jar;H:\dev\Java\jdk1.8.0_65\jre\lib\ext\sunjce_provider.jar;H:\dev\Java\jdk1.8.0_65\jre\lib\ext\sunmscapi.jar;H:\dev\Java\jdk1.8.0_65\jre\lib\ext\sunpkcs11.jar;H:\dev\Java\jdk1.8.0_65\jre\lib\ext\zipfs.jar;H:\dev\Java\jdk1.8.0_65\jre\lib\javaws.jar;H:\dev\Java\jdk1.8.0_65\jre\lib\jce.jar;H:\dev\Java\jdk1.8.0_65\jre\lib\jfr.jar;H:\dev\Java\jdk1.8.0_65\jre\lib\jfxswt.jar;H:\dev\Java\jdk1.8.0_65\jre\lib\jsse.jar;H:\dev\Java\jdk1.8.0_65\jre\lib\management-agent.jar;H:\dev\Java\jdk1.8.0_65\jre\lib\plugin.jar;H:\dev\Java\jdk1.8.0_65\jre\lib\resources.jar;H:\dev\Java\jdk1.8.0_65\jre\lib\rt.jar;C:\Users\Dongguabai\Desktop\demoServer\target\classes;H:\maven\repository\org\springframework\boot\spring-boot-starter-web\2.1.0.RELEASE\spring-boot-starter-web-2.1.0.RELEASE.jar;H:\maven\repository\org\springframework\boot\spring-boot-starter\2.1.0.RELEASE\spring-boot-starter-2.1.0.RELEASE.jar;H:\maven\repository\org\springframework\boot\spring-boot\2.1.0.RELEASE\spring-boot-2.1.0.RELEASE.jar;H:\maven\repository\org\springframework\boot\spring-boot-autoconfigure\2.1.0.RELEASE\spring-boot-autoconfigure-2.1.0.RELEASE.jar;H:\maven\repository\org\springframework\boot\spring-boot-starter-logging\2.1.0.RELEASE\spring-boot-starter-logging-2.1.0.RELEASE.jar;H:\maven\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;H:\maven\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;H:\maven\repository\org\apache\logging\log4j\log4j-to-slf4j\2.11.1\log4j-to-slf4j-2.11.1.jar;H:\maven\repository\org\apache\logging\log4j\log4j-api\2.11.1\log4j-api-2.11.1.jar;H:\maven\repository\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;H:\maven\repository\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar;H:\maven\repository\org\yaml\snakeyaml\1.23\snakeyaml-1.23.jar;H:\maven\repository\org\springframework\boot\spring-boot-starter-json\2.1.0.RELEASE\spring-boot-starter-json-2.1.0.RELEASE.jar;H:\maven\repository\com\fasterxml\jackson\core\jackson-databind\2.9.7\jackson-databind-2.9.7.jar;H:\maven\repository\com\fasterxml\jackson\core\jackson-annotations\2.9.0\jackson-annotations-2.9.0.jar;H:\maven\repository\com\fasterxml\jackson\core\jackson-core\2.9.7\jackson-core-2.9.7.jar;H:\maven\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.9.7\jackson-datatype-jdk8-2.9.7.jar;H:\maven\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.9.7\jackson-datatype-jsr310-2.9.7.jar;H:\maven\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.9.7\jackson-module-parameter-names-2.9.7.jar;H:\maven\repository\org\springframework\boot\spring-boot-starter-tomcat\2.1.0.RELEASE\spring-boot-starter-tomcat-2.1.0.RELEASE.jar;H:\maven\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.12\tomcat-embed-core-9.0.12.jar;H:\maven\repository\org\apache\tomcat\embed\tomcat-embed-el\9.0.12\tomcat-embed-el-9.0.12.jar;H:\maven\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.12\tomcat-embed-websocket-9.0.12.jar;H:\maven\repository\org\hibernate\validator\hibernate-validator\6.0.13.Final\hibernate-validator-6.0.13.Final.jar;H:\maven\repository\javax\validation\validation-api\2.0.1.Final\validation-api-2.0.1.Final.jar;H:\maven\repository\org\jboss\logging\jboss-logging\3.3.2.Final\jboss-logging-3.3.2.Final.jar;H:\maven\repository\com\fasterxml\classmate\1.4.0\classmate-1.4.0.jar;H:\maven\repository\org\springframework\spring-web\5.1.2.RELEASE\spring-web-5.1.2.RELEASE.jar;H:\maven\repository\org\springframework\spring-beans\5.1.2.RELEASE\spring-beans-5.1.2.RELEASE.jar;H:\maven\repository\org\springframework\spring-webmvc\5.1.2.RELEASE\spring-webmvc-5.1.2.RELEASE.jar;H:\maven\repository\org\springframework\spring-aop\5.1.2.RELEASE\spring-aop-5.1.2.RELEASE.jar;H:\maven\repository\org\springframework\spring-context\5.1.2.RELEASE\spring-context-5.1.2.RELEASE.jar;H:\maven\repository\org\springframework\spring-expression\5.1.2.RELEASE\spring-expression-5.1.2.RELEASE.jar;H:\maven\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;H:\maven\repository\org\springframework\spring-core\5.1.2.RELEASE\spring-core-5.1.2.RELEASE.jar;H:\maven\repository\org\springframework\spring-jcl\5.1.2.RELEASE\spring-jcl-5.1.2.RELEASE.jar com.example.demoServer.Server
java.rmi.server.ExportException: remote object implements illegal remote interface; nested exception is: 
	java.lang.IllegalArgumentException: illegal remote method encountered: public abstract java.lang.String com.example.demoServer.IHelloService.sayHello(java.lang.String)
	at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:199)
	at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:383)
	at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:320)
	at java.rmi.server.UnicastRemoteObject.(UnicastRemoteObject.java:198)
	at java.rmi.server.UnicastRemoteObject.(UnicastRemoteObject.java:180)
	at com.example.demoServer.HelloServiceImpl.(HelloServiceImpl.java:13)
	at com.example.demoServer.Server.main(Server.java:17)
Caused by: java.lang.IllegalArgumentException: illegal remote method encountered: public abstract java.lang.String com.example.demoServer.IHelloService.sayHello(java.lang.String)
	at sun.rmi.server.Util.checkMethod(Util.java:267)
	at sun.rmi.server.Util.getRemoteInterfaces(Util.java:246)
	at sun.rmi.server.Util.getRemoteInterfaces(Util.java:216)
	at sun.rmi.server.Util.createProxy(Util.java:146)
	at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:197)
	... 6 more

Process finished with exit code 0

这个是说实现接口的方法需要抛出RemoteException,即:
java.rmi.server.ExportException: remote object implements illegal remote interface; nested exception_第1张图片

java.rmi.server.ExportException: remote object implements illegal remote interface; nested exception_第2张图片

 

你可能感兴趣的:(exception)