gpt4 book ai didi

java - 线程中的 NoClassDefFoundError

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:31:42 24 4
gpt4 key购买 nike

您好,我在运行线程时遇到异常 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()) {

...

完整的异常(exception)是:

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)

最佳答案

我的猜测是 com.befasoft.common.business.webservices.client.Session 之前因 ExceptionInInitializerError 而失败。这为后续调用提供了 NoClassDefFoundError。从头检查日志。

关于java - 线程中的 NoClassDefFoundError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13136509/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com