Project

General

Profile

Defect #1602

protocol error on getPDFReport(template, context)

Added by Adrian McGilly 2 months ago. Updated 2 months ago.

Status:
Closed
Priority:
Normal
Category:
velocity
Target version:
Start date:
09/11/2025
Due date:
% Done:

0%

Estimated time:
Browser (if web client):

Description

Bonjour Patrick j'espere que tout va bien avec toi dans mon home town de Montreal!

Robert Ivens and I are working on some code using VelocityReports 3.9.6 with Servoy 2024.3.7

The following command:

plugins.VelocityReport.getPDFReport("<html><head></head><body>#foreach ($row in $data) $row.po_num #end</body></html>",{data : forms.hauls_tbl.foundset})

is returning null and producing the following error:

Exception, see log file for full details: no protocol: null<html><head></head><body>#foreach ($row in $data) $row.po_num #end</body></html>

This is happening both in Developer on Windows & Mac and on a deployed WAR file on Mac and in both NG Client (Browser, Chrome) and NG Desktop

More info:

If I run evaluateWithContext with the same params:

plugins.VelocityReport.evaluateWithContext("<html><head></head><body>#foreach ($row in $data) $row.po_num #end</body></html>",{data : forms.hauls_tbl.foundset})

it returns data, no error.

After looking at this and reproducing the problem on his end Robert Ivens suggested I submit this to you. This is my first time submitting an issue to ServoyForge so forgive me if I make any newbie mistakes!

Environment:
Server Information
Servoy version 2024.3.7 -releaseNumber 3950 (builddate: 2025-07-11 12:39)
Server Build Date: 2025-09-11 10:55:11
Port used by RMI Registry: 1099
Repository version 57
Current time: Thu Sep 11 10:55:11 PDT 2025
Uptime: 1 day 10 hours 50 minutes 2 seconds
Server ID: 2212E0DC-AB89-43B1-B25D-4A14D7287E15

Settings file for this server: C:\Servoys\Servoy 2024.3\developer\..\application_server\servoy.properties

User Information
Logged in as: amcgilly

JVM Information
java.vm.name=OpenJDK 64-Bit Server VM
java.version=21.0.5
java.vm.info=mixed mode
java.vm.vendor=Eclipse Adoptium


Files

Inline.getPDFReport.png (70.6 KB) Inline.getPDFReport.png No error Patrick Talbot, 09/11/2025 09:22 PM

History

#1

Updated by Adrian McGilly 2 months ago

(OK it's actually not my first time submitting an issue to ServoyForge but it's been over 10 years!)

#2

Updated by Patrick Talbot 2 months ago

  • Status changed from New to Resolved

Hi Adrian,

the thing is that the first parameter of the getPDFReport() method is expected to be a path to a template file in the report folder.
If you want to pass a String of the actual template, then you can add a fromString: true parameter to the context object you pass as second parameter.

So, this will work:

var pdf = plugins.VelocityReport.getPDFReport("<html><head></head><body>#foreach ($row in $data) $row.po_num #end</body></html>",{data : forms.hauls_tbl.foundset, fromString: true});

#3

Updated by Adrian McGilly 2 months ago

Per your response, I tried:

plugins.VelocityReport.getPDFReport("<html><head></head><body>#foreach ($row in $data) $row.po_num #end</body></html>",{data : forms.hauls_tbl.foundset, fromString : true})

and I am getting the same result. Returns null and this error:

Exception, see log file for full details: no protocol: null<html><head></head><body>#foreach ($row in $data) $row.po_num #end</body></html>

#4

Updated by Patrick Talbot 2 months ago

  • Status changed from Resolved to Reopened

I'm going to install Servoy 2024.3.7 and test again against Velocity v3.9.6, but I just tried in another Servoy version and it worked for me...
What kind of client is it? Smart? Web? NG? Titanium?
Did you setup the velocityreport.reportfolder in /servoy-admin/ to a report folder path?

#5

Updated by Patrick Talbot 2 months ago

I tried in Servoy 2024.3.7.3950_LTS (using built-in Java 21.0.5), with Velocity v3.9.6 in NG1 and Titanium, and even Desktop client, and got no error, see No error

#6

Updated by Patrick Talbot 2 months ago

Velocity starting with version 3.9 is using openpdf.jar and no longer iText-4.2.0.jar - so when you install the plugin from the zip package, make sure you delete the previous velocityreport folder from your application_server/plugins/ folder before you copy the one from the zip. You might have some older jars mixed with new ones in there...
I don't see any other explanation for your problem than an installation issue...

#7

Updated by Patrick Talbot 2 months ago

Any news on this? It should work well if your installation is correct...

#8

Updated by Patrick Talbot 2 months ago

  • Priority changed from High to Normal
#9

Updated by Adrian McGilly 2 months ago

Thank you for your prompt assistance with this. I tried carefully re-installing velocity 3.9.6. but it did not help. I removed the existing velocityreport folder and velocityreport.jar and velocityreport.jar.jnlp and then replaced them with the new ones. This problem is also happening for Robert Ivens in his Dev environment which is the same as mine except he's on Mac and I'm on Windows. I was waiting to see if Robert had any feedback on your recent responses before responding myself but he hasn't weighed in yet so I'm giving you an update.

The problem happens in Developer and on the Server, in the NG Client both in the browser and NG Desktop. I am not using Titatium.

Velocity Report folder is set up in servoy-admin. Folder exists and contains just the www and tmp folders which are both empty.

I'd be happy to let you poke around in my Servoy Developer if you'd like to do a Teams screenshare session. Thank you.

#10

Updated by Patrick Talbot 2 months ago

Must be some conflict with other plugins, because I really cannot reproduce on my end with a standard Servoy installation.
This has worked for a long time and I haven't changed a thing about this for a long while...

Do you have some exception in the servoy log? I would like to see the stack trace of what is happening to you.

#11

Updated by Adrian McGilly 2 months ago

Here is the error I get in Developer when it hits the getPDFReport() function:

java.net.MalformedURLException: no protocol: null<html><head></head><body>#foreach($row in $data)row.po_num#end</body></html>
at java.base/java.net.URL.<init>(Unknown Source) ~[?:?]
at java.base/java.net.URL.<init>(Unknown Source) ~[?:?]
at java.base/java.net.URL.<init>(Unknown Source) ~[?:?]
at net.stuff.servoy.plugin.velocityreport.util.VelocityHelper.doRenderToPDF(VelocityHelper.java:1106) ~[?:?]
at net.stuff.servoy.plugin.velocityreport.VelocityReportProvider.js_getPDFReport(VelocityReportProvider.java:1246) ~[?:?]
at net.stuff.servoy.plugin.velocityreport.VelocityReportProvider.js_getPDFReport(VelocityReportProvider.java:1197) ~[?:?]
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source) ~[?:?]
at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:220) ~[org.eclipse.dltk.javascript.rhino_1.7.14.s7.jar:?]
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:284) ~[org.eclipse.dltk.javascript.rhino_1.7.14.s7.jar:?]
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1879) ~[org.eclipse.dltk.javascript.rhino_1.7.14.s7.jar:?]
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1053) ~[org.eclipse.dltk.javascript.rhino_1.7.14.s7.jar:?]
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:90) ~[org.eclipse.dltk.javascript.rhino_1.7.14.s7.jar:?]
at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:725) ~[servoy_shared_2024.3.7.3950_LTS.jar:?]
at com.servoy.j2db.debug.RemoteDebugScriptEngine.executeFunction(RemoteDebugScriptEngine.java:389) ~[?:?]
at com.servoy.j2db.server.ngclient.component.EventExecutor.executeEvent(EventExecutor.java:211) ~[?:?]
at com.servoy.j2db.server.ngclient.DataAdapterList.executeEvent(DataAdapterList.java:200) ~[?:?]
at com.servoy.j2db.server.ngclient.WebFormComponent$FormcomponentEventHandler.executeEvent(WebFormComponent.java:267) ~[?:?]
at org.sablo.BaseWebObject.doExecuteEvent(BaseWebObject.java:392) ~[sablo_2024.3.7.3950_LTS.jar:?]
at org.sablo.BaseWebObject.executeEvent(BaseWebObject.java:354) ~[sablo_2024.3.7.3950_LTS.jar:?]
at org.sablo.services.server.FormServiceHandler.executeEvent(FormServiceHandler.java:132) ~[sablo_2024.3.7.3950_LTS.jar:?]
at com.servoy.j2db.server.ngclient.NGFormServiceHandler.executeEvent(NGFormServiceHandler.java:638) ~[?:?]
at org.sablo.services.server.FormServiceHandler.executeMethod(FormServiceHandler.java:83) ~[sablo_2024.3.7.3950_LTS.jar:?]
at com.servoy.j2db.server.ngclient.NGFormServiceHandler.executeMethod(NGFormServiceHandler.java:617) ~[?:?]
at org.sablo.websocket.WebsocketEndpoint$5.run(WebsocketEndpoint.java:418) ~[sablo_2024.3.7.3950_LTS.jar:?]
at org.sablo.eventthread.Event$1.run(Event.java:97) ~[sablo_2024.3.7.3950_LTS.jar:?]
at org.sablo.websocket.CurrentWindow.runForWindow(CurrentWindow.java:80) ~[sablo_2024.3.7.3950_LTS.jar:?]
at org.sablo.eventthread.Event.execute(Event.java:87) ~[sablo_2024.3.7.3950_LTS.jar:?]
at org.sablo.eventthread.EventDispatcher.dispatch(EventDispatcher.java:135) ~[sablo_2024.3.7.3950_LTS.jar:?]
at org.sablo.eventthread.EventDispatcher.suspend(EventDispatcher.java:272) ~[sablo_2024.3.7.3950_LTS.jar:?]
at com.servoy.j2db.server.ngclient.NGRuntimeWindow.doOldShow(NGRuntimeWindow.java:578) ~[?:?]
at com.servoy.j2db.scripting.RuntimeWindow.doShow(RuntimeWindow.java:309) ~[servoy_shared_2024.3.7.3950_LTS.jar:?]
at com.servoy.j2db.scripting.RuntimeWindow.show(RuntimeWindow.java:303) ~[servoy_shared_2024.3.7.3950_LTS.jar:?]
at com.servoy.j2db.scripting.RuntimeWindow.showObject(RuntimeWindow.java:290) ~[servoy_shared_2024.3.7.3950_LTS.jar:?]
at com.servoy.j2db.scripting.JSWindow.js_show(JSWindow.java:157) ~[servoy_shared_2024.3.7.3950_LTS.jar:?]
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source) ~[?:?]
at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:220) ~[org.eclipse.dltk.javascript.rhino_1.7.14.s7.jar:?]
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:284) ~[org.eclipse.dltk.javascript.rhino_1.7.14.s7.jar:?]
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1879) ~[org.eclipse.dltk.javascript.rhino_1.7.14.s7.jar:?]
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1053) ~[org.eclipse.dltk.javascript.rhino_1.7.14.s7.jar:?]
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:90) ~[org.eclipse.dltk.javascript.rhino_1.7.14.s7.jar:?]
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:380) ~[org.eclipse.dltk.javascript.rhino_1.7.14.s7.jar:?]
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3951) ~[org.eclipse.dltk.javascript.rhino_1.7.14.s7.jar:?]
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:88) ~[org.eclipse.dltk.javascript.rhino_1.7.14.s7.jar:?]
at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:725) ~[servoy_shared_2024.3.7.3950_LTS.jar:?]
at com.servoy.j2db.debug.RemoteDebugScriptEngine.executeFunction(RemoteDebugScriptEngine.java:389) ~[?:?]
at com.servoy.j2db.server.ngclient.component.EventExecutor.executeEvent(EventExecutor.java:211) ~[?:?]
at com.servoy.j2db.server.ngclient.DataAdapterList.executeEvent(DataAdapterList.java:200) ~[?:?]
at com.servoy.j2db.server.ngclient.WebFormComponent$FormcomponentEventHandler.executeEvent(WebFormComponent.java:267) ~[?:?]
at org.sablo.BaseWebObject.doExecuteEvent(BaseWebObject.java:392) ~[sablo_2024.3.7.3950_LTS.jar:?]
at org.sablo.BaseWebObject.executeEvent(BaseWebObject.java:354) ~[sablo_2024.3.7.3950_LTS.jar:?]
at com.servoy.j2db.server.ngclient.property.ComponentTypeSabloValue.browserUpdatesReceived(ComponentTypeSabloValue.java:798) ~[?:?]
at com.servoy.j2db.server.ngclient.property.ComponentPropertyType.fromJSON(ComponentPropertyType.java:352) ~[?:?]
at com.servoy.j2db.server.ngclient.property.ComponentPropertyType.fromJSON(ComponentPropertyType.java:1) ~[?:?]
at org.sablo.websocket.utils.JSONUtils.fromJSON(JSONUtils.java:283) ~[sablo_2024.3.7.3950_LTS.jar:?]
at org.sablo.specification.property.CustomJSONArrayType.fromJSON(CustomJSONArrayType.java:202) ~[sablo_2024.3.7.3950_LTS.jar:?]
at org.sablo.specification.property.CustomJSONArrayType.fromJSON(CustomJSONArrayType.java:1) ~[sablo_2024.3.7.3950_LTS.jar:?]
at org.sablo.websocket.utils.JSONUtils.fromJSON(JSONUtils.java:283) ~[sablo_2024.3.7.3950_LTS.jar:?]
at org.sablo.BaseWebObject.convertValueFromJSON(BaseWebObject.java:1050) ~[sablo_2024.3.7.3950_LTS.jar:?]
at org.sablo.BaseWebObject.doPutBrowserProperty(BaseWebObject.java:866) ~[sablo_2024.3.7.3950_LTS.jar:?]
at org.sablo.BaseWebObject.putBrowserProperty(BaseWebObject.java:819) ~[sablo_2024.3.7.3950_LTS.jar:?]
at org.sablo.services.server.FormServiceHandler.dataPush(FormServiceHandler.java:214) ~[sablo_2024.3.7.3950_LTS.jar:?]
at org.sablo.services.server.FormServiceHandler.executeMethod(FormServiceHandler.java:76) ~[sablo_2024.3.7.3950_LTS.jar:?]
at com.servoy.j2db.server.ngclient.NGFormServiceHandler.executeMethod(NGFormServiceHandler.java:617) ~[?:?]
at org.sablo.websocket.WebsocketEndpoint$5.run(WebsocketEndpoint.java:418) ~[sablo_2024.3.7.3950_LTS.jar:?]
at org.sablo.eventthread.Event$1.run(Event.java:97) ~[sablo_2024.3.7.3950_LTS.jar:?]
at org.sablo.websocket.CurrentWindow.runForWindow(CurrentWindow.java:80) ~[sablo_2024.3.7.3950_LTS.jar:?]
at org.sablo.eventthread.Event.execute(Event.java:87) ~[sablo_2024.3.7.3950_LTS.jar:?]
at org.sablo.eventthread.EventDispatcher.dispatch(EventDispatcher.java:135) ~[sablo_2024.3.7.3950_LTS.jar:?]
at org.sablo.eventthread.EventDispatcher.run(EventDispatcher.java:90) ~[sablo_2024.3.7.3950_LTS.jar:?]
at com.servoy.j2db.server.ngclient.eventthread.NGEventDispatcher.run(NGEventDispatcher.java:60) ~[?:?]
at java.base/java.lang.Thread.run(Unknown Source) [?:?]

#12

Updated by Robert Ivens 2 months ago

Hi Patrick,

I ran a simple test in a clean 2024.3.7 install with the latest VelocityReport plugin.
I created a simple TiNG solution with 1 empty form, ran it and put the following code in the command console:

plugins.VelocityReport.getPDFReport("<html><head></head><body>#foreach ($row in $data) $row.po_num #end</body></html>",{data:[{po_num:'111'}, {po_num:'123'}], fromString: true})

This gives me the following error in the console:

ERROR com.servoy.j2db.util.Debug - no protocol: null<html><head></head><body>#foreach ($row in $data) row.po_num #end</body></html>
    at internal_anon:1
java.net.MalformedURLException: no protocol: null<html><head></head><body>#foreach ($row in $data) row.po_num #end</body></html>
    at java.base/java.net.URL.<init>(Unknown Source) ~[?:?]
    at java.base/java.net.URL.<init>(Unknown Source) ~[?:?]
    at java.base/java.net.URL.<init>(Unknown Source) ~[?:?]
    at net.stuff.servoy.plugin.velocityreport.util.VelocityHelper.doRenderToPDF(VelocityHelper.java:1106) ~[?:?]
    at net.stuff.servoy.plugin.velocityreport.VelocityReportProvider.js_getPDFReport(VelocityReportProvider.java:1246) ~[?:?]
    at net.stuff.servoy.plugin.velocityreport.VelocityReportProvider.js_getPDFReport(VelocityReportProvider.java:1197) ~[?:?]
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source) ~[?:?]
    at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
    at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:220) ~[org.eclipse.dltk.javascript.rhino_1.7.14.s7.jar:?]
    at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:284) ~[org.eclipse.dltk.javascript.rhino_1.7.14.s7.jar:?]
    at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1879) ~[org.eclipse.dltk.javascript.rhino_1.7.14.s7.jar:?]
    at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1053) ~[org.eclipse.dltk.javascript.rhino_1.7.14.s7.jar:?]
    at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:90) ~[org.eclipse.dltk.javascript.rhino_1.7.14.s7.jar:?]
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:380) ~[org.eclipse.dltk.javascript.rhino_1.7.14.s7.jar:?]
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3951) ~[org.eclipse.dltk.javascript.rhino_1.7.14.s7.jar:?]
    at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:103) ~[org.eclipse.dltk.javascript.rhino_1.7.14.s7.jar:?]
    at org.mozilla.javascript.Context.evaluateString(Context.java:1137) ~[org.eclipse.dltk.javascript.rhino_1.7.14.s7.jar:?]
    at com.servoy.eclipse.debug.scriptingconsole.CommandHandler$1.run(CommandHandler.java:67) ~[?:?]
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:?]
    at java.base/java.util.concurrent.FutureTask.run(Unknown Source) ~[?:?]
    at org.sablo.eventthread.Event$1.run(Event.java:97) ~[sablo_2024.3.7.3950_LTS.jar:?]
    at org.sablo.websocket.CurrentWindow.runForWindow(CurrentWindow.java:80) ~[sablo_2024.3.7.3950_LTS.jar:?]
    at org.sablo.eventthread.Event.execute(Event.java:87) ~[sablo_2024.3.7.3950_LTS.jar:?]
    at org.sablo.eventthread.EventDispatcher.dispatch(EventDispatcher.java:135) ~[sablo_2024.3.7.3950_LTS.jar:?]
    at org.sablo.eventthread.EventDispatcher.run(EventDispatcher.java:90) ~[sablo_2024.3.7.3950_LTS.jar:?]
    at com.servoy.j2db.server.ngclient.eventthread.NGEventDispatcher.run(NGEventDispatcher.java:60) ~[?:?]
    at java.base/java.lang.Thread.run(Unknown Source) [?:?]
#13

Updated by Robert Ivens 2 months ago

Just did the same test with 3.9.7 and that works correctly now.

Thanks!

#14

Updated by Patrick Talbot 2 months ago

Ah! I think I understand. I bet you didn't set the velocityreport.serverURL in servoy-admin...
This is why it says the protocol (URL) is null.

The process of rendering to PDF is first building an XML document and passing it to the renderer, which itself is demanding the XML document AND a base URL, when velocityreport.serverURL is null (the baseURL), this is what happens.

In Developer velocityreport.serverURL would be something like http://localhost:8183/ (or the port you are using), on your server it should be the external URL of your server - as seen by a client.

I just released a v3.9.7 which will set a default URL (to file:/// + velocityreport.reportfolder, and to http://localhost/ if even velocityreport.reportfolder is not set).

This should solve your issue. You can find the zip here: https://www.servoyforge.net/attachments/download/2549/Velocity-v3.9.7.zip - you only need to update the velocityreport.jar in your application_server/plugins folder.

#15

Updated by Patrick Talbot 2 months ago

Robert Ivens wrote:

Just did the same test with 3.9.7 and that works correctly now.

Thanks!

Great. Thanks for confirming.
I intend to release a v4.0 very soon, which will contain this and internal refactoring/clean-up and prepare for Servoy 2025.09... stay tuned! ;)

#16

Updated by Patrick Talbot 2 months ago

  • Status changed from Reopened to Closed
#17

Updated by Robert Ivens 2 months ago

Looking forward to testing that :)

Also I noticed that the code also works without the fromString: true property.

#18

Updated by Patrick Talbot 2 months ago

Robert Ivens wrote:

Looking forward to testing that :)

Also I noticed that the code also works without the fromString: true property.

Indeed, I'm checking the String passed to the method for a regex match on <html or <body or <head and deduce that the template is not a path but the actual content...

#19

Updated by Adrian McGilly 2 months ago

Thank you for the quick response Patrick, 3.9.7 fixed the problem.

#20

Updated by Patrick Talbot 2 months ago

Adrian McGilly wrote:

Thank you for the quick response Patrick, 3.9.7 fixed the problem.

That's great to hear Adrian!

Also available in: Atom PDF