evaluat0r Posted December 26, 2012 Share Posted December 26, 2012 Hi! I have problems getting the xmldatasource sample project running with Jython.This is my code: #!/usr/bin/jython """ - cd buildEnv/xmldatasource; ant javac - cd buildEnv/xmldatasource/build/classes; jar -cf xmldatasource.jar XmlDataSourceApp.class - copy buildEnv/xmldatasource/build/classes/xmldatasource.jar to deploy/lib/xmldatasource.jar""" import osimport sys cwd = os.path.realpath(".") sys.path.extend([cwd + '/lib/xmldatasource.jar'])sys.path.extend([cwd + '/lib/jasperreports-5.0.0.jar'])sys.path.extend([cwd + '/lib/ant-1.7.1.jar'])sys.path.extend([cwd + '/lib/antlr-2.7.5.jar'])sys.path.extend([cwd + '/lib/barbecue-1.5-beta1.jar'])sys.path.extend([cwd + '/lib/barcode4j-2.1.jar'])sys.path.extend([cwd + '/lib/batik-anim.jar'])sys.path.extend([cwd + '/lib/batik-awt-util.jar'])sys.path.extend([cwd + '/lib/batik-bridge.jar'])sys.path.extend([cwd + '/lib/batik-css.jar'])sys.path.extend([cwd + '/lib/batik-dom.jar'])sys.path.extend([cwd + '/lib/batik-ext.jar'])sys.path.extend([cwd + '/lib/batik-gvt.jar'])sys.path.extend([cwd + '/lib/batik-parser.jar'])sys.path.extend([cwd + '/lib/batik-script.jar'])sys.path.extend([cwd + '/lib/batik-svg-dom.jar'])sys.path.extend([cwd + '/lib/batik-svggen.jar'])sys.path.extend([cwd + '/lib/batik-util.jar'])sys.path.extend([cwd + '/lib/batik-xml.jar'])sys.path.extend([cwd + '/lib/bcel-5.2.jar'])sys.path.extend([cwd + '/lib/bsh-2.0b4.jar'])sys.path.extend([cwd + '/lib/castor-1.2.jar'])sys.path.extend([cwd + '/lib/commons-beanutils-1.8.0.jar'])sys.path.extend([cwd + '/lib/commons-collections-2.1.1.jar'])sys.path.extend([cwd + '/lib/commons-digester-2.1.jar'])sys.path.extend([cwd + '/lib/commons-javaflow-20060411.jar'])sys.path.extend([cwd + '/lib/commons-logging-1.1.1.jar'])sys.path.extend([cwd + '/lib/dom4j-1.6.1.jar'])sys.path.extend([cwd + '/lib/groovy-all-2.0.1.jar'])sys.path.extend([cwd + '/lib/hibernate3.jar'])sys.path.extend([cwd + '/lib/hsqldb-1.8.0-10.jar'])sys.path.extend([cwd + '/lib/iText-2.1.7.js1.jar'])sys.path.extend([cwd + '/lib/jackson-annotations-2.0.5.jar'])sys.path.extend([cwd + '/lib/jackson-core-2.0.5.jar'])sys.path.extend([cwd + '/lib/jackson-databind-2.0.5.jar'])sys.path.extend([cwd + '/lib/jaxen-1.1.1.jar'])sys.path.extend([cwd + '/lib/jcommon-1.0.15.jar'])sys.path.extend([cwd + '/lib/jdt-compiler-3.1.1.jar'])sys.path.extend([cwd + '/lib/jfreechart-1.0.12.jar'])sys.path.extend([cwd + '/lib/jpa.jar'])sys.path.extend([cwd + '/lib/jxl-2.6.10.jar'])sys.path.extend([cwd + '/lib/log4j-1.2.15.jar'])sys.path.extend([cwd + '/lib/mondrian-3.1.1.12687.jar'])sys.path.extend([cwd + '/lib/png-encoder-1.5.jar'])sys.path.extend([cwd + '/lib/poi-3.7-20101029.jar'])sys.path.extend([cwd + '/lib/poi-ooxml-3.7-20101029.jar'])sys.path.extend([cwd + '/lib/poi-ooxml-schemas-3.7-20101029.jar'])sys.path.extend([cwd + '/lib/rhino-1.7R3.jar'])sys.path.extend([cwd + '/lib/saaj-api-1.3.jar'])sys.path.extend([cwd + '/lib/serializer.jar'])sys.path.extend([cwd + '/lib/servlet-api-2.4.jar'])sys.path.extend([cwd + '/lib/spring-beans-2.5.5.jar'])sys.path.extend([cwd + '/lib/spring-core-2.5.5.jar'])sys.path.extend([cwd + '/lib/velocity-1.7-dep.jar'])sys.path.extend([cwd + '/lib/xalan-2.7.1.jar'])sys.path.extend([cwd + '/lib/xbean.jar'])sys.path.extend([cwd + '/lib/xercesImpl-2.9.0.jar'])sys.path.extend([cwd + '/lib/xml-apis-ext.jar'])sys.path.extend([cwd + '/lib/xml-apis.jar']) import XmlDataSourceApp from java import utilimport java.io as javaio properties = util.Properties()propertiesfis =javaio.FileInputStream("jasperreports.properties") properties.load(propertiesfis) javaObj = XmlDataSourceApp() javaObj.fill() As you see, all the dependencies should be load. When i try to call the fill() method, i receive the following error: log4j:WARN No appenders could be found for logger (net.sf.jasperreports.extensions.ExtensionsEnvironment). log4j:WARN Please initialize the log4j system properly. Traceback (innermost last): File "java.py", line 84, in ? at net.sf.jasperreports.engine.util.JRQueryExecuterUtils.getExecuterFactory(JRQueryExecuterUtils.java:114) at net.sf.jasperreports.engine.fill.JRFillDataset.createQueryDatasource(JRFillDataset.java:1082) at net.sf.jasperreports.engine.fill.JRFillDataset.initDatasource(JRFillDataset.java:667) at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:1258) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:877) at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:126) at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:464) at net.sf.jasperreports.engine.JasperFillManager.fillToFile(JasperFillManager.java:249) at net.sf.jasperreports.engine.JasperFillManager.fillToFile(JasperFillManager.java:155) at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:678) at XmlDataSourceApp.fill(XmlDataSourceApp.java:132) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRRuntimeException: No query executer factory registered for the 'xPath' language. I run this code simply with jython java.py. I think the code isnt work but I dont know how to set the properties correctly. According to the sample project, the property must be set as the following: net.sf.jasperreports.xpath.executer.factory=net.sf.jasperreports.engine.util.xml.JaxenXPathExecuterFactory But how if using Jython? thank you! Link to comment Share on other sites More sharing options...
evaluat0r Posted December 27, 2012 Author Share Posted December 27, 2012 Is it possible to register the xpath factory in this code? Link to comment Share on other sites More sharing options...
evaluat0r Posted January 4, 2013 Author Share Posted January 4, 2013 hi! i found a way to solve this problem using PY4J instead of Jython. cheerio! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now