jasper reports plugin NoSuchMethodError

I’m really stumped by this - I have one report that runs fine in ireport but not using the plugin:

java.lang.NoSuchMethodError: org.mozilla.javascript.ContextFactory.enterContext()Lorg/mozilla/javascript/Context;

All other reports created with ireport 3.7.1 run fine, just this report has a problem and it doesn;t really do anything special. It seems most of these errors are a result of jar problems, but I don’t think that’s the problem with just one report.

Any ideas?

where does that error really come from?
Do you have a full stacktrace?

problem is that the rhino lib we use (1.6R7) doesnt have a ContextFactory.enterContext()
So that is compiled against a new version of rhino (1.7Rx)
That is a problem and cant be easily fixed because in servoy itself we cant have the newer rhino and that ireport will not work against a older rhino

You could ask them to not use 1.7 api of rhino

Thanks, but how do I keep iReport from not using 1.7 api of rhino? Here’s the stacktrace:

ERROR - Debug                      - Throwable
java.rmi.ServerError: Error occurred in server thread; nested exception is: 
	java.lang.NoSuchMethodError: org.mozilla.javascript.ContextFactory.enterContext()Lorg/mozilla/javascript/Context;
	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)
	at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
	at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
	at sun.rmi.server.UnicastRef.invoke(Unknown Source)
	at com.servoy.plugins.jasperreports.JasperReportsServer_Stub.getJasperPrint(Unknown Source)
	at com.servoy.plugins.jasperreports.JasperReportsProvider.runReport(JasperReportsProvider.java:381)
	at com.servoy.plugins.jasperreports.JasperReportsProvider.js_runReport(JasperReportsProvider.java:305)
	at com.servoy.plugins.jasperreports.JasperReportsProvider.js_runReport(JasperReportsProvider.java:302)
	at com.servoy.plugins.jasperreports.JasperReportsProvider.js_runReport(JasperReportsProvider.java:298)
	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)
	at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:353)
	at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:81)
	at org.mozilla.javascript.gen.c105._c0(gprintjasperreport:4109)
	at org.mozilla.javascript.gen.c105.call(gprintjasperreport)
	at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:65)
	at org.mozilla.javascript.gen.c147._c0(btn_ok:234)
	at org.mozilla.javascript.gen.c147.call(btn_ok)
	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:387)
	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3127)
	at org.mozilla.javascript.gen.c147.call(btn_ok)
	at com.servoy.j2db.scripting.Ztb.executeFunction(Ztb.java:196)
	at com.servoy.j2db.Zwb.Za(Zwb.java:741)
	at com.servoy.j2db.Zwb.Za(Zwb.java:1223)
	at com.servoy.j2db.Zcc.Za(Zcc.java:1)
	at com.servoy.j2db.ui.BaseEventExecutor.fireEventCommand(BaseEventExecutor.java:27)
	at com.servoy.j2db.ui.BaseEventExecutor.fireEventCommand(BaseEventExecutor.java:18)
	at com.servoy.j2db.ui.BaseEventExecutor.fireActionCommand(BaseEventExecutor.java:16)
	at com.servoy.j2db.dataui.Zh.mouseReleased(Zh.java:2)
	at java.awt.AWTEventMulticaster.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.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.NoSuchMethodError: org.mozilla.javascript.ContextFactory.enterContext()Lorg/mozilla/javascript/Context;
	at net.sf.jasperreports.compilers.JavaScriptEvaluator.customizedInit(JavaScriptEvaluator.java:231)
	at net.sf.jasperreports.engine.fill.JREvaluator.init(JREvaluator.java:83)
	at net.sf.jasperreports.engine.fill.JRCalculator.init(JRCalculator.java:95)
	at net.sf.jasperreports.engine.fill.JRFillDataset.initCalculator(JRFillDataset.java:428)
	at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:570)
	at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:74)
	at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:56)
	at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:143)
	at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:53)
	at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417)
	at com.servoy.plugins.jasperreports.JasperReportRunner.getJasperPrint(JasperReportRunner.java:297)
	at com.servoy.plugins.jasperreports.JasperReportsServer.getJasperPrint(JasperReportsServer.java:214)
	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)
Exception Object: java.lang.Exception: Error occurred in server thread; nested exception is: 
	java.lang.NoSuchMethodError: org.mozilla.javascript.ContextFactory.enterContext()Lorg/mozilla/javascript/Context;
MSG: Error occurred in server thread; nested exception is: 
	java.lang.NoSuchMethodError: org.mozilla.javascript.ContextFactory.enterContext()Lorg/mozilla/javascript/Context;

msedita:
Thanks, but how do I keep iReport from not using 1.7 api of rhino? Here’s the stacktrace:

contact the makers of iReport, aks them if they can compile against 1.6 api.

Is Servoy going to switch to version 1.7 of rhino in the near future? Last 1.6 version dates back to 2007.

possible but that will not be sooner then Servoy 6.
We want to wait for 1.7R3 if possible for all the latest features that we then can use later on.

Okay, but for running servoy 5.1 (or 5.2) do we need an adjusted version of iReport or an adjusted version of the jasperreports plugin? Does this happen with some (which?) reports created by iReport and presented to the plugin as a .jrxml-file (compiled by the plugin) or as .jasper-file (compiled by iReport)?

i think it is in the engine of jasper itself:

at net.sf.jasperreports.compilers.JavaScriptEvaluator.customizedInit(JavaScriptEvaluator.java:231)

thats the one that is calling the new rhino code as far as i can see in the stack trace.

i just downloaded it jasperreports from here:

http://jasperforge.org/

and yes the latest version i tried 3.7.4 does shipd the rhino1.7R1 lib.

So somebody should ask them if they can be backwards compatible for a while more to the 1.6 release (they just need to change enterContext() to enter())

For what kind of reports do we encounter this problem. Only for reports with Language JavaScript?

yes this is when you use javascript, then they will use rhino.

I guess if you use the server to generate that report (so client is really not fixable)
there could be an option to get that working, but the server side version of the plugin would then be way harder to configure right.
Because jasperreports and all its support libs must be in another location then server/plugins and then the server side plugin should
load all those libs (including the rhino17r1 jar) in a Classloader (that has the system classloader as parent, so nothing of servoy)
and then execute/run jasper from that. So that jasper reports on the server is completely isolated from the rest of servoy.