Glassfish的安裝配置

 
以winidows爲例
1、下載:http://java.net/download/javaee5 ... staller-9.0-b48.jar
2、將glassfish-installer-9.0-b48.jar放到D:/Program Files文件夾,進入該文件夾,在命令行輸入:
java -Xmx256m -jar glassfish-installer-9.0-b48.jar
在彈出面板選接收後開始解壓,生成glassfish文件夾,進入該文件夾,確保ant 安裝正確的情況下輸入;
ant -f setup.xml
3、啓動服務器:(安裝好以後服務器已經啓動)
進入glassfish/bin下輸入:
asadmin start-domain domain1
4、驗證:在瀏覽器中輸入
http://127.0.0.1:8080/
看到“Your server is up and running!”表示成功!
5、配置項
domain.name=domain1
instance.name=server
admin.user=admin
admin.password=adminadmin
admin.port=4848
instance.port=8080
orb.port=3700
imq.port=7676
https.port=8181
master.password=changeit (only in setup-cluster.xml)

啓動GlassFish服務器

你通過啓動域來啓動服務器。域爲屬於它的服務器個例提供安全鑑定和管理等服務。啓動域也就啓動了該域內的服務器個例。當你安裝GlassFish服務器時,就已經創建了一個名爲domain1的默認域。

步驟
進入目錄 install-dir/bin/


輸入此命令來啓動服務器: asadmin start-domain domain1

服務器啓動後,你會看到以下信息:
Starting Domain domain1, please wait.
Log redirected to /glassfish/domains/domain1/logs/server.log.
Domain domain1 is ready to receive client requests. Additional services are being started in background.
Domain [domain1] is running [Sun Java System Application Server Platform Edition 9.0 (build b43)] with its configuration and logs at: [/glassfish/domains].
Admin Console is available at [http://localhost:4848].
Use the same port [4848] for "asadmin" commands.
User web applications are available at these URLs:
[http://localhost:8080 https://localhost:8181 ].
Following web-contexts are available:
[/web1 /asadmin ].
Standard JMX Clients (like JConsole) can connect to JMXServiceURL:
[service:jmx:rmi:///jndi/rmi://myhost:8686/jmxrmi] for domain management purposes.
Domain listens on at least following ports for connections:
[8080 8181 4848 3700 3820 3920 8686 ].

確認服務器正常運行
步驟
確認服務器在你的機器上正常運行,點擊此URL: http://localhost:8080.

用localhost,如果瀏覽器和GlassFish服務器運行在同一臺機器上。如果GlassFish服務器在另一臺機器上, 則把該主機名放到以上的URL中。

默認端口是8080。如果你在安裝時改變了端口,則在瀏覽器地址欄中改用你的端口。


你應該能看見服務器的歡迎頁面。


通過自動部署來部署Hello應用
Java EE 5 教程裏有個預先封裝好的應用,它所做的事情就是說"Hello,"。你也可以從這裏下載http://glassfish.dev.java.net/downloads/quickstart/hello.war. 這個Hello應用被封裝在一個Web ARchive (WAR)文件裏。企業應用也可以被封裝成Java? ARchive (JAR) 或者 Enterprise ARchive (EAR) 文件的形式。


把封裝的應用拖放或者複製到域的autodeploy目錄,能讓你花最小的力氣把你的應用直接投入使用。

步驟
http://glassfish.dev.java.net/downloads/quickstart/hello.war 下載hello.war

把 hello.war 複製到 install-dir/domains/domain1/autodeploy/


--------------------------------------------------------------------------------

竅門 - 在Windows系統上,你可以在桌面上給autodeploy目錄建立一個捷徑,這樣你就可以把hello.war文件拖放到這個捷徑中。

--------------------------------------------------------------------------------

當部署應用結束後,服務器在autodeploy目錄下產生了一個名爲hello.war_deployed的文件。取決下你機器的速度,整個過程只需幾秒鐘。如果在這個文件產生以前訪問該應用的頁面,你會得到錯誤404-File Not Found。

通過這個URL來訪問應用的頁面: http://localhost:8080/hello.

你可以看見該應用的首頁,提示你輸入你的名字。


輸入你的名字,點擊提交按鈕。

該應用就顯示了個定製的迴應,給你一個自己的Hello。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章