• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Writing to a file from an EJB

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a ejb cache that I am retrieving data from and writing that data to a file for ftp processing. I am using an ejb to do that that will be called via a timed function. I am having a problem getting anything to write to the file that is being created. The directory and file get created and I recieve no error messages from my write, but nothing shows up in my file. Here is the code that I am executing:

try
{
String dirName = ("c:\\AOSFTP");
String aosFileName = ("aosFtpFile.txt");
File aosFileDir = new File(dirName);
File aosFile = new File(dirName, aosFileName);
FileWriter fileWriter = new FileWriter(aosFileName);
BufferedWriter buffWriter = new BufferedWriter(fileWriter);


if(!aosFileDir.exists())
{
aosFileDir.mkdir();
}
else if(!aosFileDir.isDirectory())
{
System.out.println("The Directory does not exist");
return(1);
}
if(!aosFile.exists())
{
aosFile.createNewFile();
}

buffWriter.write(aosData);


buffWriter.flush();
//buffWriter.close();


}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}


Everything except the data is showing up......Any help would be greatly appreciated.
 
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you are sure about the contents of aosData?
 
Steve Sutton
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am positive. I took out a system print statement that shwoed data in the string. So, I am thinking that I don't have something right in the write statement :~).....
 
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, can't resist to view your codes in its true indentations.

Originally posted by Steve Sutton:
I have a ejb cache that I am retrieving data from and writing that data to a file for ftp processing. I am using an ejb to do that that will be called via a timed function. I am having a problem getting anything to write to the file that is being created. The directory and file get created and I recieve no error messages from my write, but nothing shows up in my file. Here is the code that I am executing:


Everything except the data is showing up......Any help would be greatly appreciated.

 
So I left, I came home, and I ate some pie. And then I read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic