Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8202825

Using RMI Registry to bind a Remote object and then get "java.rmi.ServerError"

    XMLWordPrintable

    Details

    • Subcomponent:
    • Introduced In Version:
      9
    • CPU:
      x86_64
    • OS:
      windows_10

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10 64bit, JDK 10.0.1

      A DESCRIPTION OF THE PROBLEM :
      I use RMI Registry to bind a Remote Object, but failed.

      That remote object include a method which has a Java.sql.Timestamp parameter :
      String sayHello(java.sql.Timestamp aTime) throws RemoteException;

      If use java.util.Date, it would work fine!!!!!!!!

      The stacktrace:

      java version "10.0.1" 2018-04-17
      Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
      Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)
      Server exception: java.rmi.ServerError: Error occurred in server thread; nested exception is:
              java.lang.NoClassDefFoundError: java/sql/Connection
      java.rmi.ServerError: Error occurred in server thread; nested exception is:
              java.lang.NoClassDefFoundError: java/sql/Connection
              at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:388)
              at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
              at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
              at java.base/java.security.AccessController.doPrivileged(Native Method)
              at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
              at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
              at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
              at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
              at java.base/java.security.AccessController.doPrivileged(Native Method)
              at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
              at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
              at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
              at java.base/java.lang.Thread.run(Thread.java:844)
              at java.rmi/sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:283)
              at java.rmi/sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:260)
              at java.rmi/sun.rmi.server.UnicastRef.invoke(UnicastRef.java:375)
              at java.rmi/sun.rmi.registry.RegistryImpl_Stub.bind(RegistryImpl_Stub.java:68)
              at excelhk.objbus.testRMISrv.main(testRMISrv.java:27)
      Caused by: java.lang.NoClassDefFoundError: java/sql/Connection
              at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
              at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3119)
              at java.base/java.lang.Class.privateGetPublicMethods(Class.java:3144)
              at java.base/java.lang.Class.getMethods(Class.java:1863)
              at java.base/java.lang.reflect.Proxy$ProxyBuilder.lambda$referencedTypes$3(Proxy.java:712)
              at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:271)
              at java.base/java.util.Collections$2.tryAdvance(Collections.java:4727)
              at java.base/java.util.Collections$2.forEachRemaining(Collections.java:4735)
              at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
              at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
              at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
              at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
              at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
              at java.base/java.lang.reflect.Proxy$ProxyBuilder.referencedTypes(Proxy.java:717)
              at java.base/java.lang.reflect.Proxy$ProxyBuilder.<init>(Proxy.java:625)
              at java.base/java.lang.reflect.Proxy$ProxyBuilder.<init>(Proxy.java:636)
              at java.base/java.lang.reflect.Proxy.lambda$getProxyConstructor$0(Proxy.java:415)
              at java.base/jdk.internal.loader.AbstractClassLoaderValue$Memoizer.get(AbstractClassLoaderValue.java:
              at java.base/jdk.internal.loader.AbstractClassLoaderValue.computeIfAbsent(AbstractClassLoaderValue.ja
              at java.base/java.lang.reflect.Proxy.getProxyConstructor(Proxy.java:413)
              at java.base/java.lang.reflect.Proxy.getProxyClass(Proxy.java:384)
              at java.rmi/sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:699)
              at java.rmi/sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:688)
              at java.rmi/sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:611)
              at java.rmi/java.rmi.server.RMIClassLoader$2.loadProxyClass(RMIClassLoader.java:646)
              at java.rmi/java.rmi.server.RMIClassLoader.loadProxyClass(RMIClassLoader.java:311)
              at java.rmi/sun.rmi.server.MarshalInputStream.resolveProxyClass(MarshalInputStream.java:254)
              at java.base/java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1809)
              at java.base/java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1760)
              at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2051)
              at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1585)
              at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)
              at java.rmi/sun.rmi.registry.RegistryImpl_Skel.dispatch(RegistryImpl_Skel.java:76)
              at java.rmi/sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:467)
              at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:297)
              at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
              at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
              at java.base/java.security.AccessController.doPrivileged(Native Method)
              at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
              at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
              at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
              at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
              at java.base/java.security.AccessController.doPrivileged(Native Method)
              at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
              at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
              at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
              at java.base/java.lang.Thread.run(Thread.java:844)
      Caused by: java.lang.ClassNotFoundException: java.sql.Connection
              at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)
              at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:566)
              at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
              ... 47 more


       

      REGRESSION : Last worked in version 10.0.1

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Interface:
      public interface testRMI extends Remote {
      String sayHello(java.sql.Timestamp aTime) throws RemoteException;
      }

      RMI Server

      public class testRMISrv implements testRMI {
      public testRMISrv() {}

      public String sayHello(java.sql.Timestamp aTime) throws RemoteException {
              return "Hello, world!" + aTime.toString();
          }
              
          public static void main(String args[]) {
              
              try {
               testRMISrv obj = new testRMISrv();
                  testRMI stub = (testRMI) UnicastRemoteObject.exportObject(obj, 0);

                  Registry registry = LocateRegistry.getRegistry();
                  registry.bind("Hello", stub);

                  System.err.println("Server ready");
              } catch (Exception e) {
                  System.err.println("Server exception: " + e.toString());
                  e.printStackTrace();
              }
          }
          

      }

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Bind successfully
      ACTUAL -
      Failed, and said java.sql.Timestamp can't be found. Actually, I use java.util.Date to replace that parameter, it worked find!!!!!

      FREQUENCY : always


        Attachments

          Activity

            People

            • Assignee:
              smarks Stuart Marks
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: