java.lang.ClassNotFoundException: org.joda.time.ReadablePartial

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37713168/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 19:35:47  来源:igfitidea点击:

java.lang.ClassNotFoundException: org.joda.time.ReadablePartial

javajasper-reportsclassnotfoundexception

提问by Paulo

I'm using Eclipse Luna with Jaspersoft Studio plugin 6.2.2 to developer reports for web application. No problem to run one basic blank report from Eclipse plugin, but when I load this jrxml from java class, I receive the message:

我将 Eclipse Luna 与 Jaspersoft Studio 插件 6.2.2 一起用于 Web 应用程序的开发人员报告。从 Eclipse 插件运行一份基本的空白报告没问题,但是当我从 java 类加载这个 jrxml 时,我收到消息:

Servlet.service() for servlet [default] in context with path [/insurance] threw exception [Filter execution threw an exception] with root cause
java.lang.ClassNotFoundException: org.joda.time.ReadablePartial
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1858)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1709)  

I'm using the code:

我正在使用代码:

JasperDesign jasperDesign = JRXmlLoader.load(fileName);

What's this error?

这是什么错误?

回答by Voicu

Sounds like you're missing the Joda-Timedependency. GitHub project for Joda-Time available here.

听起来您缺少Joda-Time依赖项。Joda-Time 的 GitHub 项目可在此处获得

As per documentation, to get the latest Joda-Time jar you can do:

根据文档,要获取最新的 Joda-Time jar,您可以执行以下操作:

Maven:

马文

<dependency>
  <groupId>joda-time</groupId>
  <artifactId>joda-time</artifactId>
  <version>2.9.4</version>
</dependency>

Gradle:

摇篮

compile 'joda-time:joda-time:2.9.4'

Or you can manually download the latest jar from hereand add it to your classpath.

或者您可以从这里手动下载最新的 jar并将其添加到您的类路径中。