Please Help Me Get Servoy 5.2.2 working with JasperPlugin...

I’ll buy beer, an hour of consulting, whatever it takes to get Servoy 5.2.2 working with the JasperPlugin. From what I’ve been told, I need to use the JasperPlugin when it was in version 3.0, prior to being moved from http://code.google.com/p/servoy-jasperreports-plugin/ to ServoyForge. I’m doing that, and even got the jar self-signed to make it work in the modern age of Java, but I cannot get it to launch my JasperReports that worked when I was running 5.2.8.

(running 5.2.2 due to a bug we cannot reproduce for servoy support having to do with related radio buttons).

Help? Thanks in advance… I’m down to the wire on a deadline that cannot be moved.

ellen

First, you need to breathe :)

Then try clearing your servoy_log.txt. then launch Servoy and try your call to jasperReport();

Now check the log, you should have some exceptions in there. What are they?
Please post them here.

You might want to add a fifth null parameter to your call.

Looking at the sources, indeed I see 5 or 6 parameters…
The 5th parameter is supposed to be an argument array to pass to the report, and 6th is a locale.

So you can pass null as a 5th argument to jasperReport() or runReport() but not less than 5 arguments.

Any success on this?
Ensure that you have removed the previous jasper report plugin jars if you are reverting.
What is the error again?
I still run the jasper reports plugin version 3.0 for Servoy 3.5.12 on one client.
Perhaps some of the jars need to be of the correct vintage?
What version of the jasperreports jar file is in use?
What version of the iReport did you use to create the report and would that be incompatible with the jasper reports jar file?
For example for the jasperreports plugin version 3.0 I use jasperreports-3.6.0,jar and this is also specified in the jnlp file.
Are you able to post the code to call the runReport such as this debug snippet that I use: (where local is an optional parameter):

try {
      var result = plugins.jasperPluginRMI.runReport(serverName, reportName, varOutput, outputFormat, reportParameters, locale );//result is a byte array
} catch (e) {
 	msg = "PITC_printJasperReport: DEBUG: Exception from plugin: "
	if (e == undefined) {
		msg += "exception 'e' is undefined";
	}
	else if (e.message == undefined){
		msg += "exception message is undefined";
	}
	else {
		msg += "message: <" + e.message + ">";
	}

	application.output(	msg );
     
}

Hi guys… Thanks so much for helping here. Definitely getting fatigued.

So today I’ve battered on 5.2.2 with the 3.0 plugin, and also with the 3.2 plugin, then the 3.3beta plugin, and changed everything seven different ways (from calling jasperReport to runReport, ‘view’ to OUTPUT.FORMAT.VIEW, etc). I am about to give up on 5.2.2, though…

But here’s the 5.2.2 function with Jasper 3.0 plugin and the ensuing error:

function DemoJasper(event) {
	var Version = plugins.jasperPluginRMI.pluginVersion
	var Directory = plugins.jasperPluginRMI.reportDirectory
        var params = new java.util.HashMap();
        params.put('PayID',4533);
        application.updateUI(); //to make sure the Servoy window doesn't grab focus after showing the Jasper Viewer
        plugins.jasperPluginRMI.runReport(forms.AdminScreen.connex,'crvoucher.jasper', null,'view', params, 'en');
        application.updateUI(); //to make sure the Servoy window doesn't grab focus after showing the Jasper Viewer
2011-12-07 15:46:32,375 ERROR [AWT-EventQueue-0] com.servoy.j2db.util.Debug - Throwable
org.mozilla.javascript.WrappedException: Wrapped java.lang.Exception: Unknown hyperlink target 0 (C:\Users\Meserow\servoy_workspace\PRISM\forms\AdminScreen.js#368)
	at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1828)
	at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:199)
	at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:353)
	at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3666)
	at script.DemoJasper(C:\Users\Meserow\servoy_workspace\PRISM\forms\AdminScreen.js:368)
	at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2680)
	at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:166)
	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:387)
	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3127)
	at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:165)
	at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:458)
	at com.servoy.j2db.debug.RemoteDebugScriptEngine.executeFunction(RemoteDebugScriptEngine.java:382)
	at com.servoy.j2db.FormController.executeFunction(FormController.java:3972)
	at com.servoy.j2db.FormController.executeFunction(FormController.java:3860)
	at com.servoy.j2db.FormController.executeFunction(FormController.java:3782)
	at com.servoy.j2db.FormController$ScriptExecuter.executeFunction(FormController.java:3637)
	at com.servoy.j2db.ui.BaseEventExecutor.fireEventCommand(BaseEventExecutor.java:270)
	at com.servoy.j2db.ui.BaseEventExecutor.fireActionCommand(BaseEventExecutor.java:217)
	at com.servoy.j2db.ui.BaseEventExecutor.fireActionCommand(BaseEventExecutor.java:212)
	at com.servoy.j2db.smart.dataui.AbstractScriptButton$2.actionPerformed(AbstractScriptButton.java:826)
	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.awt.EventQueue.access$000(Unknown Source)
	at java.awt.EventQueue$1.run(Unknown Source)
	at java.awt.EventQueue$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue$2.run(Unknown Source)
	at java.awt.EventQueue$2.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.Exception: Unknown hyperlink target 0
	at com.servoy.plugins.jasperreports.JasperReportsProvider.runReport(JasperReportsProvider.java:429)
	at com.servoy.plugins.jasperreports.JasperReportsProvider.js_runReport(JasperReportsProvider.java:290)
	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 org.mozilla.javascript.MemberBox.invoke(MemberBox.java:179)
	... 53 more

And in 5.2.11 with Jasper 3.3.0b1 this:

function DemoJasper(event) {
var Version = plugins.jasperPluginRMI.pluginVersion
var Directory = plugins.jasperPluginRMI.reportDirectory
var params = new java.util.HashMap();
params.put('PayID',4533);
application.updateUI(); //to make sure the Servoy window doesn't grab focus after showing the Jasper Viewer
plugins.jasperPluginRMI.runReport(connex,'crvoucher.jrxml',null,OUTPUT_FORMAT.VIEW,params,'en');
application.updateUI(); //to make sure the Servoy window doesn't grab focus after showing the Jasper Viewer
}

And the result is this in my servoy_log.txt:

2011-12-07 15:23:09,706 WARN [RMI TCP Connection(15)-146.129.24.83] com.servoy.j2db.util.Debug - Throwable
java.lang.NullPointerException
	at java.lang.Class.isAssignableFrom(Native Method)
	at net.sf.jasperreports.engine.fill.JRFillTextField.getFormat(JRFillTextField.java:706)
	at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:394)
	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.JRFillFrame.evaluate(JRFillFrame.java:147)
	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.fillTitle(JRVerticalFiller.java:326)
	at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:262)
	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:845)
	at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:58)
	at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417)
	at com.servoy.plugins.jasperreports.JasperReportRunner.getJasperPrint(JasperReportRunner.java:339)
	at com.servoy.plugins.jasperreports.JasperReportsServer.getJasperPrint(JasperReportsServer.java:262)
	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 sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
	at sun.rmi.transport.Transport$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Unknown Source)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

Sorry Tom – Didn’t see your post until just now…

To your questions:

Any success on this?
Ensure that you have removed the previous jasper report plugin jars if you are reverting.
What is the error again?
I still run the jasper reports plugin version 3.0 for Servoy 3.5.12 on one client.
Perhaps some of the jars need to be of the correct vintage?
What version of the jasperreports jar file is in use?
What version of the iReport did you use to create the report and would that be incompatible with the jasper reports jar file?
For example for the jasperreports plugin version 3.0 I use jasperreports-3.6.0,jar and this is also specified in the jnlp file.
Are you able to post the code to call the runReport such as this debug snippet that I use: (where local is an optional parameter):

I am testing the jasper version and report directory each time I run, and getting 3.0 when I expect 3.0 and 3.3.0b1 when I expect that:

var Version = plugins.jasperPluginRMI.pluginVersion
var Directory = plugins.jasperPluginRMI.reportDirectory

Is that enough to verify the vintage? I have downloaded and redownloaded every version (never Advanced, always Basic and Chart and Script), including the ones I’m using I downloaded today. I remove the jar, jnlp, and folder of jars each time, and put the new ones in the plugins folder. The folder is still a folder, and still named the way it came – nothing stupid like that happening…

The version of iReport is iReport Pro 4.2.1 from JasperSoft. I’ve made the plugin run before with an iReport I created in the free edition. Is that related?

I used your code snippet and get the same error the log gives: PITC_printJasperReport: DEBUG: Exception from plugin: message: <java.lang.Exception: null>
I changed your snippet as follows:

try {
var params = new java.util.HashMap();
params.put('PayID',4533);
      var result = plugins.jasperPluginRMI.runReport(connex, 'crvoucher.jrxml', null, OUTPUT_FORMAT.VIEW, params, 'en' );//result is a byte array
} catch (e) {
   msg = "PITC_printJasperReport: DEBUG: Exception from plugin: "
   if (e == undefined) {
      msg += "exception 'e' is undefined";
   }
   else if (e.message == undefined){
      msg += "exception message is undefined";
   }
   else {
      msg += "message: <" + e.message + ">";
   }

   application.output(   msg );
     
}

Got 5.2.11 working with Jasper, by just using a report written in iReport Free that has no parameters (sent same string with params, but the report doesn’t ask for them):
plugins.jasperPluginRMI.runReport(connex,‘DEMOreport.jrxml’,null,OUTPUT_FORMAT.VIEW,params,‘en’);

Same command from 5.2.2 with the OUTPUT_FORMAT converted to the old school jasper plugin 3.0 ‘view’ doesn’t do anything, no error, nothing runs, no error in the servoy_log.txt:
plugins.jasperPluginRMI.runReport(forms.AdminScreen.connex,‘DEMOreport.jrxml’, null,‘view’, params, ‘en’);

Sorry for not replying earlier we had a power outage here.
Note that using a jasper report made with iReport (Pro or the free version) may have dependencies on the jasper soft reports jar file version.
The servoy jasper reports plugin for 3.0.0 may not be able to use reports made with iReport later than 3.7.1 (not sure if that is quite correct but that vintage anyway).
So try to see if the report can be regenerated (the .jasper) from the iReport suitable for the servoy jasper reports plugin that is installed.

It appears that you have an iReport error cropping up for your 5.2.11 and Jasper 3.3.0b1:

2011-12-07 15:23:09,706 WARN [RMI TCP Connection(15)-146.129.24.83] com.servoy.j2db.util.Debug - Throwable
java.lang.NullPointerException
at java.lang.Class.isAssignableFrom(Native Method)
at net.sf.jasperreports.engine.fill.JRFillTextField.getFormat(JRFillTextField.java:706)

If you do not have an error in the report itself you may have another jar file incompatibility. Now this is a guess, but maybe you have not got the correct iText jar file for the plugin that you are using.
You will have to ensure that there is no other iText.jar file in the plugins folder anywhere other than the servoy jasper reports plugin folder.

I also notice that you specify the .jrxml file as the report file to use. This would mean that the plugin has to compile it to .jasper. To do this it uses the jasperreports.jar file specified in the servoyjasper reports folder.
By compiling it yourself in the iReport (copy the resulting .jasper file to the folder where normally the .jrxml file is located == plugins.jasperPluginRMI.reportDirectory) then you will know exactly which version is being used.
Try to compile it yourself to .jasper and invoke as:

var result = plugins.jasperPluginRMI.runReport(connex,'crvoucher.jasper',null,OUTPUT_FORMAT.VIEW,params,'en');

Tried is as .jasper (they are pre-compiled in the reports directory) but same error. Thanks so much for staying with this…

Since you have passed your deadline and are using servoy 5.2.11 now do you still need to continue investigation?
If so give me a pm.

BTW, I did find a second iText.jar in my Servoy installation. Removed it, restarted, but still same error situation. Can still launch my iReport that I wrote in iReport 4.0.2 free edition, and so I opened it in 4.2.1 iReport Pro and saved it as a diff name, tried that, still opens fine. Tried a version of the other report that has no parameters, still no go.

But perhaps you do need to pass into the plugin the parameter map even if it is empty? Or contains different data - it could be that it expects some reference even if dummy data.
Also ensure that you are using the correct iReport language: Java vs Groovy for the report without parameters.

Hrmm passing blank params works fine… Here’s the current status of the prob:

viewtopic.php?f=15&t=16751&p=93869#p93869