当我无法访问CLI工具时,如何关闭JBoss Wildfly?

时间:2015-12-02 21:21:51

标签: jboss wildfly shutdown

我使用Wildfly 10.0.0.CR2和Java 8.我让Wildfly在端口8080上侦听http连接,并且过去使用此命令关闭服务器...

./jboss-cli.sh --connect command=:shutdown
有时,即使服务器仍在运行,我也无法访问此工具。请注意我的Mac上的以下交互...

Daves-MacBook-Pro-2:bin davea$ ./jboss-cli.sh --connect command=:shutdown
Failed to connect to the controller: The controller is not available at localhost:9990: java.net.ConnectException: WFLYPRT0023: Could not connect to http-remoting://localhost:9990. The connection timed out: WFLYPRT0023: Could not connect to http-remoting://localhost:9990. The connection timed out
Daves-MacBook-Pro-2:bin davea$ telnet localhost 8080
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

我的问题是,关闭JBoss服务器的简单方法是什么?注意我更喜欢不依赖于CLI工具的方法。

2 个答案:

答案 0 :(得分:21)

我怀疑它有时无法连接,因为我可以在telnet上看到localhost首先解析为ipv6。你尝试过了吗?

./bin/jboss-cli.sh --connect controller=127.0.0.1:9990 command=:shutdown

除此之外你总是可以杀死PID:

pgrep -d" " -f "wildfly" | xargs kill;

答案 1 :(得分:3)

停止Wildfly:

    import android.os.AsyncTask;
    import android.os.Bundle;
    import android.support.v7.app.AppCompatActivity;
    import android.view.View;
    import android.widget.Button;
    import android.widget.ImageButton;
    import android.widget.ProgressBar;
    import android.widget.Toast;

    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.Statement;

    public class MainActivity extends AppCompatActivity {

    db_connect db_connect;
    ImageButton mood;
    ImageButton statistic;
    double emotion;
    Button btnEmotion;
    ProgressBar pbbar;








    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        db_connect = new db_connect();
        btnEmotion = (Button) findViewById(R.id.button);
        pbbar = (ProgressBar) findViewById(R.id.progressBar);
        pbbar.setVisibility(View.GONE);

        btnEmotion.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                DoCheck doCheck = new DoCheck();
                doCheck.execute("");

            }
        });

        mood = (ImageButton) findViewById(R.id.imageButton);
        statistic = (ImageButton) findViewById(R.id.imageButton2);

    }


    public class DoCheck extends AsyncTask<String, String, String> {
        String z = "";
        Boolean isSuccess = false;

        @Override
        protected void onPreExecute() {
            pbbar.setVisibility(View.VISIBLE);
        }

        @Override
        protected void onPostExecute(String r) {
            pbbar.setVisibility(View.GONE);
            Toast.makeText(MainActivity.this, r, Toast.LENGTH_SHORT).show();

            if (isSuccess) {
                Toast.makeText(MainActivity.this, r, Toast.LENGTH_SHORT).show();
            }

        }

        // Connection With SQL Server

        @Override
        protected String doInBackground(String... params) {


            try {
                Connection con = db_connect.CONN();
                if (con == null) {
                    z = "Error:505 in connecting with the Database";

                } else {

                    //SQL Select Query
                    String query = "SELECT * FROM emotiontable WHERE emotions=' " +emotion;
                    Statement stmt = con.createStatement();
                    ResultSet rs = stmt.executeQuery(query);


                    //Emotion Calculation

                    if (emotion <= 0.98755) {

                        z = "The child is Happy";
                        isSuccess = true;

                    } else if (emotion <= 0.00300731952) {
                        z = "The Child is Anger";
                        isSuccess = true;


                    } else if (emotion <= 5.14648448) {
                        z = "The Child is Contempt";
                        isSuccess = true;
                    }
                    else if (emotion <= 9.180124) {
                        z = "The Child is Disgusted";
                        isSuccess = true;
                    }
                    else if (emotion <= 0.0001912825) {
                        z = "The Child is fear";
                        isSuccess = true;
                    }
                    else if (emotion <= 0.0009861537) {
                        z = "The Child is Nutral";
                        isSuccess = true;
                    }
                    else if (emotion <= 1.889955) {
                        z = "The Child is sad";
                        isSuccess = true;
                    }
                    else if (emotion <= 0.008229999) {
                        z = "The Child is Surprised";
                        isSuccess = true;
                    }

                }
            } catch (Exception ex) {
                isSuccess = false;
                z = "No Emotion Data Found";
            }

            return z;
        }
    }
}

      /*  public void emotionView(View view) {
            Intent i = new Intent(this, Emotion.class);
            startActivity(i);
        }

        public void stats(View view) {
            Intent i = new Intent(this, Statistics.class);
            startActivity(i);
        }

    }
    }*/