Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: I have an issue with IReport and NetBeans

  1. #1
    Member
    Join Date
    Oct 2013
    Location
    Cyprus
    Posts
    35
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default I have an issue with IReport and NetBeans

    Hello,
    I have created a report using Jasper Report Designer BUT when i import it in my project i have an error "JRException unkown column name", i have checked the connection with the database and is ok, i have the jdbc jar file added too.I have also added the jar files from Jasper lib and dist folder.It works fine when i preview it.
     reportbtn.addActionListener(new ActionListener() {
     
                @Override
                public void actionPerformed(ActionEvent e) {
     
                    try{
     
                     JasperDesign jd = JRXmlLoader.load("C:\\Users\\Mario\\myreport.jrxml");
     
                     String que = "SELECT * FROM customers";
     
                     JRDesignQuery newQuery = new JRDesignQuery();
                     newQuery.setText(que);
                     jd.setQuery(newQuery);
     
                     JasperReport jr = JasperCompileManager.compileReport(jd);
                     JasperPrint jp = JasperFillManager.fillReport(jr,null,getConn());
     
                     JasperViewer.viewReport(jp,false);
     
                    }catch(JRException ex){
                        JOptionPane.showConfirmDialog(null, ex);
                    }
                }
            });

    Thanks in advance.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: I have an issue with IReport and NetBeans

    JRException unkown column name
    Sounds like it cannot find the column name for a particular database table, so my first piece of advice would be to verify the database, table name, and column names. Second piece of advice would be to post all information - a full stack trace for starters. Issues like this are quite difficult to debug remotely without all information supplied in the most concise way as possible.

  3. #3
    Member
    Join Date
    Oct 2013
    Location
    Cyprus
    Posts
    35
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: I have an issue with IReport and NetBeans

    Quote Originally Posted by copeg View Post
    Sounds like it cannot find the column name for a particular database table, so my first piece of advice would be to verify the database, table name, and column names. Second piece of advice would be to post all information - a full stack trace for starters. Issues like this are quite difficult to debug remotely without all information supplied in the most concise way as possible.
    I have already checked the db name and column names.When i finished the report design i saw it in preview and it was working fine and also exported a pdf with the data stored in database.

    log4j:WARN No appenders could be found for logger (net.sf.jasperreports.engine.xml.JRXmlDigesterFactory).
    log4j:WARN Please initialize the log4j system properly.
    net.sf.jasperreports.engine.JRException: Unknown column name : customers_name
    	at net.sf.jasperreports.engine.JRResultSetDataSource.getColumnIndex(JRResultSetDataSource.java:400)
    	at net.sf.jasperreports.engine.JRResultSetDataSource.getColumnIndex(JRResultSetDataSource.java:400)
    	at net.sf.jasperreports.engine.JRResultSetDataSource.getFieldValue(JRResultSetDataSource.java:130)
    	at net.sf.jasperreports.engine.fill.JRFillDataset.setOldValues(JRFillDataset.java:1358)
    	at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:1259)
    	at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:1235)
    	at net.sf.jasperreports.engine.fill.JRBaseFiller.next(JRBaseFiller.java:1588)
    	at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:149)
    	at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:939)
    	at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:852)
    	at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:87)
    	at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:446)
    	at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:849)
    	at jframedesign.JFrameDesign$1.actionPerformed(JFrameDesign.java:78)
    	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
    	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    	at java.awt.Component.processMouseEvent(Component.java:6505)
    	at javax.swing.JComponent.processMouseEvent(JComponent.java:3320)
    	at java.awt.Component.processEvent(Component.java:6270)
    	at java.awt.Container.processEvent(Container.java:2229)
    	at java.awt.Component.dispatchEventImpl(Component.java:4861)
    	at java.awt.Container.dispatchEventImpl(Container.java:2287)
    	at java.awt.Component.dispatchEvent(Component.java:4687)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
    	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
    	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
    	at java.awt.Container.dispatchEventImpl(Container.java:2273)
    	at java.awt.Window.dispatchEventImpl(Window.java:2719)
    	at java.awt.Component.dispatchEvent(Component.java:4687)
    	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
    	at java.awt.EventQueue.access$200(EventQueue.java:103)
    	at java.awt.EventQueue$3.run(EventQueue.java:694)
    	at java.awt.EventQueue$3.run(EventQueue.java:692)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
    	at java.awt.EventQueue$4.run(EventQueue.java:708)
    	at java.awt.EventQueue$4.run(EventQueue.java:706)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    	at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    	at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
    Thanks in advance.

  4. #4
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: I have an issue with IReport and NetBeans

    net.sf.jasperreports.engine.JRException: Unknown column name : customers_name
    The exception indicates the column 'customers_name' cannot be found. If you've verified it exists in your database, I would recommend stripping down the problem to do some experimenting and debugging - for instance remove the reliance of that column (and to avoid confusion specify column names in your query rather than 'SELECT *'), or just strip the report down to a single column and validate it works, then build the report back up.

  5. #5
    Member
    Join Date
    Oct 2013
    Location
    Cyprus
    Posts
    35
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: I have an issue with IReport and NetBeans

    Quote Originally Posted by copeg View Post
    The exception indicates the column 'customers_name' cannot be found. If you've verified it exists in your database, I would recommend stripping down the problem to do some experimenting and debugging - for instance remove the reliance of that column (and to avoid confusion specify column names in your query rather than 'SELECT *'), or just strip the report down to a single column and validate it works, then build the report back up.
    SOLVED, report query was like "Select customers.id AS customer_id, . . ." and the query in NetBeans project was "Select * FROM customers".
    THANKS mate for the help!!!

Similar Threads

  1. java ireport
    By aman_chauhan in forum Java Theory & Questions
    Replies: 0
    Last Post: July 4th, 2012, 01:46 PM
  2. [SOLVED] Netbeans JSP issue
    By ek_swaim in forum JavaServer Pages: JSP & JSTL
    Replies: 1
    Last Post: June 12th, 2012, 08:48 PM
  3. Servlet + ireport
    By javierkcjm in forum Java Servlet
    Replies: 1
    Last Post: November 16th, 2011, 09:18 AM
  4. Writting Greek text in xml file (without Netbeans) - issue.
    By g3orge in forum File I/O & Other I/O Streams
    Replies: 6
    Last Post: September 23rd, 2011, 03:45 AM
  5. Double always == 0! And a Javadoc issue! (Using NetBeans)
    By CameronFaust in forum What's Wrong With My Code?
    Replies: 2
    Last Post: August 11th, 2011, 12:22 AM

Tags for this Thread