嗨,我在运行线程时遇到异常 NoClassDefFoundError。当我在没有线程的情况下执行时,这个过程运行良好,但是当我执行 start 方法时,我在不同的语句中得到了这个错误
线程是否有可能与主线程有不同的类路径?
感谢编辑添加代码
运行方法:
public void run(){
try{
boolean startAction = HeapThread.addAction(idCliente, idThread, Constants.ACTION_CREATE_TOPIC);
if (!startAction) {
synchronized (this){
this.wait();
}
}
createTopic();
}
catch(Exception ex){
log.error("Error", ex);
}
finally {
Long nextIdThread = HeapThread.getNextAction(idCliente, idThread, Constants.ACTION_CREATE_TOPIC);
if (nextIdThread > 0){
log.debug("Thread");
ThreadState thread = HeapThread.getState(nextIdThread);
synchronized (thread) {
thread.notify();
}
}
}
}
createTopic() 函数调用 searchBlog() 我称之为
try{
sessionId = SessionWS.createSession(url, false);
CrawlerSearch crawler = new CrawlerSearchAPIService(new URL(url + Constants.URL_CRAWLER), new QName(Constants.QNAME_CRAWLER, "CrawlerSearchAPIService")).getCrawlerSearchAPIPort();
// para cada topico obtnemos 10 blogs
for (Long idTopic : blogsTopics.keySet()) {
...
完全例外是:
java.lang.NoClassDefFoundError: com/befasoft/common/business/webservices/client/Session
at com.befasoft.common.business.webservices.client.SessionAPIService.getSessionAPIPort(SessionAPIService.java:56)
at com.befasoft.common.business.webservices.SessionWS.createSession(SessionWS.java:21)
at com.humanlike.web.tools.Crawler.searchBlogs(Crawler.java:50)
at com.humanlike.web.theads.CreateTopic.createTopic(CreateTopic.java:164)
at com.humanlike.web.theads.CreateTopic.run(CreateTopic.java:63)