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

mouseman

Members
  • Posts

    16
  • 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 mouseman

  1. From here: http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=42700 I've gotten the same problem. It was due to my detail band that wasn't "split allowed" and it was large. When trying to make it fit on one page, it couldn't. By selecting "split allowed" the problem is resolved. And here: http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=30160 In my case, these exceptions were being caused by uncaught exceptions being thrown from within a custom chart scriptlet referenced by the JRXML file. The chart scriptlet was throwing a NullPointerException that was not being caught or logged. This appears to send the interrupt signal to the thread that Jasper has created to perform the sub-report filling work. I tracked it down by wrapping my entire scriptlet's invocation with a try/catch Throwable and then narrowed down the offending code from there. Related bug report: http://jasperforge.org/projects/jasperreports/tracker/view.php?id=5086 Post Edited by mouseman at 07/14/2011 16:31
  2. Also of note, I created a Linux VM (Debian 6.0 64-bit) and compiled all my source and ran the report, and it did not have this error. Could it be a Windows-only problem? (Windows 7 Home Premium 64-bit.) Here is the full stack trace: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression : Source text : $F{fatigue}.getScore() at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:195) at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:589) at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:557) at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:929) at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:383) at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:368) at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:258) at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:499) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2033) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:760) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:270) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:128) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:946) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:864) at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:84) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:624) at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:901) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997) Caused by: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'com.mycompany.ws.duty.FatigueEntity@48bc9948' with class 'com.mycompany.ws.duty.FatigueEntity' to class 'com.mycompany.ws.duty.FatigueEntity' at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:327) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:602) at DutyTimeWithFatigue_1298409730226_965765.evaluate(calculator_DutyTimeWithFatigue_1298409730226_965765:229) at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:182) ... 18 more Post Edited by mouseman at 02/22/2011 20:57
  3. Hi, everyone, I have come across an interesting problem with iReport 3.7.6. I'm using a List<DutyDayEntity> as the data source (and I can report on its primitive fields with no problem). The DutyDayEntity contains a field called "fatigue" with the Field Class type of com.mycompany.ws.duty.FatigueEntity. There is a text field whose Text Field Expression is: $F{fatigue}.getScore() When I try to preview the report in iReport, it gives the following exception: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression : Source text : $F{fatigue}.getScore() at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:195) at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:589) at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:557) at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:929) [...omitting presumably uninteresting part of the exception...] Caused by: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'com.mycompany.ws.duty.FatigueEntity@d794594' with class 'com.mycompany.ws.duty.FatigueEntity' to class 'com.mycompany.ws.duty.FatigueEntity' at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:327) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:602) So it can't cast FatigueEntity to itself! Just in case it's a Groovy problem, I tried to change the Language for the report to Java. I get the corresponding exception in Java: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression : Source text : $F{fatigue}.getScore() at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:195) at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:589) at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:557) at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:929) [...omitting presumably uninteresting part of the exception...] Caused by: java.lang.ClassCastException: com.mycompany.ws.duty.FatigueEntity cannot be cast to com.mycompany.ws.duty.FatigueEntity at DutyTimeWithFatigue_1298054058267_372294.evaluate(DutyTimeWithFatigue_1298054058267_372294:253) at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:182) If I run the report from within my application (a jax-ws web service hosted within Tomcat, using JasperReports 3.7.6 to match the version of iReport), everything works fine. My conclusion is that there is some issue with how iReport is having classpath issues. Do you agree? Within iReport, I have confiured the Classpath (Tools->Options, iReport->Classpath) to have the top of the class folder for two of my own projects that include the classes (e.g. FatigueEntity and the data source). Here's another difference between iReport and my application -- iReport is getting the data through a JRAbstractBeanDataSourceProvider subclass that I've created. The code that it uses to get the List<DutyDayEntity> is pretty much the same as what the application uses; if there is a problem, I presume it would be with the DataBeanSourceProvider mechanism. Let me know if I have not included the right information. Thanks in advance for any insight you may have! Post Edited by mouseman at 02/22/2011 20:53
  4. Nevermind, I found it. There is a "Markup" property on the Text Field that can be set to html, rtf, styled, or none. Bold seems to work, but sadly not tables.
  5. Exactly how is JasperReports able to format basic HTML? I don't see any options on the Text Field. Is there an option somewhere? Does it auto-detect if the text starts with specific text similar to some swing components? (I tried, it appears not.) How basic is the text formatting? Does it do tables? Thanks a bunch!
  6. Finally got it. "/results/unchecked.gif" should have been "reports/unchecked.gif".
  7. Hi, I'm still having problems, it seems. I'm totally confused, since it seems to me like I'm doing what you are suggesting but still ... no go. I'll try to specify everything in case I missed something. Here is some code: URL unchecked = SomeClass.class.getResource("/reports/unchecked.gif"); System.err.println("unchecked is " + unchecked); if (unchecked != null) { Object content = unchecked.getContent(); System.err.println("unchecked content is of type " + content.getClass().getCanonicalName()); } InputStream inputStream = SomeClass.class.getResourceAsStream("/reports/someReport.jasper"); JasperPrint print = JasperFillManager.fillReport(inputStream, parameters, connection); Of note: this code checks to be sure that the "unchecked.gif" resource can be retrieved, so it is in the ClassPath. Here is the output from it: unchecked is jar:file:/D:/dev/SomeProject/svn/Source/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/SubProject2/WEB-INF/lib/SubProject1.jar!/reports/unchecked.gif unchecked content is of type sun.awt.image.URLImageSource net.sf.jasperreports.engine.JRException: Byte data not found at location : /results/unchecked.gif As you can see, the report and the image are both in the SubProject1.jar file, but both are demonstrated to be in the classpath and retrievable by SomeClass.class.getResource{AsStream}(). (Out of desperation, I've copied the reports folder under the web application src folder, which I verified is ending up under WEB-INF/classes, and it still isn't working.) As far as I can tell, this should work. To be explicit, here are the lines from the someReport.jrxml file used to build someReport.jasper: <variable name="chk" class="java.lang.String"> <variableExpression><![CDATA["/results/checked.gif"]]></variableExpression> </variable> <variable name="unchk" class="java.lang.String"> <variableExpression><![CDATA["/results/unchecked.gif"]]></variableExpression> </variable> [...] <image> <reportElement x="180" y="380" width="12" height="12"/> <imageExpression class="java.lang.String"><![CDATA[( $F{SOMEFIELD} == true ? $V{chk} : $V{unchk} )]]></imageExpression> </image> I'm totally confused. The only thing I can think of is that if I change the call from SomeClass.class.getResource() to ClassLoader.getSystemResource(), the resource is not found. What does JasperReports use? Running in debug mode ... in JRLoader, classLoader, urlHandlerFactory and fileResolver are all null. I see JRLoader.class is passed in to JRResourceUtil.findClassLoaderResource(). It looks like it is not used because there is a org.apache.catalina.loader.WebappClassLoader (which is part of Tomcat). Anyways, I've spent a few hours digging into and debugging WebappClassLoader, and I can't figure out what is going on. It could very well be Tomcat's fault, but I'm really not that familiar with ClassLoaders to know for sure where things are going wrong. There's one location in findResourceInternal that looks like it has the right JAR file that has the /reports/unchecked.gif, and "jarEntry = jarFiles.getJarEntry(path);" return null. If I "unzip -v SubProject1.jar", it has the file. (Not knowing for sure how the JarFile class works, if I remove the "/" from the beginning of the path, it doesn't work.) Any additional ideas would be greatly appreciated. Thanks a bunch in advance! Chris
  8. I'm new to JasperReports, too, so this is just speculation. One option might be using an applet. It could be as simple as hooking up a JViewer to read the JPrint object from a separate query back to the server. e.g. page A has a print button that starts an applet, which makes a request back to page B the server side. Page B would return just the XML: JasperExportManager.exportReportToXml(print); and then back on the client side (in the applet): // Do what you have to do to get the XML from the server as reportXml, and then ...JFrame frame = new JFrame(frameTitle);frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);try{ ByteArrayInputStream inputStream = new ByteArrayInputStream(reportXml.getBytes()); JRViewer viewer = new JRViewer(inputStream, true); frame.add(BorderLayout.CENTER, viewer); frame.setSize(1024, 748); frame.setVisible(true);}catch (JRException e1){ e1.printStackTrace();} This gives you a nice windowed preview of the report, with a convenient print button. I haven't tried this in an applet, so you might have to make some use of jarsigner ... hope you have your certificate already! Chris
  9. Thanks, I'll try that in the next couple of days. Not the ideal solution, but "crazy enough that it just might work". :) The main disadvantage will be getting the Java class (and occasional updates) deployed for everyone that will be writing reports.
  10. Hi, again, I'm running inside of Tomcat within a Jax-WS web service. The design has already been created before build time, and it includes 2 images. I have a .jasper file in one of the JAR files included in WEB-INF/lib under /reports/someReport.jasper. In the same JAR file, in the same path, there is a "checked.gif" and an "unchecked.gif" file. I am unable to be able to get the fillReport method variations to load and display all 3 files in any acceptable way. Here is what I've tried: 1. Full path. This was an accident, and it worked ... on my development machine only. I specified D:\dev\SomeProject\svn\Source\SubProject2\reports\someReport.jasper. However, the staging and live environments have totally different paths (they are Linux boxes). Also, when deployed, these files don't exist as files on disk, they are in .JAR files. String jasperFile = "D:\\dev\\SomeProject\\svn\\Source\\SubProject2\\reports\\SomeReport.jasper";JasperPrint print = JasperFillManager.fillReport(jasperFile, parameters, connection); 2. Load the report as a resource. This works for the report portion only on dev, stage and production machines. However, the images do not load. I think I get a JRException saying "Byte data not found at location : /results/unchecked.gif". InputStream inputStream = SomeClass.class.getResourceAsStream("/reports/someReport.jasper");JasperPrint print = JasperFillManager.fillReport(inputStream, parameters, connection); I thought of trying to set a FileResolver in addition to this, but in production, the graphics files only exist in the JARs. 3. Just specifying the path within the JAR file, which sounded plausible based on what this guy says in #1 - but I get a FileNotFoundException. Note I've also tried without the leading "/". JasperPrint print = JasperFillManager.fillReport("/reports/someReport.jasper", parameters, connection); 4. I went down the path of trying URLs instead of filenames, but that didn't work. I would love to specify: // Does not compile - just for demonstration purposesjava.net.URL reportResourceURL = SomeClass.class.getResource("/reports/someReport.jasper");JasperPrint print = JasperFillManager.fillReport(reportResourceURL, parameters, connection); So if you have any ideas for how to get images loading when the report and images the report include are in a JAR file, I'd love to hear them. Thanks so much in advance.
  11. Thanks for your response. I was hoping there was something within the JasperReports framework to make things simpler for formatting text. Writing a large snippet of Java-like code in every text field expression is doable for me personally (with a development background) although time consuming and cumbersome; for the business users with a little technical knowledge it would probably be overwhelming. From what I've seen in the documentation, what I'm looking for would probably fall more under the category of a feature request. I just wanted to verify that there is no facility that would at least help out, such as: * A way to define a macro or function so it is not necessary to reproduce the entire line posted above (or something more complicated to account for other cases) in every field (say 40 or 50 on a single report, on multiple reports). It would be even better if macro definitions could be simply included in a report. * Some other built-in mechanism to format text strings (which you seem to be saying is outside of the scope of JasperReports) * I have seen there are Scriptlets (actual Java classes that can add functions), which might be okay for a long term solution (though I'm still reading up on them), but it looks like it will require installing (and keeping up to date) a copy of the appropriate classes on every client that works on writing reports. Thanks so much. (Edited to fix up Quick Edit lack of formatting.) Post Edited by mouseman at 08/28/2009 14:23
  12. I am using JasperReports with a report designed in iReport. Both are version 3.5.3. I have successfully implemented display in a Java Swing desktop application, with the compile and fill stages done on a web server (and the resulting serialized JasperPrint passed to the Swing application through SOAP via JAX-WS) with dating coming from a JDBC database. I was pleased that Jasper Reports provided the ability to pretty much do each of the steps (Design, Compile, Fill, View, and Export) on any of the tiers I wanted! Really, the whole infrastructure JUST WORKED! My problem is that I have fields in reports that represent phone numbers. In the database, the phone numbers are stored as strings of 10 digits (unless not specified, in which case they might be empty or NULL). I will use 9876543210 as the example. I want to be able to format them in the report. The example would look like this: (987) 654-3210 The only way I can come up with doing this was this formula for the "Text Field Expression" field in iReport: "(" + $F{PERSONALCELL}.substring(0,3) + ") " + $F{PERSONALCELL}.substring(3,6) + "-" + $F{PERSONALCELL}.substring(6,10) (The "Blank When Null" field seems to save me from NPEs, but I'm not sure what happens if there is a field with only 8 characters.) This is a bit ugly, especially since I have hundreds of phone fields in all of the reports. It would be nice if there were something a bit cleaner. I've looked at String.format(), but it doesn't seem appropriate. Is there anything else? I'm converting this from a Microsoft Access application (which I've never really used before). In Access, the fields were formatted with an "Input Mask" of: !\(999") "000\-0000;;_ I'm hoping there is something that would be equally easy for JasperReports. Thanks in advance! ETA: I forgot to mention there is a related discussion here: http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=2441 Post Edited by mouseman at 08/27/2009 16:09
×
×
  • Create New...