Project

General

Profile

Defect #847

Image not being found/refused for webclient

Added by Tom Parry about 9 years ago. Updated about 5 years ago.

Status:
Parked
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
03/19/2015
Due date:
% Done:

0%

Estimated time:
Browser (if web client):
Firefox

Description

Not sure if this is similar to issue 831.
Web client only (smart client has similar issue that the image is not found but does not give this error).
I put my clients ip address in for the velocity reports properties on the Servoy admin page.
When I run the report in web client I get the pdf but without the image.
Servoy Log gives this error:

InputStream is null for URI http://<client ip>:8081/eastwood/reports/C:/VelocityReport_crir/images/crir_logo.jpg
and
IO problem for http://<client ip>:8081/eastwood/reports/C:/VelocityReport_crir/images/crir_logo.jpg

other stack dump in attached file.

Why would the connection be refused?


Files

error_log.txt (7.29 KB) error_log.txt Tom Parry, 03/19/2015 06:35 PM

History

#1

Updated by Patrick Talbot about 9 years ago

  • Status changed from New to In Progress

You shouldn't put your client IP, but the public IP of your server as seen from the external world.
The server should be able to access this IP as well.

#2

Updated by Tom Parry about 9 years ago

If I was not clear the client ip is the public ip.
I can invoke both the smart and the web client application solution from this public ip.

#3

Updated by Patrick Talbot about 9 years ago

Not it's not clear.
A client IP is the IP of the machine running the client (either the Smart client or a browser for Web client)
A server IP is the IP of the machine where you installed Servoy server.
But for the web client's browser to be able to access the images, it should be the server PUBLIC ip that is declared in velocityreport.serverURL - furthermore the port used should be publicly accessible and the one that Tomcat listens.

#4

Updated by Patrick Talbot about 9 years ago

I don't see any attached file.

#5

Updated by Tom Parry about 9 years ago

OK so I failed the nomenclature test :)
I added the log file to this - is it received?

#6

Updated by Patrick Talbot about 9 years ago

Yeah, thanks, I see the log now.

All I can see is that it points to a network problem, so the question is:
Can your server (where the PDF is created) access the
http://<client ip>:8081/eastwood/reports/C:/VelocityReport_crir/images/crir_logo.jpg URL?

I've seen servers incapable of accessing themselves using their external IP. There was some network configuration that needed to be addressed to make the server available to itself with its external public IP.
That's the only thing I can think of for that error...

To avoid this issue, I remember that I have added an option to embed the bytes of images in the rendered HTML template to be rendered to PDF.
What you can do to use these kinds of images is instead of using a simple link to your image in the template, read the image from file (or db) into a byte[] array, then add it in your context this way:
context.myLogo = plugins.VelocityReport.getByteMedia(byteArray);

Then in your template, you can simply put $!myLogo and this will create the <object> tag with a type image and add the base64 encoded data to the HTML, that will then be used by the PDF renderer to render the image without trying to load it from the server.

#7

Updated by Tom Parry about 9 years ago

Thanks for the hints.
The customer server cannot reach it own external IP. My research shows that for their router that it does not seem possible. I am continuing to see if I can route using NAT.

I used your suggested work around - the logo converted to bytes array - and it does indeed insert the image.
This issue is for the web client only.
However I think it may be the same cause of another error message indicating failure to connect to the css file in the folder under C:/VelocityReport_crir/css. (The output is not conforming to the css).

I also tried putting the VelocityReport_crir folder in the Servoy application server folder (like I have to do for JasperReports) but it made no difference.

Another related issue is the method to export to excel seems not to export the image either with the simple link nor with the embedded byte array. Is this normal? I used the example in the wiki to export. All the other information is exported just fine.

#8

Updated by Patrick Talbot about 5 years ago

  • Status changed from In Progress to Parked

Also available in: Atom PDF