JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Application Server » Tomcat  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友   
reply to topicthreaded modego to previous topicgo to next topic
話題被移動
該話題已被移動 - morchory , 2004-05-10 20:26
如果您尚不清楚該話題被移動的原因,請參考論壇規則以及本版公告或者聯系本版版主。
本主題所含的標籤
無標籤
作者 關於讓Tomcat 5.0自動Reload Servlet [精華]
Hidra





發文: 41
積分: 0
於 2004-05-10 20:24 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
如題~ 我有看到很多文章要我自已在 Tomcat_home\Conf\Server.xml 加上:
<Context path="/mytest" docbase="mytest" ..... reloadable="true" ..... >

但是問題來了...

我在這個檔案中找到不到Context的Tag說, 看了半天也不知道要加在那位置,
因為檔案裡面還有Tag , 架構不太清楚下我也不敢亂改.

請問我該怎麼解決這個問題?

謝謝


reply to postreply to post
作者 Re:關於讓Tomcat 5.0自動Reload Servlet [Re:Hidra]
frank



版主

發文: 498
積分: 13
於 2004-05-10 21:48 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
自行加在 <Host>...</Host> tag 內
這一篇

我在 jakarta-tomcat-5.0.19\conf\server.xml <Host> 內加
1
<Context path="/MyPhoto" docBase="D:\Photo\web" debug="0" crosscontext="true" reloadable="true" />

是 ok 的


reply to postreply to post
作者 Re:關於讓Tomcat 5.0自動Reload Servlet [Re:Hidra]
Hidra





發文: 41
積分: 0
於 2004-05-11 01:20 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
感謝大大指導 ^^
我剛才照大大的方法試了, 最後有被我Try出來(方法見最後面), 不過我還是有些地方不懂想請問大大. Context element中的path 及docBase 屬性是作什麼用的呀?
我不太了解這2個屬性的實際定義, 想請大大解說一下. 還有因為我看了Server.xml的註解, 但是其中沒有提到Context這個element, 所以如果我要自己找文件來看, 在那裡才可以找到, 感謝大大幫忙 ~

---------------------------------------------------
Try出來的方法:
我的目錄設定:
C:\Tomcat 5.0\webapps\myapp
C:\Tomcat 5.0\webapps\myapp\WEB-INF\classes
Classes目錄中有 HelloServlet.class

我在webapps下定義自己的目錄myapp , 經過試驗之後Context element如下定義時, 可以在Modify HelloServlet.class之後不用Re Start Tomcat, Tomcat自己就可以即時讀到我modify的部份.

<Context path="/myapp" docBase="myapp" debug="0"
  crosscontext="true" reloadable="true" />


P.S 定義完Context屬性後要重新Re Star Tomcat.


Hidra edited on 2004-05-11 12:39
reply to postreply to post
作者 Re:關於讓Tomcat 5.0自動Reload Servlet [Re:Hidra]
Hidra





發文: 41
積分: 0
於 2004-05-11 12:38 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
補充一下:
About Atuo reload servlet method:

1. server.xml (最佳)
  see: Tomcat user guide, section
      4)Developer ->
        Deploy A New Application from a Local Path ->
        Install using a Context configuration ".xml" file
        
2. reload servlet from manager (次佳)
  A. from tomcat manager interface to reload application
  B. Use command(reload 'myapp' application):
    http://localhost:8080/manager/reload?path=/myapp
    see: Tomcat user guide, section
        4)Developer ->
          Reload An Existing Application
    P.S在User Guide 中並無仔細介紹 Path 及 docBase屬性
    
3. restart Tomcat. (最差)


reply to postreply to post
作者 Re:關於讓Tomcat 5.0自動Reload Servlet [Re:Hidra]
frank



版主

發文: 498
積分: 13
於 2004-05-11 23:16 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Hidra wrote:
有些地方不懂想請問. Context element中的path 及docBase 屬性是作什麼用的呀?
我不太了解這2個屬性的實際定義,如果我要自己找文件來看, 在那裡才可以找到

%CATALINA_HOME%\webapps\tomcat-docs\config\context.html


reply to postreply to post
作者 Re:關於讓Tomcat 5.0自動Reload Servlet [Re:Hidra]
waitance





發文: 5
積分: 0
於 2004-05-22 17:20 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
請問一下,放在ROOT下面的是怎麼設定呢?
我試了
1
2
<Context path="/ROOT" docBase="ROOT" debug="0" 
 crosscontext="true" reloadable="true" />


1
2
<Context path="/" docBase="" debug="0" 
  crosscontext="true" reloadable="true" />

都不行


reply to postreply to post
作者 Re:關於讓Tomcat 5.0自動Reload Servlet [Re:Hidra]
Hidra





發文: 41
積分: 0
於 2004-05-25 00:22 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
hi waitance ~
今天才看您的文所以晚回 ^^"
我試了一下發現若要Reload ROOT則要設成下面這樣:
1
2
<Context path="" docBase="" debug="0" 
    crosscontext="true" reloadable="true" />


這個沒試:
1
<Context path="/ROOT" docBase="ROOT" debug="0"  crosscontext="true" reloadable="true" />


這個確定不行
1
<Context path="/" docBase="" debug="0"   crosscontext="true" reloadable="true" />


P.S
1. 設完<Tomcat Root>\conf\server.xml後請記得Reload Tomcat
2. 每次改變Servlet的內容後, Tomcat不會"立即" Reload, 也就是你不會馬上看到你作的改變, 要幾秒後(10秒左右吧 ..)才會讀到改變後的內容.
3. 補充一下, 在Tomcat 5.0.19 文件中有提到, Tomcat並不建議
設自動Reload. 我想大概是效能及資源方面的考量吧...


reply to postreply to post
作者 Re:關於讓Tomcat 5.0自動Reload Servlet [Re:waitance]
Hidra





發文: 41
積分: 0
於 2004-05-25 17:38 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
hi waitance ~
今天才看您的文所以晚回 ^^"
我試了一下發現若要Reload ROOT則要設成下面這樣:
1
2
<Context path="" docBase="" debug="0" 
    crosscontext="true" reloadable="true" />


這個沒試:
1
<Context path="/ROOT" docBase="ROOT" debug="0"  crosscontext="true" reloadable="true" />


這個確定不行
1
<Context path="/" docBase="" debug="0"   crosscontext="true" reloadable="true" />


P.S
1. 設完<Tomcat Root>\conf\server.xml後請記得Reload Tomcat
2. 每次改變Servlet的內容後, Tomcat不會"立即" Reload, 也就是你不會馬上看到你作的改變, 要幾秒後(10秒左右吧 ..)才會讀到改變後的內容.
3. 補充一下, 在Tomcat 5.0.19 文件中有提到, Tomcat並不建議
設自動Reload. 我想大概是效能及資源方面的考量吧...


reply to postreply to post
作者 Re:關於讓Tomcat 5.0自動Reload Servlet [Re:Hidra]
huazii

Enjoy it!



發文: 76
積分: 0
於 2004-07-06 11:38 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list

3. 補充一下, 在Tomcat 5.0.19 文件中有提到, Tomcat並不建議
設自動Reload. 我想大概是效能及資源方面的考量吧...

那就是说,Tomcat建议每次更改使用manage/来reload了?
或者其它的方法?


reply to postreply to post
作者 Re:關於讓Tomcat 5.0自動Reload Servlet [Re:huazii]
Hidra





發文: 41
積分: 0
於 2004-07-06 21:16 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
看情況使用:
如果你是在開發的時候, 當然要用自動Reload拉, 做起來才快咩~~

如果是正式上線(Online)了, 那就不要Reload了, 因為可以節省資源.

huazii wrote:
那就是说,Tomcat建议每次更改使用manage/来reload了?
或者其它的方法?


reply to postreply to post
作者 Re:關於讓Tomcat 5.0自動Reload Servlet [Re:huazii]
frank



版主

發文: 498
積分: 13
於 2004-07-07 00:33 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
今天剛看到的文章 Servlet and JSP performance tuning ,和 Hidra 兄的建議一樣

Disable servlet and JSP auto-reloading
1
2
3
4
5
6
Servlet/JSP auto-reloading proves useful during the development phase because it reduces development time, 
as you do not have to restart the server after every change in the servlet/JSP. However, it is expensive in 
the production phase; servlet/JSP auto-reloading gives poor performance because of unnecessary loading and 
burdening on the classloader. Also, it may put your application in strange conflicts when classes loaded by 
a certain classloader cannot cooperate with classes loaded by the current classloader. 
So turn off auto-reloading for servlet/JSP in a production environment to receive better performance.


另有簡體版 Servlet, Jsp 性能優化

==============================================

javaresearch.org 這篇文章可以參考一下 -- Tomcat Reload,不得不說的故事


frank edited on 2004-08-11 02:17
reply to postreply to post
作者 Re:關於讓Tomcat 5.0自動Reload Servlet [Re:Hidra]
leung





發文: 114
積分: 0
於 2004-07-18 08:18 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
對不起....

請問這問方法可否使用在 tomcat 4.1.30 內....

如果可以的話....請問應該怎樣設定.....??


reply to postreply to post
作者 Re:關於讓Tomcat 5.0自動Reload Servlet [Re:leung]
Hidra





發文: 41
積分: 0
於 2004-07-18 22:17 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
4.X版的我沒試過, 不過應該可以.

設定方式很簡單, 請見樓上的文章 ^^"

leung wrote:
對不起....

請問這問方法可否使用在 tomcat 4.1.30 內....

如果可以的話....請問應該怎樣設定.....??


browser edited on 2004-07-18 22:26
reply to postreply to post
作者 Re:關於讓Tomcat 5.0自動Reload Servlet [Re:leung]
huazii

Enjoy it!



發文: 76
積分: 0
於 2004-08-03 11:17 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
leung wrote:
對不起....

請問這問方法可否使用在 tomcat 4.1.30 內....

如果可以的話....請問應該怎樣設定.....??

可以的
方法同上


reply to postreply to post
作者 Re:關於讓Tomcat 5.0自動Reload Servlet [Re:frank]
hartball38





發文: 332
積分: 0
於 2005-02-23 16:42 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
請問一下
當我在 5.0.19版的conf\server.xml
改為 以下內容

<Server port="8005" shutdown="SHUTDOWN" debug="0">
<DefaultContext reloadable="true"/>
<Context path="/AA" docBase="AA" debug="0" reloadable="true" />


結果就會出現 以下ERROR

Error: 500
Location: /
Internal Servlet Error:
java.io.IOException: Not an ISO 8859_1 character:?


換回原始檔 重開機 也沒效
非得重冠 且 TOMCAT的目錄名稱也需更改 才行
請問 問題出在哪邊呢
謝謝


reply to postreply to post
作者 Re:關於讓Tomcat 5.0自動Reload Servlet [Re:hartball38]
hkdennis2k





發文: 1926
積分: 6
於 2005-02-23 18:22 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
hartball38 wrote:
請問一下
當我在 5.0.19版的conf\server.xml
改為 以下內容

結果就會出現 以下ERROR

換回原始檔 重開機 也沒效
非得重冠 且 TOMCAT的目錄名稱也需更改 才行
請問 問題出在哪邊呢
謝謝


很有可能是你存了 server.xml 為 UTF-8/UTF-16 檔


reply to postreply to post
作者 Re:關於讓Tomcat 5.0自動Reload Servlet [Re:Hidra]
hartball38





發文: 332
積分: 0
於 2005-02-24 08:15 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
不過 我用2000內建的 文件文字編輯器來編輯
存的時候我看他都是預設的 ANSI
這也跟UTF-8 等有關嗎


reply to postreply to post
作者 Re:關於讓Tomcat 5.0自動Reload Servlet [Re:hartball38]
Hidra





發文: 41
積分: 0
於 2005-02-24 10:35 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
hartball38 wrote:
不過 我用2000內建的 文件文字編輯器來編輯
存的時候我看他都是預設的 ANSI
這也跟UTF-8 等有關嗎


如果你存檔時是ANSI的話, 那你可以看看, 你修改的內容是不是有增加中文?
我猜有可能是你在內容加了中文, 而某些中文不被支援.


reply to postreply to post
作者 Re:關於讓Tomcat 5.0自動Reload Servlet [Re:Hidra]
hartball38





發文: 332
積分: 0
於 2005-02-24 13:23 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
沒有耶
就只設定成

<Server port="8005" shutdown="SHUTDOWN" debug="0">
<DefaultContext reloadable="true"/>
<Context path="/AA" docBase="AA" debug="0" reloadable="true" />


這樣就不行了


reply to postreply to post
作者 Re:關於讓Tomcat 5.0自動Reload Servlet [Re:hartball38]
yeriwei





發文: 1
積分: 0
於 2005-05-12 16:56 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
请问一下在Resin...这Reload Servlet怎么设置...
他们说默认的.不过我生新配置过还是不会Atuo Reload Servlet...

谢谢!


reply to postreply to post
作者 Re:關於讓Tomcat 5.0自動Reload Servlet [Re:Hidra]
etwantjava





發文: 42
積分: 0
於 2008-07-10 20:03 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
請問大家
為什麼都已經按照上述設定,仍然不能自動reload,每次修改servlet成事後都得重新關開Tomca,頁面才會更新??謝謝

我servlet.xml設定如下:
1
<Context path="/MyApp" docBase="MyApp" debug="0" crosscontext="true"  reloadable="true"   />

ps.我在%CATALINA_HOME%\webapps資料夾下建立MyApp


reply to postreply to post
» JWorld@TW »  Application Server » Tomcat

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8