CLIからデプロイしてみる
TweetPosted on Tuesday Jan 21, 2014 at 04:18PM in Technology
環境
- WildFly8.0.0CR1
- Eclipse Kelper SR1
デプロイするWARファイルの準備
WARファイルを作る
対象のプロジェクトを選んで右クリック→Export→WAR file
Web projectとDestnationを埋めてFinish
中身を見てみる
kyle-no-MacBook:~ kyle$ jar tvf ~/JavaEE7Prac.war Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 105 Mon Jan 20 13:28:12 JST 2014 META-INF/MANIFEST.MF 0 Sat Jan 18 21:56:20 JST 2014 META-INF/ 0 Thu Jan 16 15:04:08 JST 2014 META-INF/maven/ 0 Thu Jan 16 15:04:08 JST 2014 META-INF/maven/com.example/ 0 Thu Jan 16 15:04:08 JST 2014 META-INF/maven/com.example/JavaEE7Prac/ 232 Mon Jan 20 18:07:00 JST 2014 META-INF/maven/com.example/JavaEE7Prac/pom.properties 897 Mon Jan 20 18:07:00 JST 2014 META-INF/maven/com.example/JavaEE7Prac/pom.xml 0 Sat Jan 18 21:53:56 JST 2014 WEB-INF/ 0 Sat Jan 18 21:56:12 JST 2014 WEB-INF/classes/ 0 Sat Jan 18 21:56:20 JST 2014 WEB-INF/classes/META-INF/ 0 Sat Jan 18 21:47:46 JST 2014 WEB-INF/classes/META-INF/batch-jobs/ 183 Sat Jan 18 21:50:40 JST 2014 WEB-INF/classes/META-INF/batch-jobs/job001.xml 0 Thu Jan 16 15:09:30 JST 2014 WEB-INF/classes/com/ 0 Mon Jan 20 17:00:08 JST 2014 WEB-INF/classes/com/example/ 678 Mon Jan 20 13:28:16 JST 2014 WEB-INF/classes/com/example/TestBatchlet.class 1413 Mon Jan 20 13:28:16 JST 2014 WEB-INF/classes/com/example/TestServlet.class 252 Sat Jan 18 21:53:56 JST 2014 WEB-INF/beans.xml 0 Thu Jan 16 15:51:56 JST 2014 WEB-INF/lib/ 385091 Mon Jan 20 13:28:12 JST 2014 WEB-INF/lib/commons-lang3-3.2.1.jar 540 Mon Jan 20 16:58:00 JST 2014 WEB-INF/web.xml kyle-no-MacBook:~ kyle$
大丈夫そうですね。jarファイルとかもちゃんと入ってる。
デプロイしてみる
CLIからデプロイ
$ sudo -i -u wildfly /usr/local/wildfly/bin/jboss-cli.sh [disconnected /] connect [standalone@localhost:9990 /] deploy /tmp/JavaEE7Prac.war [standalone@localhost:9990 /]
アクセスしてみる
大丈夫そうですね
デプロイされたアプリ一覧を表示
[standalone@localhost:9990 /] ls deployment JavaEE7Prac.war postgresql-9.3-1100.jdbc41.jar [standalone@localhost:9990 /]
CLIからアンデプロイ
[standalone@localhost:9990 /] undeploy JavaEE7Prac.war [standalone@localhost:9990 /]
[standalone@localhost:9990 /] ls deployment postgresql-9.3-1100.jdbc41.jar [standalone@localhost:9990 /]
消えましたね。アクセスしても消えています
$JBOSS_HOME/standalone/log/server.logを見てみる
2014-01-21 15:45:59,294 INFO [org.jboss.as.repository] (management-handler-thread - 8) JBAS014900: Content added at location /usr/local/wildfly/standalone/data/content/81/8f5b7155a35cc08acfd55f279cd7bab40e5972/content 2014-01-21 15:45:59,305 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "JavaEE7Prac.war" (runtime-name: "JavaEE7Prac.war") 2014-01-21 15:46:00,445 INFO [org.jboss.weld.deployer] (MSC service thread 1-3) JBAS016002: Processing weld deployment JavaEE7Prac.war 2014-01-21 15:46:01,027 INFO [org.hibernate.validator.internal.util.Version] (MSC service thread 1-3) HV000001: Hibernate Validator 5.0.2.Final 2014-01-21 15:46:01,941 INFO [org.jboss.weld.deployer] (MSC service thread 1-1) JBAS016005: Starting Services for CDI deployment: JavaEE7Prac.war 2014-01-21 15:46:02,535 INFO [org.jboss.weld.Version] (MSC service thread 1-1) WELD-000900: 2.1.1 (Final) 2014-01-21 15:46:02,593 INFO [org.jboss.weld.deployer] (MSC service thread 1-1) JBAS016008: Starting weld service for deployment JavaEE7Prac.war 2014-01-21 15:46:05,880 INFO [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-4) Initializing Mojarra 2.2.4-jbossorg-1 20131017-1524 for context '/JavaEE7Prac' 2014-01-21 15:46:07,412 INFO [org.wildfly.extension.undertow] (MSC service thread 1-4) JBAS017534: Register web context: /JavaEE7Prac 2014-01-21 15:46:07,590 INFO [org.jboss.as.server] (management-handler-thread - 8) JBAS018559: Deployed "JavaEE7Prac.war" (runtime-name : "JavaEE7Prac.war") 2014-01-21 15:46:38,643 INFO [stdout] (batch-batch - 1) Hello JSR352 2014-01-21 15:47:14,605 INFO [stdout] (batch-batch - 3) Hello JSR352 2014-01-21 15:47:27,235 INFO [stdout] (batch-batch - 5) Hello JSR352 2014-01-21 15:47:27,389 INFO [stdout] (batch-batch - 7) Hello JSR352 2014-01-21 15:51:30,933 INFO [org.wildfly.extension.undertow] (MSC service thread 1-4) JBAS017535: Unregister web context: /JavaEE7Prac 2014-01-21 15:51:30,956 INFO [org.jboss.weld.deployer] (MSC service thread 1-3) JBAS016009: Stopping weld service for deployment JavaEE7Prac.war 2014-01-21 15:51:30,992 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015877: Stopped deployment JavaEE7Prac.war (runtime-name: JavaEE7Prac.war) in 65ms 2014-01-21 15:51:31,088 INFO [org.jboss.as.repository] (management-handler-thread - 15) JBAS014901: Content removed from location /usr/local/wildfly/standalone/data/content/81/8f5b7155a35cc08acfd55f279cd7bab40e5972/content 2014-01-21 15:51:31,089 INFO [org.jboss.as.server] (management-handler-thread - 15) JBAS018558: Undeployed "JavaEE7Prac.war" (runtime-name: "JavaEE7Prac.war")
特に問題なさげですね。
上書きデプロイをワンライナーで
sudo -i -u wildfly /usr/local/wildfly/bin/jboss-cli.sh --connect "deploy /tmp/JavaEE7Prac.war --force JavaEE7Prac.war"
参考文献
Tags: wildfly