Eclipse 的 J2EE Preview Server 連接埠設定

來源:互聯網
上載者:User

標籤:eclipse servers

最近想在Eclipse測試一下HTML5,在搭建服務的時候糾結了一下。


系統內容是Mac,使用的的Eclipse是 eclipse-jee-luna-SR1-macosx-cocoa-x86_64.tar.gz 這個版本,WTP組件是整合的,那麼問題就來了,由於只是測試HTML,不想搭Tomcat(網上搜尋Eclipse HTTP Server 清一色tomcat教程,呃),我想建立的Server是 Basic-J2EE Preview,(其他兩項HTTP Preview、HTTP Server都有點問題,前者報JRE的錯,後者請求的時候報錯,這個問題看樣子是已經被當做一個Bug提交且沒解決https://bugs.eclipse.org/bugs/show_bug.cgi?id=293398,只有選擇J2EE這個,內建的用起來方便)。


只有J2EE Preview稍微正常一點,能控制啟動,瀏覽器正常訪問,但是啟動時預設連接埠是8080,而且整個UI裡面都找不到哪裡能改這個連接埠,需要改的話只能走下面的方法了:


進入當前專案檔夾的隱藏目錄

workspace/.metadata/.plugins/org.eclipse.wst.server.core

開啟 servers.xml,預設內容如下:

<?xml version="1.0" encoding="UTF-8" standalone="no"?><servers>  <server hostname="localhost" id="J2EE Preview at localhost" name="J2EE Preview at localhost" runtime-id="J2EE Preview" server-type="org.eclipse.jst.server.preview.server" server-type-id="org.eclipse.jst.server.preview.server" start-timeout="240" stop-timeout="240" timestamp="1">    <list key="modules" value0="HTML::org.eclipse.wst.web.internal.deployables.static:HTML::wst.web::1.0"/>  </server></servers>

這就是J2EE Preview的設定檔,那麼就手動加一個 port 屬性,修改後如下:

<?xml version="1.0" encoding="UTF-8" standalone="no"?><servers>  <server hostname="localhost" port="9090" id="J2EE Preview at localhost" name="J2EE Preview at localhost" runtime-id="J2EE Preview" server-type="org.eclipse.jst.server.preview.server" server-type-id="org.eclipse.jst.server.preview.server" start-timeout="240" stop-timeout="240" timestamp="1">    <list key="modules" value0="HTML::org.eclipse.wst.web.internal.deployables.static:HTML::wst.web::1.0"/>  </server></servers>

然後重啟一下eclipse,就能成功訪問 http://localhost:9090了。


本文出自 “堅持治療” 部落格,請務必保留此出處http://liongmagezi.blog.51cto.com/2848085/1576808

Eclipse 的 J2EE Preview Server 連接埠設定

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.