Writing to a file on webserver

S

stevesuts

I have an EJB that passes a vector of data to another java class and
that class writes that vector to a file. I can get this to run on my
local server using WSAD. I can delete, create and write to this file.
However, when I put it out on the server (AIX box) I can't get it to do
anything of the sort. I will post my code:

public void deleteFtpFile()
{
String AOSFILEPATH = null;
String AOSFILENAME = null;
EnvData evd = new EnvData();
AOSFILEPATH = evd.getAosFtpFilePath();
AOSFILENAME = evd.getAosFtpFileName();
System.out.println("AOS FILE PATH IS : " + AOSFILEPATH );
System.out.println("AOS FILE NAME IS : " + AOSFILENAME );
String dirName = (AOSFILEPATH);
String aosFileName = (AOSFILENAME);
File aosFileDir = new File(dirName);
File aosFile = new File(dirName, aosFileName);
if(aosFile.exists())
{
aosFile.delete();
System.out.println("File Has Been Deleted!!!!!!!!!!!!");
}

}


public int writeToFile2(Vector aosData)
{
System.out.println("YOU ARE IN THE WRITE TO FILE FUNCTION");
int returnCde = 0;
String temp = null;
FileWriter fw = null;
PrintWriter fout = null;
String AOSFILEPATH = null;
String AOSFILENAME = null;
EnvData evd = new EnvData();


if (aosData ==null)
{
System.out.println("AOSDATA VECTOR NOT MAKING IT OVER TO HERE");
}



Iterator i = aosData.iterator();



AOSFILEPATH = evd.getAosFtpFilePath();
AOSFILENAME = evd.getAosFtpFileName();
System.out.println("AOS FILE PATH IS : " + AOSFILEPATH );
try
{
String dirName = (AOSFILEPATH);
String aosFileName = (AOSFILENAME);
File aosFileDir = new File(dirName);
File aosFile = new File(dirName, aosFileName);
if(!aosFileDir.exists())
{
System.out.println("TRYING TO CREATE THE directory");
aosFileDir.mkdir();
}
else if(!aosFileDir.isDirectory())
{
System.out.println("The Directory does not exist");
//return(1);
}
if(!aosFile.exists())
{
System.out.println("TRYING TO CREATE THE FILE");
aosFile.createNewFile();
}
fw = new FileWriter(aosFile);
fout = new PrintWriter(fw);

while(i.hasNext())
{
System.out.println("Record Written to File");
fout.println(i.next());
}

}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
finally
{
try
{
if (fout != null) fout.close();
if (fw != null) fw.close();
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
}



return (returnCde);
}


Can anyone help me out?
 
E

enrique

Are you sure it's not permission-related (JVM permission to write to
the filesystem, or otherwise)?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top