Jump to content

JasperReport fails to execute in Eclipse Neon 2 Java / Swing


nrpowell

Recommended Posts

Hi all

 

I need some help, please ;)

 

I am creating a simple Java application using Eclipse Neon.2(4.6.2) IDE and Swing Librariesa

All the windows and sql queries work as expected when running from Eclipse !

 

I have created a basic Jasper Report using separate Jaspersoft Studio 6.3.1 (I cant get the plugin to load in eclipse but  I can live with out that for now)

The report previews fine and connects to the mysql database inside Jaspersoft Studio

 

I have installed ANT and tested it everything seems ok as well, (not sure if that is needed but did it anyway)

 

I have copied the report file produced 'PropertySummaryReport.jrxml' into the main Java project folder.

 

I have added the 6 jasperreports-<xxxxx>-6.3.1 jar files to my project and added them to my Referenced libraries in Java Build Path

 

I have added the following lines of Java to a menu button listener

 

Connection connection = null;

connection = mysqlConnection.dbConnector();

 

JasperDesign jasperDesign = JRXmlLoader.load("PropertySummaryReport.jrxml");

 

JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);

JasperPrint print = JasperFillManager.fillReport(jasperReport, null, connection);

JRViewer viewer = new JRViewer(print);

 

When i run the app the line 'JasperDesign jasperDesign = JRXmlLoader.load("PropertySummaryReport.jrxml");' is failing with the error

 

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/commons/digester/Digester

at cs_project.MainWindow$12.actionPerformed(MainWindow.java:260)

at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.setPressed(Unknown Source)

at javax.swing.AbstractButton.doClick(Unknown Source)

at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)

at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)

at java.awt.Component.processMouseEvent(Unknown Source)

at javax.swing.JComponent.processMouseEvent(Unknown Source)

at java.awt.Component.processEvent(Unknown Source)

at java.awt.Container.processEvent(Unknown Source)

at java.awt.Component.dispatchEventImpl(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Window.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.EventQueue.dispatchEventImpl(Unknown Source)

at java.awt.EventQueue.access$500(Unknown Source)

at java.awt.EventQueue$3.run(Unknown Source)

at java.awt.EventQueue$3.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)

at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)

at java.awt.EventQueue$4.run(Unknown Source)

at java.awt.EventQueue$4.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)

Caused by: java.lang.ClassNotFoundException: org.apache.commons.digester.Digester

at java.net.URLClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

... 39 more

 

I thought this might be caused my the missing JAR file 'commons-digester3-3.2.jar' so i downloaded and added to my referenced libraries in classpath

 

What am i doing wrong, Im spending too much time on this problem and running out of time for my project

 

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi Again

A little disapointed not to be offerred any advice but I have made quite a lot of progress.

I can now execute Reports and Charts from inside Eclipse although I am having to build the reports in the standalone JasperReports tool

The solution was to include a lot of additional class librarys in that do not seem to be mentioned anywhere in the installation notes  (commons-*, joda-time-2.1, spring-beans, spring-core etc)  

My only problem now is that the built in functions such as DATEFORMAT will not compile when i run from Eclipse.

I have included jasperreports-functions-6.3.1.jar.  Do I need to import anything in class that compiles the report ?

This is an example of the error

C:Usersnrpowcs_workspacecs_projectnicksreport_1488163868244_961370.java:194: error: cannot find symbol

                value = DATEFORMAT( ((java.sql.Date)field_end_date.getValue()),"dd/mm/yyyy"); //$JR_EXPR_ID=9$
                        ^
  symbol:   method DATEFORMAT(Date,String)
  location: class nicksreport_1488163868244_961370

Am I missing something obvious, I cant believe it is meant to be this difficult !

Please help !

 

Nick

 

 

 

 

 

 

.

 

 

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...