Wildfly10 如果是網頁服務,得發佈war檔才能運作
登入到伺服器主機
利用SSH連入伺服器主機,並把你本機編譯好的war檔拷背過去伺服器
拷背方法可用ftp、winscp、scp、或sftp等任何方法,編好的WAR檔一般而言會在家目錄的專案目錄裡,以我的MAC為例:
[MAC]
/Users/使用者名/NetBeansProjects/專案名/target/專案檔-0.01.war
在wildfly伺服器中下達指令
[Centos7]
$ sudo sh /opt/wildfly/bin/jboss-cli.sh
[sudo] password for axer:
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
連到wildfly management
[disconnected /] connect 192.168.x.x
發布
加上--force就會蓋掉目前運作中的war檔
[domain@192.168.x.x:9990 /] deploy myproject-0.01.war --force
再用瀏覽器開啟你做的網頁即可
移除發布
xxx.war就是你已發布的WAR檔
undeploy xxx.war
查看已發布的WAR檔
ls deployment
其他說明
出現這樣的錯誤代表服務沒有連接上,指定正確的IP或埠再試看看
[disconnected /] connect
The controller is not available at localhost:9990: java.net.ConnectException: WFLYPRT0053: Could not connect to http-remoting://localhost:9990. The connection failed: WFLYPRT0053: Could not connect to http-remoting://localhost:9990. The connection failed: 連線被拒絕