Tomcat7在WEB-INF / lib / lookHere.jar中找不到类

时间:2013-09-03 17:26:24

标签: java tomcat tomcat7 classloader

Tomcat7非常奇怪。

我将一些数据对象从我的Web应用程序迁移到jar文件中。 当我在本地开发机器上部署到tomcat7时,Everythings工作正常。 但是,当我尝试部署相同的代码进行测试时,tomcat无法找到已迁移到jar文件的数据对象类。 我不明白为什么会这样。 这几乎就像tomcat仍然希望在Web应用程序中找到数据对象,因此甚至不想查看jar文件。

有没有人知道如何让FORCE 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

1 个答案:

答案 0 :(得分:1)

你是如何在WAR和JAR中构建类的?您描述的错误看起来像部分失败的构建。