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

xen0

Members
  • Posts

    8
  • Joined

  • Last visited

xen0's Achievements

Apprentice

Apprentice (3/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. I'm trying to export a report programmatically using JasperCompileManger, JasperFillManager, and JRPdfExporter JasperFillManager.fillReport()'s third parameter is a Connection object which I'm trying to set up using the methods getConnectionUrl(), getUsername(), and getPassword of the class com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.client.JdbcReportDataSourceImpl as follows Code: JdbcReportDataSourceImpl jdbc_datasource = new JdbcReportDataSourceImpl(); Connection conn = (Connection) DriverManager.getConnection( jdbc_datasource.getConnectionUrl() + "?" + "user=" + jdbc_datasource.getUsername() + "&password=" + jdbc_datasource.getPassword() . . . JasperFillManager.fillReport(report, params, conn); ); Obviously just constructing a JdbcReportDataSourceImpl object with it's default constructor doesn't do anything but give a visual to my goal. So, my question is how do I get a JdbcReportDataSourceImpl object with respect to a certain report. i.e. Can I pass a report unit uri or ReportUnit object to some function which will return to me something like a JdbcReportDataSourceImpl object so I can use the getConnectionUrl(), getUsername(), getPassword() to create the Connection? Or is there an even cleaner way, something like Connection getConnectionOfReportUnit(ReportUnit ru)? Thanks in advance
  2. I'm writing a repository service in Java. Currently I'm trying to export a report to (pdf|xls|rtf ... etc), I do so by calling the following three methods. Code: JasperCompileManager.compileReport() JasperFillmanager.fillReport() JrPdfExporter.exportReport() (full code below) When fillReport() is called I get the following error Code:[code] net.sf.jasperreports.engine.JRException: Byte data not found at location : repo:/images/JRLogo (full call stack below) The report I'm trying to export is /reports/samples/AllAccounts The error involves the image at repo:/images/JRLogo, naturally the first thing I did was looked in the database at the jifileresource table's data attribute of the image. My hopes were that this would be empty or faulty, which was NOT the case. The image displayed perfectly. Next I checked the repository at localhost:8080/jasperserver. When I'm in 'view repository' mode and navigate to the /images/ 'folder' JRLogo IS NOT display. If I switch to 'Manage Repository' JRLogo IS displayed. Next I thought I may not have read permissions for that image, so I clicked on 'Assign Permissions' where I set the permissions as follows: ROLE_USER -> Read Only * ROLE_ADMINISTRATOR -> Administer * ROLE_ANONYMOUS -> Read Only However, this didn't solve the problem. Any help or insight is appreciated Complete code: Code:[code] JRPdfExporter pdfexporter = new JRPdfExporter(); HashMap map = new HashMap(); /* getReportUnitPath returns a String, the absolute path on disk to a temporary JRXML file. */ JasperReport report = JasperCompileManager.compileReport(getReportUnitPath("/reports/samples/AllAccounts", null)); JasperPrint print = JasperFillManager.fillReport(report, map); pdfexporter.setParameter(JRExporterParameter.JASPER_PRINT, print); File exported_temp_file = File.createTempFile("test", ".pdf"«»); pdfexporter.setParameter(JRExporterParameter.OUTPUT_FILE, exported_temp_file); pdfexporter.exportReport(); return exported_temp_file.getAbsolutePath(); Complete Call Stack: Code:[code] net.sf.jasperreports.engine.JRException: Byte data not found at location : repo:/images/JRLogo at net.sf.jasperreports.engine.util.JRLoader.loadBytesFromLocation(JRLoader.java:467) at net.sf.jasperreports.engine.JRImageRenderer.getInstance(JRImageRenderer.java:175) at net.sf.jasperreports.engine.fill.JRFillImage.evaluateImage(JRFillImage.java:479) at net.sf.jasperreports.engine.fill.JRFillImage.evaluate(JRFillImage.java:428) at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:275) at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:426) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillTitle(JRVerticalFiller.java:311) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:149) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:891) at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:123) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:420) at jasperscheduler.RepositoryBrowser.test(RepositoryBrowser.java:220)
  3. I'm writing a jasper server web app with php using the php/Java Bridge I want to be able to click on a Content Resource link in browser which results in displaying the report in browser, in pdf format, for example. It should also allow all other formats to be viewed. What are the steps to do this? Any help is appreciated.
  4. To help me understand how the scheduler works, I am trying to create my own scheduler similar to the unit test found here: com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.ReportSchedulingTest When I try to get the reportJobsPersistenceService bean I'm getting errors: Code: INFO: Loading XML bean definitions from class path resource [test.hibernate.jdbc.properties] Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 1 in XML document from class path resource [test.hibernate.jdbc.properties] is invalid; nested exception is org.xml.sax.SAXParseException: Content is not allowed in prolog. Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source) at org.apache.xerces.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:76) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:340) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:317) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:125) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:141) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:167) at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113) at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:79) at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:94) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:292) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:92) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:77) at jasperscheduler.JobScheduler.<init>(JobScheduler.java:72) at jasperscheduler.JobScheduler.main(JobScheduler.java:201) Java Result: 1 Looking up the trace you can see "Unknown Source". I guess the question to help solve this is what is this "unknown source", a database? the jrxml? Also the second line may be a clue to this, I searched "Content is not allowed in prolog." in this forum and someone suggested that the first line of the problem file needs to have the following: <?xml version="1.0" encoding="UTF-8"?> But if this is the case, what file could be the problem file?... All of my xml files used by the Spring framework have this as the first line, as does the jrxml file I'm trying to use. Thanks
  5. Am I correct when saying this scheduler can not export reports to disk? That it writes the byte data of the output format to the database? That being true if I wanted this functionality I would need to write my own scheduler? Thanks
  6. I have been looking through the jasperserver source code for a way to schedule a job. I want to do so through the php/Java bridge, so I'm looking for a way to call the scheduling code directly. All I could find was Java Interfaces. Are these interfaces implemented anywhere? How does the jsp server on tomcat schedule jobs? Thanks in advance
  7. I have fixed this issue... I needed to install the following apache commons packages: commons-1.1.1 commons-digester-1.8 commons-collections-3.2 and remove log4j-<VERSION>.jar, and commons-digester-1.7 from lib.
  8. I'm trying to create a web app with the php/Java bridge. In this problem, I'm trying to simply compile a report for starters, but receiving exceptions from the second line below: Code: $sJcm = new JavaClass("net.sf.jasperreports.engine.JasperCompileManager"«»); $report = $sJcm->compileReport($reportsPath .$reportFileName.".jrxml"«»); The exception reported follows: java stack trace: [o(ByteArrayOutputStream):"java.lang.Exception: Invoke failed: [c(JasperCompileManager)]->compileReport((String)o(String)). Cause: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@17ed710 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Logger) (Caused by org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@17ed710 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Logger)) Responsible VM: 1.6.0_03@http://java.sun.com/ at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543) at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235) at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:370) at org.apache.commons.digester.Digester.(Digester.java:346) at net.sf.jasperreports.engine.xml.JRXmlDigester.(JRXmlDigester.java:62) at net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.createDigester(JRXmlDigesterFactory.java:975) at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:203) at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:168) at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:152) at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:151) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at php.java.bridge.JavaBridge.Invoke(JavaBridge.java:1114) at php.java.bridge.Request.handleRequest(Request.java:342) at php.java.bridge.Request.handleRequests(Request.java:388) at php.java.bridge.http.ContextRunner.run(ContextRunner.java:188) at php.java.bridge.BaseThreadPool$Delegate.run(BaseThreadPool.java:66) Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@17ed710 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Logger) (Caused by org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@17ed710 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Logger)) ... 19 more Caused by: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@17ed710 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Logger) at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:413) at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529) ... 18 more Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Logger at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Unknown Source) at java.lang.Class.getConstructor0(Unknown Source) at java.lang.Class.getConstructor(Unknown Source) at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:410) ... 19 more "] Does anyone have and ideas what this could be? I've experienced a similar problem with JdbcConnection... I had to include the jar into the lib and it solved the problem, however, with this error I have the logging jars in my lib. Thanks in advance...
×
×
  • Create New...