Jump to content
We've recently updated our Privacy Statement, available here ×

ocketje

Members
  • Posts

    8
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Everything posted by ocketje

  1. Hello everybody. i have a question about perhaps a better solution for a way of handling things. Here is the problem: Suppose I would like a report about a sale. On the header of the report i would like to see information about the shop and i would like to see information about the customer who bougth it. All of this information is ofcourse stored in a database, say in the tables SHOPS (as there is a franchise and there are multiple shops around the globe) and CUSTOMER; The body of the report would be a list of the products a customer bought. Ofcourse the lenght of this list is not defined as we dont know how much a customer will buy. In that list i would also like to see how much the customer has payed, the amount of the product he bought etc. All of this information is stored in the table SHOP_PRODUCTS and SHOP_SALES. There is a restriction on how i want to make this report: I need high speed on my report, so any sql that needs to be processed by jasper itself is not done. The java beans datasource is a must (in some form of a collection). So i solved the problem as following: i create a bean fitted to carry the data for the body of the report, for example SalesInformation. So there will be a bean for every product the customer buys. For the header i use parameters. Since SHOP and CUSTOMER have nothing in common with each other, i have 2 queries to fetch the required data and i collect them all to put in a HashMap called parameters. I have considered a subreport with a beantype as datasource that would represent the header of the report, but i wonder if that would be the bests and most flexible solution. Therefor, any idea's on how to make this better are welcome. thanks in advance! Ocketje
  2. Hello cn73! Thanks for your reply, as it was very helpful. I fixed the problem taking your hint. You are right and it was a splendid idea. I figured (from the previous link you sent me) that the problem was (the problem of the guy in that specific thread) was an encoding problem. And although i looked at my POM several times, i always missed the fact that there was 1 encoding tag already. So i never thought the problem could be about the same. Thanks mate, you reply was very usefull. I went looking for some more information and i found the following: http://docs.codehaus.org/display/MAVENUSER/POM+Element+for+Source+File+Encoding where it clearly says that changing the encoding for some plugins (especially build plugins) can have a huge impact. And then the pieces of the puzzle somewhat started to connect in my head. here is the troublesome piece of POM: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> <maxmem>128m</maxmem> <encoding>ISO-8859-1</encoding> </configuration> </plugin> This was the only plugin (of 3 defined plugins) that had an encoding tag to explicitly set an encoding. Now, i dont know what the default is, but i bet it is UTF-8. So i put the encoding to ISO-8859-1 for all of the defined plugins (being: maven-compiler-plugin, maven-resources-plugin (also build plugin) and jasperreports-maven-plugin (not a build plugin, but very important one considering my goals). I did a clean and build again (in netbeans), relaunched the project and hooray, it works like a charm now. Thanks for the fast replies! Ocketje
  3. hello all again, I have upgraded the jasper version to 3.5.3 (in my sandsbox) but i still get the same error. i dont work with client-server setup here, just maven that builds the project and compiles the jrxml files, then puts it all away in a jar file. i am sure that the java versions are the same at compile time and at runtime. Everything happens on the same machine btw. The error occurs n the following piece of code: jasperReport = JRLoader.loadObject( compiledReport.getAbsolutePath()); The 'compiledReport' variable you see is of the type 'File' and has been fetched as a Resource on which i perform : resource.getFile(), although i dont think that is part of the cause. Any more idea's? greetz, ocketje
  4. hi there, i am not sure, as i dont have to much time to check, but try to find some more information on the JRExporter. Especially on the setParameter method. Also look for JRExporterParameters. I bet there is one parameter you can assign wich says how many times you want to export. hope it helps cheers
  5. Hello Theodor, also thanks for your reply. I am absolutely sure that the version of the compiler tool is equal to the version that our software runs. It had crossed my mind already, so i double checked the POM- file to see if the dependencies matched. We use jasperreports version 2.0.1 both in the maven plugin as in our software. This is the POM dependency: <dependency> <groupId>jasperreports</groupId> <artifactId>jasperreports</artifactId> <version>2.0.1</version> </dependency> All of our reports are made with iReports 2.0.2. It wont be easy to upgrade to the latest jasper version, but suppose we do, won't we have problems with our reports that were generated by iReports? The first thing that comes into my mind are deprecated tags or deprecated java code? Thank you for your reply. Regards, Nicholas
  6. hello cn73. Thanks for your reply! Still, i could not yet find a solution. The problem i have is in a class i cant access nor alter. To be precise: it happens in the ObjectInputStream class, at one of the readObject() methods. I cant alter that class. But still, i read the thread that you refer to in your link, and i learned a lot from it. Basically, his problem was the UTF-8 encoding used to encode his URL. I dont use an URL. Still, the UTF-8 encoding makes me think... anyway, thanks for your reply!
  7. Hello everybody, I have a problem on my hands and guess what: its about jasper. This is the situation: while running the next code: --- code snippit here ---- public JasperReport getCompliledReport(String reportName) throws JRException{ // -- initializing the variables ResourceLoader loader = new DefaultResourceLoader(); Resource report = null; File compiledReport = null; Object jasperReport = null; // -- load the compiled report as a resource report = loader.getResource(JASPER_RESOURCE+reportName); try{ if(report != null){ compiledReport = report.getFile(); } // -- load the compiled report and make it a jasper Object // -- so jasper reports can work with it. jasperReport = JRLoader.loadObject(compiledReport.getAbsolutePath()); } catch(IOException e){ e.printStackTrace(); } // -- check if the object returned by the JRLoader is of type JasperReport if(jasperReport instanceof JasperReport && jasperReport != null){ return (JasperReport) jasperReport; } else throw new JRException(ResourceKeys.DESIGN_LOAD_FAILED); } --- END OF CODE SNIPPET ---- The exception is thrown at the line in bold. I get the following stacktrace: net.sf.jasperreports.engine.JRException: Error loading object from file : C:\branch\target\classes\A6page.jasper at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:92) at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:64) at be.lisis.pos.print.jasper.JasperPrinter.getCompliledReport(JasperPrinter.java:165) at be.lisis.pos.print.jasper.JasperPrinter.print(JasperPrinter.java:214) at be.lisis.pos.print.jasper.A6Printer.export(A6Printer.java:175) at be.lisis.pos.print.jasper.A6Printer.printA6Labels(A6Printer.java:54) at be.lisis.pos.workflow.label.PrintWFA.processWorkFlowEvent(PrintWFA.java:201) at be.ldc.jawfl.wfm.SecurityContext.dispatch(SecurityContext.java:208) at be.ldc.jawfl.wfm.AbstractWorkFlowManager.processWorkFlowEventWithException(AbstractWorkFlowManager.java:358) at be.ldc.jawfl.wfm.AbstractWorkFlowManager.processWorkFlowEvent(AbstractWorkFlowManager.java:341) at be.ldc.jawfl.gui.AbstractGUIManager.triggerWorkFlowEvent(AbstractGUIManager.java:278) at be.ldc.jawfl.gui.AbstractGUIManager$WorkFlowEventListener.actionPerformed(AbstractGUIManager.java:2169) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) at be.ldc.jawfl.gui.swing.JWorkFlowButton.fireActionPerformed(JWorkFlowButton.java:114) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.Component.processMouseEvent(Component.java:6216) at javax.swing.JComponent.processMouseEvent(JComponent.java:3265) at java.awt.Component.processEvent(Component.java:5981) at java.awt.Container.processEvent(Container.java:2041) at java.awt.Component.dispatchEventImpl(Component.java:4583) at java.awt.Container.dispatchEventImpl(Container.java:2099) at java.awt.Component.dispatchEvent(Component.java:4413) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4556) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4220) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4150) at java.awt.Container.dispatchEventImpl(Container.java:2085) at java.awt.Window.dispatchEventImpl(Window.java:2475) at java.awt.Component.dispatchEvent(Component.java:4413) at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161) at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) Caused by: java.io.InvalidClassException: java.util.ArrayList; local class incompatible: stream classdesc serialVersionUID = 8664875232659988799, local class serialVersionUID = 8683452581122892189 at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:562) at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583) at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351) at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:88) ... 37 more I am also obliged to give a bit more information: We use jasperreports-maven-plugin to compile any jrxml file in a given source directory. Then i try to load the .jasper file so i can fill it with data and use it. The problem is not in fetching the resource but in putting the pieces back together after deserialization. it would seem like i have 2 different versions of something (some jar or class or whatever). I find it very odd that the error seems to be about a standard java class (java.util.ArrayList), and as far as i know there is not a single ArrayList used either in the code for printing the report or in the report itself. Some help on fixing this problem would be greatly appreciated. Any more questions or further information that is required, please ask away. i will be monitoring my thread ofcourse. This is quite urgent. Thanks in advance, Ocketje
×
×
  • Create New...