![](/img/trans.png)
[英]Tomcat can't access jar library referenced by my library in WEB-INF/lib
[英]Tomcat7 can't find classes in WEB-INF/lib/lookHere.jar
Tomcat7的問題很奇怪。
我將一些數據對象從Web應用程序遷移到了jar文件中。 當我在本地開發計算機上部署到tomcat7時,一切正常。 但是,當我嘗試部署相同的代碼進行測試時,tomcat無法找到已遷移到jar文件的數據對象類。 我不明白為什么會這樣。 似乎tomcat仍然期望在Web應用程序中找到數據對象,因此甚至不必費心在jar文件中查找。
有誰知道一種WEB-INF/lib/lookHere.jar
tomcat在WEB-INF/lib/lookHere.jar
中查找找不到的類文件的方法?
我已經嘗試清除工作目錄無濟於事。
這是當我嘗試調用利用這些數據對象之一的servlet時遇到的那種錯誤的示例:
范例1:
root cause
java.lang.Error: Unresolved compilation problems:
The import com.alpine.data.http.image cannot be resolved
PostImageResponse cannot be resolved to a type
PostImageResponse cannot be resolved to a type</pre>
但是該類在jar文件中...
com/alpine/data/http/image/postImage/response/PostImageResponse.class
范例2:
java.lang.Error: Unresolved compilation problems:
The import com.alpine.data.http.gas.getStation cannot be resolved
The import com.alpine.data.http.message cannot be resolved
The import com.alpine.data.http.postDevicelogentries2 cannot be resolved
GetMessagesResponseRecord cannot be resolved to a type
The method getMessages(String, String, String, String) from the type MessageManager refers to the missing type GetMessagesResponseRecord
但是包和類都在jar文件中!
com/alpine/data/http/gas/getStations/
com/alpine/data/http/message/
com/alpine/data/http/postDevicelogentries2/
com/alpine/data/http/postDevicelogentries2/request/DeviceLogEntry2.class
com/alpine/data/http/message/getMessage/response/GetMessagesResponseRecord.class
您是如何在WAR和JAR中構建類的? 您描述的錯誤看起來像是部分失敗的構建。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.