• Post Reply Bookmark Topic Watch Topic
  • New Topic

File Not Found In Deployment

 
Tom Sullivan
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a TimerTask object which polls a directory looking for documents which tell the system what to do. It acts properly on my development system but won't work in deployment.

The code is below.



In checkShutDown() you can see the dir the system looks at for instructions, "c:\\rai\\temp\\". The system makes this dir when it first starts so I know it works (plus I'm getting a console printout for testing right now as you can see). This part is consistent on both the dev and deployment testing systems.

The problem is under run():

File f = new File(xmlDoc);
IN_XML = f.exists();

IN_XML will return false no matter what is in the dir. checkShutDown() does not see the shutdown command either but I'm sure that's the same problem so I'll stick to the one issue for now.

The process document is an xml document. It is named ImageProcessXML.xml. It is put in the c:\rai\temp directory. So the string that is passed to the File object is "c:\\rai\\temp\\ImageProcessXML.xml". When I check to see if it exists, "IN_XML = f.exists()" I get false every time so the ImageProcessor never starts up. If I comment out that line, the system finds the doc and runs the XML parser. How can this be? The same problem is found in checkShutDown(), system returns false for exists on that document too - but works perfectly on the development box.

Thanks for your help.

Tom
 
Tom Sullivan
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello. Can anyone help?

When I run from Netbeans, everything works. I get expected results when I add documents to the folder the system creates. I copied everything, including the test XML document up to my network and transfered it all to my laptop. I run the Processor.jar and the folders get created. I then copy the same XML document that I am using on my local machine down from the network to the laptop and nothing happens. It just sits there reporting that File f = new File(xmlDocument).exists() = false! Has anyone ever had anything like this happen? The shutdown.txt doc also does not get seen even though it works as expected on the development system. This has to be something simple. Can anyone help?

Thanks.

Tom
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you asked for it... in my opinion the "something simple" is that the Java program is working correctly. When it tells you the file doesn't exist, that means the file doesn't exist.

Now it's possible that "doesn't exist" actually means "doesn't have the permissions set for the program to read it", or something like that, but it's also possible that you are confused somehow. Without seeing your server directories personally it's impossible to say much. But I would suggest you start believing the program and finding out what it means instead of starting from the premise that you are right and it is wrong.
 
Tom Sullivan
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not starting from the premise that I am right and it is wrong. That's the point behind the post. And, yeah, I did ask for it, that's also the point behind posting.

Here's the steps I have taken:

Start the program: c:\rai\temp gets created on the laptop - like you would expect.
Copy the same XML file down from the network - the one I used on my local machine for testing - to the laptop and put it in the c:\rai\temp dir so now I have: c:\rai\temp\ImageProcessXML.xml in the directory. I'm looking at the damn thing and the system created the file paths so go figure.
Watch the system run and say the file is not there even though I can SEE it.

This has been tested now on several machines and not on all of them by me - my network admin has done the same.

Why would the system run and process the file on the laptop if I comment out the boolean if parameter. In other words, if I take out IN_XML = f.exists() and just set IN_XML = true, the system runs, parses the XML file and everyone is happy - except now it tries to run every time the timer�s run() method is invoked since there's no check to see if the file actually EXISTS! So, while you tell me that the file must not be there if the system says it�s not there, that�s not what I see happen when I don�t do a check for the file and just tell the system to parse it.

I�d be happy to send you the executable jar along with the XML docs if you like. And, I don�t care if it is simple or not. I just want to figure it out and fix it. But thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!