Error when running report in JasperSoft Studio using RMI and Spring framework: org/springframework/context/ApplicationContext

0

I'm trying to create a report in JasperSoft Studio, based on the CollectionsJavaBeans. In eclipse, I have created two projects, the first project lat's say it's called "Server", it's a simple server that provide a service ... The second project let's say it's called 'Client', this client will ask the server for the service, using the RMI, and the Spring framework ... I have created a simple client.java class to simply test my projects. The client.java:

 

import java.rmi.RemoteException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import com.inter.test.TestRemote;
public class Client {
    public static void main(String[] args) throws RemoteException
    {
        String file = "D:\\myworkspacepath...\\src\\client-beans.xml";
        ApplicationContext context = new FileSystemXmlApplicationContext(file);
        TheService remote = (TheService )context.getBean("TheService Bean");
        System.out.println(remote.isLoginValid("ak"));
        System.out.println(remote.isLoginValid("test"));
    }
}

I have launched the server, than I have launched the Client.java, and results is as shown below:

false
true

This result ensures that all worked successfully and no error has detected.

Well, after exporting for the 'Client' project, in JasperSoft Studio, I have created a new report and I have assigned data source to be the 'Client' project, be sure that I know very much how to create and use that kind of data source, since I have created a lot of projects based on same kind of data source ... And after designed my report, and when I have launched my report, I got this mistake error:

net.sf.jasperreports.engine.JRException: java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext
    at com.jaspersoft.studio.editor.preview.view.control.ReportControler.fillReport(ReportControler.java:482)
    at com.jaspersoft.studio.editor.preview.view.control.ReportControler.access$18(ReportControler.java:457)
    at com.jaspersoft.studio.editor.preview.view.control.ReportControler$4.run(ReportControler.java:347)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at net.sf.jasperreports.engine.util.JRClassLoader.loadClassForRealName(JRClassLoader.java:157)
    at net.sf.jasperreports.data.bean.BeanDataAdapterService.contributeParameters(BeanDataAdapterService.java:82)
    at net.sf.jasperreports.engine.fill.JRFillDataset.contributeParameters(JRFillDataset.java:1017)
    at net.sf.jasperreports.engine.fill.JRFillDataset.setParameterValues(JRFillDataset.java:627)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:1280)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:900)
    at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFiller.run(BaseFillHandle.java:120)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationContext
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 10 more

I googled a lot, I found much of posts here and in other forums such as (community.jasper), but I don't found any solutions to resolve this error, I hope someone can help me here and sorry if my english isn't good. Best regards.

BinaryMan's picture
Joined: Oct 2 2014 - 6:58am
Last seen: 4 years 9 months ago

Are you working with Maven? If yes, try to add this to your pom.xml

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>4.1.7.RELEASE</version>
</dependency>

RebeccaS. - 4 years 2 months ago

0 Answers:

No answers yet
Feedback
randomness