<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "Tomcat 5.5.16以上版本會出現cannot be resolved to a type的錯誤"]]></title>
		<link>https://forum.andowson.com/posts/list/20.page</link>
		<description><![CDATA[Latest messages posted in the topic "Tomcat 5.5.16以上版本會出現cannot be resolved to a type的錯誤"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>Tomcat 5.5.16以上版本會出現cannot be resolved to a type的錯誤</title>
				<description><![CDATA[ 不知道有沒有人也遇到在Tomcat 5.5.15之前在某個子目錄下可以正常執行的程式，換到5.5.16以上新版的Tomcat後就會出現找不到一些類別的錯誤（如ParameterParser cannot be resolved to a type），但是在根目錄下有用到同樣類別的程式卻又可以正常執行，而且WEB-INF/classes或WEB-INF/lib目錄下確實也有該類別的class檔或包含該類別的jar檔。您該不會已經開始在想像電腦界也有一些靈異現象然後自己剛好倒楣碰上吧？參考這個問題的另一個說明 
<br>
 :arrow:[url]http://www.javaworld.com.tw/jute/post/view?bid=9&amp;id=182062&amp;sty=1&amp;tpg=1&amp;age=0[/url] 
<br>
<br>
有則Tomcat的Mailing list：[url=http://mail-archives.apache.org/mod_mbox/tomcat-users/200609.mbox/%3C002a01c6d105$b36e4db0$6400a8c0@Toshiba%3E]Tomcat 5.5.16 Auto-Deploy Change Breaking Some WebApps[/url]大致說明了這個問題的成因，Tomcat開發團隊不知道是怎麼回事，自5.5.16版開始把所有根目錄下的子目錄都自動當成一個webapp，不管有沒有WEB-INF/web.xml，衝擊最大的就是如果先前您的網站是啟用虛擬主機，且有把功能依目錄分割，則升級將是一個令人跳腳的事。 
<br>
另外也別期待Tomcat 5.5.17以後的版本會修正這個「你認為是個錯誤的新功能」。 
<br>
 :!:解決的方法： 
<br>
如果可以的話，就是要把第一層的所有子目錄都加上WEB-INF下的相關檔案，不想這麼做的話，唯一的解法就是再降級回Tomcat 5.5.15以前的版本。雖然可能會有一些安全性的問題，但是也只能這麼辦了。底下是在Apache網站上找到的Tomcat 5.5.15版本，供大家下載使用。 
<br>
[url]http://archive.apache.org/dist/tomcat/tomcat-5/archive/v5.5.15/bin/apache-tomcat-5.5.15.tar.gz[/url] 
<br>
[url]http://archive.apache.org/dist/tomcat/tomcat-5/archive/v5.5.15/bin/apache-tomcat-5.5.15.zip[/url]]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/76/119.page</guid>
				<link>https://forum.andowson.com/posts/preList/76/119.page</link>
				<pubDate><![CDATA[Thu, 31 May 2007 23:26:20]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
			<item>
				<title>回覆:Tomcat 5.5.16以上版本會出現cannot be resolved to a type的錯誤</title>
				<description><![CDATA[ 由於換回Tomcat 5.5.15後也有其他問題(例如OLAT跑不起來, javax.servlet.http.HttpSessionAttributeListener 的 attributeRemoved() 出現Session already invalidated), 故還是得繼續用新的Tomcat版本. 
<br>
參考了大陸一位網友zhangxinzhou的文章 
<br>
http://zhangxinzhou.blog.ccidnet.com/blog-htm-do-showone-uid-36421-type-blog-itemid-150874.html 
<br>
把server.xml裡面Host的設定修改一下 
<br>
例如原本的設定如下: 
<br>
[code=xml] 
<br>
 &lt;Host name="www.ezmatch.tw" 
<br>
 appBase="webapps/www.ezmatch.tw" 
<br>
 unpackWARs="true" autoDeploy="true"&gt; 
<br>
 &lt;Alias&gt;ezmatch.tw&lt;/Alias&gt; 
<br>
 &lt;Valve className="org.apache.catalina.valves.FastCommonAccessLogValve" 
<br>
 directory="logs/www.ezmatch.tw" 
<br>
 prefix="www.ezmatch.tw_access_log." suffix=".txt" 
<br>
 pattern="combined" resolveHosts="false"/&gt; 
<br>
 &lt;Context path="" docBase="" debug="0" reloadable="false" /&gt; 
<br>
 &lt;/Host&gt; 
<br>
[/code] 
<br>
修改為: 
<br>
[code=xml] 
<br>
 &lt;Host name="www.ezmatch.tw" 
<br>
 appBase="" 
<br>
 unpackWARs="true" autoDeploy="true"&gt; 
<br>
 &lt;Alias&gt;ezmatch.tw&lt;/Alias&gt; 
<br>
 &lt;Valve className="org.apache.catalina.valves.FastCommonAccessLogValve" 
<br>
 directory="logs/www.ezmatch.tw" 
<br>
 prefix="www.ezmatch.tw_access_log." suffix=".txt" 
<br>
 pattern="combined" resolveHosts="false"/&gt; 
<br>
 &lt;Context path="" docBase="webapps/www.ezmatch.tw" debug="0" reloadable="false" /&gt; 
<br>
 &lt;/Host&gt; 
<br>
[/code] 
<br>
這樣子就可以了.]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/76/277.page</guid>
				<link>https://forum.andowson.com/posts/preList/76/277.page</link>
				<pubDate><![CDATA[Sat, 13 Oct 2007 18:44:10]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
			<item>
				<title>回覆:Tomcat 5.5.16以上版本會出現cannot be resolved to a type的錯誤</title>
				<description><![CDATA[ 今天在Tomcat 6.0.18上又遇到這個問題 
<br>
[quote]The type javax.servlet.http.HttpSession cannot be resolved. It is indirectly referenced from required .class files 
<br>
The type javax.servlet.jsp.JspException cannot be resolved. It is indirectly referenced from required .class files 
<br>
The type javax.servlet.jsp.tagext.Tag cannot be resolved. It is indirectly referenced from required .class files 
<br>
The type javax.servlet.jsp.JspApplicationContext cannot be resolved. It is indirectly referenced from required .class files 
<br>
HttpSession cannot be resolved to a type 
<br>
JspWriter cannot be resolved to a type 
<br>
JspWriter cannot be resolved to a type 
<br>
The type javax.servlet.jsp.JspContext cannot be resolved. It is indirectly referenced from required .class files 
<br>
org.apache.jasper.runtime.PageContextImpl cannot be resolved to a type[/quote] 
<br>
後來找到這篇[url]http://forums.sun.com/thread.jspa?threadID=708154[/url] 
<br>
解法如下 
<br>
修改Tomcat conf目錄下的 web.xml, 將 
<br>
[code]&lt;init-param&gt; 
<br>
 &lt;param-name&gt;fork&lt;/param-name&gt; 
<br>
 &lt;param-value&gt;false&lt;/param-value&gt; 
<br>
&lt;/init-param&gt; 
<br>
[/code] 
<br>
修改為 
<br>
[code] 
<br>
&lt;init-param&gt; 
<br>
 &lt;param-name&gt;fork&lt;/param-name&gt; 
<br>
 &lt;param-value&gt;true&lt;/param-value&gt; 
<br>
&lt;/init-param&gt; 
<br>
[/code] 
<br>
然後重新起動Tomcat 
<br>
這樣就OK了]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/76/603.page</guid>
				<link>https://forum.andowson.com/posts/preList/76/603.page</link>
				<pubDate><![CDATA[Mon, 25 May 2009 11:55:11]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
	</channel>
</rss>