Ursache: java.net.NoRouteToHostException: Keine Route zum Host

Ich versuche, mein Jersey-Projekt von Eclipse auf OpenShift bereitzustellen, und dieser Fehler wird in den Tail-Dateien angezeigt.Caused by: java.net.NoRouteToHostException: No route to host

vor als ich das hatte:

String host = "jdbc:mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/bustrackerserver"

Ich habe diesen Fehler erhalten:

'java.lang.NumberFormatException: Für Eingabezeichenfolge: "OPENSHIFT_MYSQL_DB_PORT"'

Ich habe diese IP-Adresse gepingt127.10.230.440 und ich bekomme eine Antwort Ich habe überprüft, ob einige der Ports 8080, 3306 von meiner lokalen Maschine verwendet werden, aber sie werden nur von Eclipse verwendet.

Apple class.

package org.busTracker.serverSide;


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Map;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

/**
 * Root resource (exposed at "myresource" path)
 */
@Path("myresource")
public class Apple {

    //String host = " jdbc:mysql://${env.OPENSHIFT_MYSQL_DB_HOST}:${env.OPENSHIFT_MYSQL_DB_PORT}/serv‌​erside";
    //String host = "jdbc:mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/bustrackerserver";
    String host = "jdbc:mysql://127.10.230.440:3306/bustrackerserver";
    String user = "adminNMccsBr";
    String password = "K3SV5rbxh8qP";


    /**
     * Method handling HTTP GET requests. The returned object will be sent
     * to the client as "text/plain" media type.
     *
     * @return String that will be returned as a text/plain response.
     */
    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String getIt() {

        Connection conn = null;  
        try {    
          Class.forName("com.mysql.jdbc.Driver");    
          System.out.println("Connecting to database…");    
          conn = DriverManager.getConnection(host,user,password);    

          Map<String, String> env = System.getenv();
          for (String envName : env.keySet()) {
              System.out.format("%s=%s%n",
                                envName,
                                env.get(envName));
          }



        } catch (Exception e) {    
          e.printStackTrace();    
        } finally {    
          if (conn != null) {    
            try {    
              conn.close();    
            } catch (SQLException e) {    
              // ignore    
            }    
          }    
        }   

        return "Hello, from apple class  14.05.15 13:30!";
    }
}

Antworten auf die Frage(2)

Ihre Antwort auf die Frage