获取java.lang.noclassdeffounderror:com/aspose/cell

发布于 2025-02-11 07:11:33 字数 1120 浏览 0 评论 0原文

运行方法时,我会遇到错误,当我将代码作为tomcat服务器运行时。 “ java.lang.noclassdeffounderror:com/aspose/cells/fileformatutil” 我创建了一个春季启动项目。 我能够执行该方法:ISSAFE运行项目时,以Spring Boot

”在此处输入图像说明” ''

public static boolean isSafe(File f) throws Exception {
        boolean safeState = false;
        // try {
        if ((f != null) && f.exists() && f.canRead()) {
            // Perform a first check on Excel document format
            FileFormatInfo formatInfo = FileFormatUtil.detectFileFormat(f.getAbsolutePath());
            String formatExtension = FileFormatUtil.loadFormatToExtension(formatInfo.getLoadFormat());

''

我有错误, 当相同的项目作为服务器

I am getting error while running method, when i run the code as tomcat server.
"java.lang.NoClassDefFoundError: com/aspose/cells/FileFormatUtil"
I have created a spring boot project.
I am able to execute the method:isSafe when I run the project as Spring Boot

enter image description here
'''

public static boolean isSafe(File f) throws Exception {
        boolean safeState = false;
        // try {
        if ((f != null) && f.exists() && f.canRead()) {
            // Perform a first check on Excel document format
            FileFormatInfo formatInfo = FileFormatUtil.detectFileFormat(f.getAbsolutePath());
            String formatExtension = FileFormatUtil.loadFormatToExtension(formatInfo.getLoadFormat());

'''

I have got the error,
When the same project run as a server

enter image description here

I have added the latest dependency for aspose cells.

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦明 2025-02-18 07:11:33

我是一个想法用户。但是,认为您应该将图书馆包括在档案中(jar,war,ear)中。现在看来,它分别提供给了Class Path,而独立的Tomcat则没有他自己的Libs中的图书馆。

I'm an idea user. But think that you should include library as maven dependency and library will be packed in archive (jar,war,ear). Now it seems like it provided to classpath separately and standalone tomcat doesn't have that library in his own libs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文