簡體   English   中英

Tomcat 構建錯誤:java.lang.NoClassDefFoundError

[英]Tomcat Build Error: java.lang.NoClassDefFoundError

The projet work fine in tomcat localhost but when I upload it in a remote tomcat I get this bug:/, I have the jar that contain the ImageReaderFactory class in classpath, I didn't understand what can be the problem, I cleared the / tomcat/work/Catalina/localhost 文件夾但總是相同的錯誤: java.lang.NoClassDefFoundError

07-Oct-2019 23:06:25.584 SEVERE [http-apr-8080-exec-267] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [UploadServlet] in context with path [/MyServer] threw exception [Servlet execution threw an exception] with root cause
 java.lang.NoClassDefFoundError: org/dcm4che3/imageio/codec/ImageReaderFactory
    at org.dcm4che3.imageio.plugins.dcm.DicomImageReader.setMetadata(DicomImageReader.java:794)
    at org.dcm4che3.imageio.plugins.dcm.DicomImageReader.readMetadata(DicomImageReader.java:713)
    at org.dcm4che3.imageio.plugins.dcm.DicomImageReader.read(DicomImageReader.java:452)
    at com.project.dicomserver.UploadServlet.getFrameIcon(UploadServlet.java:86)
    ....

有沒有人有任何想法?

圖片

在您的特定情況下,有很多事情可能是 go 錯誤的。 因此,盡我所知回答。 通過添加盡可能多的細節來對問題進行修改,我們可以為您提供進一步的幫助。

tomcat 中的每個應用程序都需要具有特定的文件夾結構。 文件夾結構在此處記錄。 簡而言之,war 文件必須部署到$CATALINA_BASE/webapps/目錄中。

因此,如果您的應用程序是“ myapp ”,那么必須有一個$CATALINA_BASE/webapps/myapp目錄。

$CATALINA_BASE/webapps/myapp目錄中,我們需要有WEB-INF 不是$CATALINA_BASE/webapps/myapp/WebContent/WEB-INF ,而是$CATALINA_BASE/webapps/myapp/WEB-INF 案件很重要。

如果這不是您的應用程序部署到 vanilla tomcat 的方式,它將無法正常工作。 閱讀官方文檔

現在關於你的開發環境,看看你的 eclipse 配置是否被修改過。 Export As War選項可以在多個位置進行修改,並且所有這些選項都會對您生成的 war 文件產生影響。 如有疑問,我會查看此鏈接

使用mavengradle 之類的構建工具。 這些工具為編譯、歸檔、測試和部署應用程序帶來了標准,讓您減少對環境相關問題的擔憂。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM