Results 1 to 16 of 16

Thread: jasper

  1. #1
    newbiejava is offline Senior Member
    Join Date
    Jan 2010
    Posts
    138
    Rep Power
    0

    Default jasper

    Dear All,

    I am trying to view report using jasper ..
    but it does not work ..

    what I missed?

    Java Code:
    JasperDesign jasperDesign = JRXmlLoader.load("myreport1.jrxml");
    jasperReport = JasperCompileManager.compileReport(jasperDesign);
    Connection jdbcConn = connectMySQL();
    jasperPrint = JasperFillManager.fillReport(jasperReport, new 
    HashMap(), jdbcConn);
    JasperViewer.viewReport(jasperPrint);

    it thrown exception below:

    Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError:
    org/apache/commons/logging/LogFactory
    at
    net.sf.jasperreports.engine.xml.JRXmlDigesterFacto ry.<clinit>(JRXmlDigesterFactory.java:179)
    at
    net.sf.jasperreports.engine.xml.JRXmlLoader.load(J RXmlLoader.java:205)
    at
    net.sf.jasperreports.engine.xml.JRXmlLoader.load(J RXmlLoader.java:170)
    at
    net.sf.jasperreports.engine.xml.JRXmlLoader.load(J RXmlLoader.java:154)
    at commanywhere.Jasper.viewReport(Jasper.java:61)
    at
    commanywhere.JFrmReadRawData.jButton2ActionPerform ed(JFrmReadRawData.java:401)
    at commanywhere.JFrmReadRawData.access$700(JFrmReadRa wData.java:27)
    at
    commanywhere.JFrmReadRawData$8.actionPerformed(JFr mReadRawData.java:167)
    at
    javax.swing.AbstractButton.fireActionPerformed(Abs tractButton.java:1995)
    at
    javax.swing.AbstractButton$Handler.actionPerformed (AbstractButton.java:2318)
    at
    javax.swing.DefaultButtonModel.fireActionPerformed (DefaultButtonModel.java:387)
    at
    javax.swing.DefaultButtonModel.setPressed(DefaultB uttonModel.java:242)
    at
    javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(BasicButtonListener.java:236)
    at java.awt.Component.processMouseEvent(Component.jav a:6263)
    at javax.swing.JComponent.processMouseEvent(JComponen t.java:3267)
    at java.awt.Component.processEvent(Component.java:602 8)
    at java.awt.Container.processEvent(Container.java:204 1)
    at java.awt.Component.dispatchEventImpl(Component.jav a:4630)
    at java.awt.Container.dispatchEventImpl(Container.jav a:2099)
    at java.awt.Component.dispatchEvent(Component.java:44 60)
    at
    java.awt.LightweightDispatcher.retargetMouseEvent( Container.java:4574)
    at
    java.awt.LightweightDispatcher.processMouseEvent(C ontainer.java:4238)
    at java.awt.LightweightDispatcher.dispatchEvent(Conta iner.java:4168)
    at java.awt.Container.dispatchEventImpl(Container.jav a:2085)
    at java.awt.Window.dispatchEventImpl(Window.java:2478 )
    at java.awt.Component.dispatchEvent(Component.java:44 60)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java: 599)
    at
    java.awt.EventDispatchThread.pumpOneEventForFilter s(EventDispatchThread.java:269)
    at
    java.awt.EventDispatchThread.pumpEventsForFilter(E ventDispatchThread.java:184)
    at
    java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:174)
    at
    java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:169)
    at
    java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:122)
    Caused by: java.lang.ClassNotFoundException:
    org.apache.commons.logging.LogFactory
    at java.net.URLClassLoader$1.run(URLClassLoader.java: 202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.j ava:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:3 07)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 48)
    ... 33 more

  2. #2
    mine0926 is offline Senior Member
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    580
    Rep Power
    4

    Default

    First, I think you have to give the complete path of the report. Including drive and folder where your report is placed.
    Java Code:
    JasperDesign jasperDesign = JRXmlLoader.load("D:\\Folder\\anoterFolder\\folder_again\\report\\MyReport.jrxml");
    Second,
    jasperReport = JasperCompileManager.compileReport(jasperDesign);
    jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(), jdbcConn);
    JasperViewer.viewReport(jasperPrint);
    ??? I think you forgot to put variable name
    Java Code:
    JasperReport someReport= JasperCompileManager.compileReport(jasperDesign);
    JasperPrint somePrint= JasperFillManager.fillReport(jasperReport, new HashMap(), jdbcConn);
    And you can just pass null instead of "new HashMap()" in parameter.
    Java Code:
    JasperPrint somePrint= JasperFillManager.fillReport(jasperReport, null, jdbcConn);
    Also, I did not see you declare JasperViewer.

  3. #3
    newbiejava is offline Senior Member
    Join Date
    Jan 2010
    Posts
    138
    Rep Power
    0

    Default

    Java Code:
    JasperDesign jasperDesign = JRXmlLoader.load("C:\\project\\learnjava\\myreport1.jrxml");
    
    JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
    
    Connection jdbcConn = connectMySQL();
    
    JasperPrint  jasperPrint = JasperFillManager.fillReport(jasperReport, null, jdbcConn);
    JasperViewer.viewReport(jasperPrint);

    .viewReport method is static method .. so I should replace it with class reference.

    and the problem still occurs..


    any idea?

  4. #4
    mine0926 is offline Senior Member
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    580
    Rep Power
    4

    Default

    try this...
    Java Code:
    JasperViewer.viewReport(print, true);

  5. #5
    newbiejava is offline Senior Member
    Join Date
    Jan 2010
    Posts
    138
    Rep Power
    0

    Default

    the same problem still occurs...

  6. #6
    mine0926 is offline Senior Member
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    580
    Rep Power
    4

    Default

    Same Error message? Or nothing happens?
    Try to create a small program that show your problem.

    Did you already add the libraries needed?

  7. #7
    newbiejava is offline Senior Member
    Join Date
    Jan 2010
    Posts
    138
    Rep Power
    0

    Default

    yes, the same exception thrown
    all required libraries added..

    commons-beanutils-1.8.0
    commons-collections-2.1.1
    commons-digester-1.7
    jasperreports-3.7.4
    jasperreports-applet-3.7.4
    jasperreports-fonts-3.7.4
    jasperreports-javaflow-3.7.4
    itext-2.1.7

  8. #8
    mine0926 is offline Senior Member
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    580
    Rep Power
    4

    Default

    try to create a small executable program that concerns/describes your problem. So we can run it in our pc

  9. #9
    newbiejava is offline Senior Member
    Join Date
    Jan 2010
    Posts
    138
    Rep Power
    0

    Default

    ok.. where should I send it?

  10. #10
    mine0926 is offline Senior Member
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    580
    Rep Power
    4

    Default

    not so sure but did you add spring.jar?

  11. #11
    mine0926 is offline Senior Member
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    580
    Rep Power
    4

    Default

    post it in this thread

  12. #12
    newbiejava is offline Senior Member
    Join Date
    Jan 2010
    Posts
    138
    Rep Power
    0

    Default

    Thanks!.. it works now :->)

  13. #13
    mine0926 is offline Senior Member
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    580
    Rep Power
    4

    Default

    Nice. What did you do?

  14. #14
    newbiejava is offline Senior Member
    Join Date
    Jan 2010
    Posts
    138
    Rep Power
    0

    Default

    I added spring.jar as you suggested :->)

  15. #15
    javaean is offline Member
    Join Date
    Dec 2007
    Posts
    2
    Rep Power
    0

    Default

    :D Would you please give me the complete code!

  16. #16
    kasun is offline Member
    Join Date
    Aug 2011
    Posts
    1
    Rep Power
    0

    Default HI

    Thanks for your valuable information. its helped me to fixed my errors

Similar Threads

  1. jasper report ,jasper report jar files and maven dependencies.
    By rajuchacha007 in forum Advanced Java
    Replies: 1
    Last Post: 04-09-2010, 08:15 AM
  2. jasper report
    By vidhyaprabu in forum New To Java
    Replies: 6
    Last Post: 11-12-2009, 03:31 AM
  3. Jasper Report
    By sysout in forum New To Java
    Replies: 12
    Last Post: 09-16-2009, 03:37 PM
  4. Jasper Reports
    By sunjavaboy in forum Advanced Java
    Replies: 0
    Last Post: 10-28-2008, 09:33 PM
  5. how to use Jasper Reports in JSP
    By JavaEmpires in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 08-20-2008, 02:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •