0

I do receive below error:

2019-01-02 16:14:22.789  INFO 3131 --- [           main] com.dbs.rmg.cli.App                      : Started App in 4.619 seconds (JVM running for 5.227)
2019-01-02 16:14:22.907  INFO 3131 --- [)-10.91.xxx.xxx] o.h.h.i.QueryTranslatorFactoryInitiator  : HHH000397: Using ASTQueryTranslatorFactory
2019-01-02 16:14:23.158  INFO 3131 --- [)-10.91.xxx.xxx] c.h.rmiio.exporter.RemoteStreamExporter  : Using stream exporter com.healthmarketscience.rmiio.exporter.DefaultRemoteStreamExporter
2019-01-02 16:14:33.177  WARN 3131 --- [           main] c.h.rmiio.RemoteInputStreamClient        : Retry for caller com.healthmarketscience.rmiio.RemoteInputStreamWrapper$1@2100d047 giving up!
java.rmi.ConnectException: Connection refused to host: 10.91.xxx.xxx; nested exception is:
        java.net.ConnectException: Connection refused (Connection refused)
        at java.rmi/sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
        at java.rmi/sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:209)
        at java.rmi/sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:196)
        at java.rmi/sun.rmi.server.UnicastRef.invoke(UnicastRef.java:129)
        at java.rmi/java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:209)
        at java.rmi/java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:161)
        at com.sun.proxy.$Proxy82.usingGZIPCompression(Unknown Source)
        at com.healthmarketscience.rmiio.RemoteInputStreamWrapper$1.call(RemoteInputStreamWrapper.java:56)
        at com.healthmarketscience.rmiio.RemoteInputStreamWrapper$1.call(RemoteInputStreamWrapper.java:53)
        at com.healthmarketscience.rmiio.RemoteRetry.callImpl(RemoteRetry.java:153)
        at com.healthmarketscience.rmiio.RemoteRetry.call(RemoteRetry.java:273)
        at com.healthmarketscience.rmiio.RemoteRetry.call(RemoteRetry.java:214)
        at com.healthmarketscience.rmiio.RemoteInputStreamWrapper.usingGZIPCompression(RemoteInputStreamWrapper.java:52)
        at com.healthmarketscience.rmiio.RemoteInputStreamWrapper.usingGZIPCompression(RemoteInputStreamWrapper.java:46)
        at com.healthmarketscience.rmiio.RemoteInputStreamClient.wrap(RemoteInputStreamClient.java:80)
        at com.healthmarketscience.rmiio.RemoteIteratorClient.initialize(RemoteIteratorClient.java:95)
        at com.healthmarketscience.rmiio.RemoteIteratorClient.hasNext(RemoteIteratorClient.java:149)
        at com.dbs.rmg.utils.Pipe$6.hasNext(Pipe.java:178)
        at com.dbs.rmg.cli.App.run(App.java:92)

I able to store my code via the command execute, but it was stuck on below,

public static <T extends Remote> T getService(Class<T> cls, String IP, int PORT) {
        String url = RmiConfig.buildRmiUrl(PORT, cls.getSimpleName());

        try {
            JobService jobService = new JobServiceImpl();

            System.setProperty("java.rmi.server.hostname", IP);
            LocateRegistry.createRegistry(PORT);
            String location = "//localhost:" + PORT + "/JobService";
            Naming.rebind(location, jobService);

            return cls.cast(Naming.lookup(url));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

I assume the binding was successful as it can return, but the end it stuck on textIterator.hasNext() which I have no idea what exactly error I have done.

@Override
    public void run(String... args) throws Exception {
        JobService jobService = Controller.getJobService(this.IP, this.PORT);

        try {
            Iterator<String> textIterator = Pipe.iterator(jobService.submitAndStreamError(fileType, param, queueName, maxRetry));

            String defaultRetry = "0";

            while (textIterator.hasNext()) {
                defaultRetry = textIterator.next();

                System.out.println(defaultRetry);
            }

            System.exit(Integer.parseInt(defaultRetry));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

Anyone can give some hint as I lost idea to debug on this.

Sergio
  • 27,326
  • 8
  • 128
  • 149
Kim
  • 980
  • 1
  • 15
  • 29
  • 1
    Connection refused = firewall or bad port. – Antoniossss Jan 02 '19 at 08:28
  • i don't think is bad port as after your comment i do retry change the port but same error appear.. – Kim Jan 02 '19 at 08:43
  • *i do retry change the port* and changing bad port to another bad port would prove nothing. So again - bad port, firewall or bad NAT forwarding. – Antoniossss Jan 02 '19 at 08:43
  • First you should check if RMI port is open and accessible (but I think it is here), second, you must check the port that remote object is exported on - yes it is not the same port as RMI registry. Registry just holds such information. Last but not least, if you are trying to reach remote object from outside of your private network (since 10.* points to private network) you wiull have to set propert proprty on RMI registry to use external IP address instead of internal one (which it seams you are doing, but maybe you are using wrong ip here). No information on that whatsoever. – Antoniossss Jan 02 '19 at 08:48
  • yea, i found my bug, it's becoz i wrong set the client become service that's why it cant find out the server and throw connection refuse after giving up!... how can we raise to close this post as no value added on this question.. it's happen on human mistake... lol – Kim Jan 03 '19 at 10:18

0 Answers0