Jump to content

Problem with UNC image path


pumaking

Recommended Posts

Hi,

I've got a problem with a UNC image path which comes from the database. I work with these absolute paths from the database in other reports without any problem.

But now I got the following error:

com.jaspersoft.jasperserver.api.JSExceptionWrapper: Byte data not found at location : \\server\share\folder\file.jpg

When I copy the path in the error message and paste in in windows explorer the file is shown without any problem. I also tried to manually add the file to the report as a static image to see if there could be a problem with the file itself. This works perfectly.

So I thought if there is perhaps an empty space in the path which comes from the database. So I put the image expression together from the foldername and the filename which also comes from the database:

"\\server\share\folder\" + $F{Imagename}

With that I get the following error:
com.jaspersoft.jasperserver.api.JSExceptionWrapper: net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file: 1. Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ ) value = (java.lang.String)("\\server\share\folder\" + ((java.lang.String)field_Imagename.getValue())); //$JR_EXPR_ID=12$

So I tried:

"\\server\\share\\folder\\" + $F{Imagename}

Now the error is again (because the backslash appears only one time in the beginning):

com.jaspersoft.jasperserver.api.JSExceptionWrapper: Byte data not found at location : \server\share\folder\file.jpg

My next try was this one:

"\\\server\\share\\folder\\" + $F{Imagename}

And now again this error:

com.jaspersoft.jasperserver.api.JSExceptionWrapper: net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file: 1. Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ ) value = (java.lang.String)("\\\server\share\folder\" + ((java.lang.String)field_Imagename.getValue())); //$JR_EXPR_ID=12$

 

How can I solve this problem?

 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...