2 Replies Latest reply on May 16, 2006 5:11 PM by Newsgroup_User

    POI-HSSF problem.  saves in /runtime/bin, not /wwwroot

    DaveF67
      I am trying to get this to work in Solaris/Apache/MX7. When I run the code, it always saves the files in

      <cfusionserver>/runtime/bin/
      with owner "nobody|other"

      i need the files to read and write from
      <cfusionserver>/wwwroot/
      owner "www|www"

      any suggestions?

      files located in <cfserver>/WEB-INF/lib/

      -rw-r--r-- 1 www www 802216 May 16 09:42 poi-2.5.1-final-20040804.jar
      -rw-r--r-- 1 www www 55209 May 16 09:42 poi-contrib-2.5.1-final-20040804.jar


      <CFSCRIPT>
      workBook=createObject("java","org.apache.poi.hssf.usermodel.HSSFWorkbook").init();
      newSheet=workBook.createSheet();
      workBook.setSheetName(0, "My First Sheet");
      row=newSheet.createRow(55);
      cell=row.createCell(0);
      cell.setCellValue("hello world!");
      fileOutStream = createObject("java","java.io.FileOutputStream").init("test6.xls"); // ****** output
      workBook.write(fileOutStream);
      fileOutStream.close();
      </CFSCRIPT>
      I have tried using .init("/opt/coldfusionmx7/wwwroot/test6.xls"); but i get an error.

      Thanks if you can help
      Dave

        • 1. Re: POI-HSSF problem.  saves in /runtime/bin, not /wwwroot
          Level 7
          what error do you get when trying the init("/opt....")?

          that's on the right track...just using the filename itself is definitely not
          what you want.

          what you might do to get the full path you're looking for is create a file
          in wwwroot and do a
          <cfoutput>#getDirectoryFromPath(getCurrentTemplatePath())#</cfoutput>

          that'll tell you what coldfusion thinks it is, and from there you should
          have what you need to pass into the file init


          "DaveF67" <webforumsuser@macromedia.com> wrote in message
          news:e4d0n6$6vh$1@forums.macromedia.com...
          >I am trying to get this to work in Solaris/Apache/MX7. When I run the code,
          >it
          > always saves the files in
          >
          > <cfusionserver>/runtime/bin/
          > with owner "nobody|other"
          >
          > i need the files to read and write from
          > <cfusionserver>/wwwroot/
          > owner "www|www"
          >
          > any suggestions?
          >
          > files located in <cfserver>/WEB-INF/lib/
          >
          > -rw-r--r-- 1 www www 802216 May 16 09:42
          > poi-2.5.1-final-20040804.jar
          > -rw-r--r-- 1 www www 55209 May 16 09:42
          > poi-contrib-2.5.1-final-20040804.jar
          >
          >
          > <CFSCRIPT>
          >
          > workBook=createObject("java","org.apache.poi.hssf.usermodel.HSSFWorkbook").init
          > ();
          > newSheet=workBook.createSheet();
          > workBook.setSheetName(0, "My First Sheet");
          > row=newSheet.createRow(55);
          > cell=row.createCell(0);
          > cell.setCellValue("hello world!");
          > fileOutStream =
          > createObject("java","java.io.FileOutputStream").init("test6.xls"); //
          > ******
          > output
          > workBook.write(fileOutStream);
          > fileOutStream.close();
          > </CFSCRIPT>
          > I have tried using .init("/opt/coldfusionmx7/wwwroot/test6.xls"); but i
          > get an
          > error.
          >
          > Thanks if you can help
          > Dave
          >
          >
          >


          • 2. Re: POI-HSSF problem.  saves in /runtime/bin, not /wwwroot
            Level 7
            also, you might try creating a file object first, initing that with your
            full path, and then passing that object into the init method of the output
            stream

            "Marc E" <cf@hifiwebdesign.com> wrote in message
            news:e4dlop$3t4$1@forums.macromedia.com...
            > what error do you get when trying the init("/opt....")?
            >
            > that's on the right track...just using the filename itself is definitely
            > not what you want.
            >
            > what you might do to get the full path you're looking for is create a file
            > in wwwroot and do a
            > <cfoutput>#getDirectoryFromPath(getCurrentTemplatePath())#</cfoutput>
            >
            > that'll tell you what coldfusion thinks it is, and from there you should
            > have what you need to pass into the file init
            >
            >
            > "DaveF67" <webforumsuser@macromedia.com> wrote in message
            > news:e4d0n6$6vh$1@forums.macromedia.com...
            >>I am trying to get this to work in Solaris/Apache/MX7. When I run the
            >>code, it
            >> always saves the files in
            >>
            >> <cfusionserver>/runtime/bin/
            >> with owner "nobody|other"
            >>
            >> i need the files to read and write from
            >> <cfusionserver>/wwwroot/
            >> owner "www|www"
            >>
            >> any suggestions?
            >>
            >> files located in <cfserver>/WEB-INF/lib/
            >>
            >> -rw-r--r-- 1 www www 802216 May 16 09:42
            >> poi-2.5.1-final-20040804.jar
            >> -rw-r--r-- 1 www www 55209 May 16 09:42
            >> poi-contrib-2.5.1-final-20040804.jar
            >>
            >>
            >> <CFSCRIPT>
            >>
            >> workBook=createObject("java","org.apache.poi.hssf.usermodel.HSSFWorkbook").init
            >> ();
            >> newSheet=workBook.createSheet();
            >> workBook.setSheetName(0, "My First Sheet");
            >> row=newSheet.createRow(55);
            >> cell=row.createCell(0);
            >> cell.setCellValue("hello world!");
            >> fileOutStream =
            >> createObject("java","java.io.FileOutputStream").init("test6.xls"); //
            >> ******
            >> output
            >> workBook.write(fileOutStream);
            >> fileOutStream.close();
            >> </CFSCRIPT>
            >> I have tried using .init("/opt/coldfusionmx7/wwwroot/test6.xls"); but i
            >> get an
            >> error.
            >>
            >> Thanks if you can help
            >> Dave
            >>
            >>
            >>
            >
            >