问题
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:
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?
回答1:
Sounds like you're missing the Joda-Time dependency. GitHub project for Joda-Time available here.
As per documentation, to get the latest Joda-Time jar you can do:
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 here and add it to your classpath.
来源:https://stackoverflow.com/questions/37713168/java-lang-classnotfoundexception-org-joda-time-readablepartial