ScriptMaster is a free, general-purpose, modular plugin for FileMaker Pro. It comes out of the box with modules for file manipulation, URL and network utilities, Web Services, shell scripting, event/script triggering, and many others. Please use this discussion area to post questions and suggestions.



492 Views    -    9 Replies


Username Post: FileNotFoundException        (Topic#215605)
Your continued generosity and support of FMForums is greatly appreciated.
Howard Schlossberg 
novice
Posts: 12

Loc: Los Angeles
Post Rank (AVG):
            


FMP: 10 Advanced
OS: Windows XP

Member: FBA
Skill: Expert

Certified:
     

FMDiSC

Tweet This! Tweet This Post!
07-09-10 01:55 PM - Post#360112     - Post Rank:             


I am loading an image from a URL into a container field, using this one statement:

new URL(url)

The URL it calls is of the form:
http://www.sample.com/competitions/image.php?entry=B217&sz=l&c=8x10...

This works great on my local machine (inserts a JPG image), but I get FileNotFoundException errors when running it from a server-side script.

As a test, I ran the same on the server using a static url (i.e. "http://www.fmadvocate.com/square/base_elements.gif") and this works fine.

So it would seem to be something with lack of a standard image extension? And only on the FM server?

The server is using Java 1.6.0_07-b06 (as determined by a call from within ScriptMaster) with ScriptMaster 3.33.

Anything else I should look at or that I can do to my script to make this work on the server?

Thanks,
Howard Schlossberg










360Works offers a complete line of FileMaker plugins
and add-ons
targeted at FileMaker developers.

Jesse Barnum 
journeyman
Posts: 274
Jesse Barnum

Loc: Atlanta, GA
Post Rank (AVG):
            


FMP: 11 Advanced
OS: Mac OS X Snow Leopard

Member: TechNet, FBA, Platinum
Skill: Expert

Certified:
     

 FMPug

Tweet This! Tweet This Post!
07-09-10 02:56 PM - Post#360117     - Post Rank:             
    In response to Howard Schlossberg

I get a 404 error when I try going to the URL you posted. Can you try posting a different URL that goes to a real image?
--Jesse Barnum, President, 360Works
http://www.360works.com
(770) 234-9293











Howard Schlossberg 
novice
Posts: 12

Loc: Los Angeles
Post Rank (AVG):
            


FMP: 10 Advanced
OS: Windows XP

Member: FBA
Skill: Expert

Certified:
     

FMDiSC

Tweet This! Tweet This Post!
07-09-10 03:17 PM - Post#360118     - Post Rank:             
    In response to Jesse Barnum

Oops, sorry. Try http://www4.wppionline.com/competitions/image.php?entry=B217&sz=l&c...










Jesse Barnum 
journeyman
Posts: 274
Jesse Barnum

Loc: Atlanta, GA
Post Rank (AVG):
            


FMP: 11 Advanced
OS: Mac OS X Snow Leopard

Member: TechNet, FBA, Platinum
Skill: Expert

Certified:
     

 FMPug

Tweet This! Tweet This Post!
07-10-10 12:43 PM - Post#360208     - Post Rank:             
    In response to Howard Schlossberg

That still doesn't work for me:


apollo:My Generated Plugin jesse$ curl -I "http://www4.wppionline.com/competitions/image.php?entry=B217&sz=l&c"
HTTP/1.1 500 Internal Server Error
Content-Type: text/html; charset=UTF-8
Date: Sat, 10 Jul 2010 19:42:15 GMT
Server: Apache/2.2.3 (CentOS)
X-Powered-By: PHP/5.2.13 ZendServer/5.0
Connection: keep-alive
--Jesse Barnum, President, 360Works
http://www.360works.com
(770) 234-9293











Jesse Barnum 
journeyman
Posts: 274
Jesse Barnum

Loc: Atlanta, GA
Post Rank (AVG):
            


FMP: 11 Advanced
OS: Mac OS X Snow Leopard

Member: TechNet, FBA, Platinum
Skill: Expert

Certified:
     

 FMPug

Tweet This! Tweet This Post!
07-10-10 12:44 PM - Post#360209     - Post Rank:             
    In response to Jesse Barnum

Whoops, URL was cut off, never mind, it works in the browser. I'll check into it.
--Jesse Barnum, President, 360Works
http://www.360works.com
(770) 234-9293











Jesse Barnum 
journeyman
Posts: 274
Jesse Barnum

Loc: Atlanta, GA
Post Rank (AVG):
            


FMP: 11 Advanced
OS: Mac OS X Snow Leopard

Member: TechNet, FBA, Platinum
Skill: Expert

Certified:
     

 FMPug

Tweet This! Tweet This Post!
07-10-10 12:52 PM - Post#360210     - Post Rank:             
    In response to Howard Schlossberg

I found the problem - it's because the source is not returning a content-length attribute. FileMaker requires you to know the size of something in order to create a container field. ScriptMaster does not download the HTTP resource to a local disk item before giving it to FileMaker, it streams the URL contents directly into a FileMaker container field, so it can't tell beforehand how big the graphic is.

The possible solutions are 1) have the provider return the resource length as an HTTP header, or 2) have ScriptMaster download the file to a local file before handing it off to FileMaker.

I'll assume that we need option #2, since there will probably be other cases where the web server does not return a content-length attribute. I'll work on this and post here when a fix is available. In the meantime, if you can get the provider to add a content-length attribute, that will also fix the problem.
--Jesse Barnum, President, 360Works
http://www.360works.com
(770) 234-9293











Howard Schlossberg 
novice
Posts: 12

Loc: Los Angeles
Post Rank (AVG):
            


FMP: 10 Advanced
OS: Windows XP

Member: FBA
Skill: Expert

Certified:
     

FMDiSC

Tweet This! Tweet This Post!
07-10-10 01:54 PM - Post#360216     - Post Rank:             
    In response to Jesse Barnum

Thanks for the reply, Jesse. In our case, all images will be coming from the same provider, so I should be able to have them add the length into the header.

What I'm still curious about is why it works okay on my local machine, but not when run on the FM server. If it's going directly into the container field, then it shouldn't be an OS permissions issue. I've asked the client's IT person to upgrade the version of Java from 1.6.0_07 to something more current, but I can't find any notes as to any apparently relevant Java changes between those versions.










Jesse Barnum 
journeyman
Posts: 274
Jesse Barnum

Loc: Atlanta, GA
Post Rank (AVG):
            


FMP: 11 Advanced
OS: Mac OS X Snow Leopard

Member: TechNet, FBA, Platinum
Skill: Expert

Certified:
     

 FMPug

Tweet This! Tweet This Post!
07-10-10 05:06 PM - Post#360227     - Post Rank:             
    In response to Howard Schlossberg

I don't know why it works on the local machine, that doesn't make sense to me. The good news is that I have this fixed on my development version, which will be released as ScriptMaster 4.0.
--Jesse Barnum, President, 360Works
http://www.360works.com
(770) 234-9293











Valentin 
apprentice
Posts: 140
Valentin

Loc: Atlanta, GA
Post Rank (AVG):
            


FMP: 10 Advanced
OS: Cross Platform

Member: FBA, Platinum

Certified:
     

 FMPug

Tweet This! Tweet This Post!
07-12-10 08:06 AM - Post#360299     - Post Rank:             
    In response to Howard Schlossberg

Hi Howard,

I tried the new URL and got a java.lang.NegativeArraySizeException

In this particular case, the web server does not know the length of the content, so it's returning -1 for content length, and thus the exception is thrown.

Our simple module would not work in this case, you actually have to read the incoming stream. Take a look at:
http://download.oracle.com/docs/cd/E17476_01/javase/1.4.2/docs/api/java/io/...
http://download.oracle.com/docs/cd/E17476_01/javase/1.4.2/docs/api/java/net...
http://download.oracle.com/docs/cd/E17476_01/javase/1.4.2/docs/api/java/net...

We could also create a custom module that reads the stream, chunk by chunk, when the content length is not available.
Valentin Avksentyev, 360Works
www.360works.com
(770)234-9293











Your continued generosity and support of FMForums is greatly appreciated.
Howard Schlossberg 
novice
Posts: 12

Loc: Los Angeles
Post Rank (AVG):
            


FMP: 10 Advanced
OS: Windows XP

Member: FBA
Skill: Expert

Certified:
     

FMDiSC

Tweet This! Tweet This Post!
07-12-10 11:59 AM - Post#360336     - Post Rank:             
    In response to Valentin

Thanks for the feedback. I had the webmaster update those download pages to include content-length in the http header. The result is that, instead of the error, it now downloads image.php as a file (rather than inserting the image). When I export that file from the container to my desktop, it is not a php file when opened in a text editor...but nor is it an image when I change the extension to .jpg and try opening that in my web browser.

It all still works perfectly from my local machine (running the hosted file). I even had them update the server's plugin to 3.34 and java to 1.6.0_20, but with the same results.

I'll have to play with it some more to see if I can get anything to work.

Thanks again for your responsiveness to my posts! I really appreciate it!!!

Howard










360Works offers a complete line of FileMaker plugins
and add-ons
targeted at FileMaker developers.

Icon Legend Permissions Topic Options
Print Topic

Email Topic

492 Views
Welcome Guest...
Enter your username and password to login. If you do not have a username you can register one here

Username

Password

Remember me. Help



Forgot Password...


Quick Links
Recent Posts
Active Topics
No Replies
Recent Files
Functions & Scripts
FileMaker Pro Help
FileMaker on Twitter
FileMaker Marketplace

Custom Search

Find FileMaker Developers

Don't have time to wait,
hire a developer now!

Recent Members
Welcome them to our community!
Find FileMaker Jobs

Want a new career?
Find your new job now!

Joy of Tech
Latest Joy of Tech!

Recent Topics
Recent Hot Topics
Contribute
With your generosity we can make some real magic happen!. Support your favorite online FileMaker community...
FM Forums.com


Click here...


Or a Donation of any amount.


Thanks for your support!

Active Blogs
0 Recent blogs:
People to Post Lately in this Topic
Howard Schlossberg
Jesse Barnum
Valentin
FM Forums Advertisers


FusionBB™ Version 3.0 FINAL | ©2003-2010 InteractivePHP, Inc.
Execution time: 0.485 seconds.   Total Queries: 128   Zlib Compression is on.
All times are . Current time is 08:48 PM
Content ©1996-2008 Ocean West Consulting, Inc. All Rights Reserved
Ocean West Consulting, Inc. can not and will not be held responsible for any of the contents in this site.
FM Forums™ is a trademark of Ocean West Consulting, Inc an independent entity, not affiliated with FileMaker Inc.
FileMaker® is a registered trademark of FileMaker Inc.
Top