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?
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?