Unable to create a file using struts

Hello experts,
I am using this code in struts action class to create a xml file.
File f = new File("src/java/usrXml/" + "my_name" + ".xml");
f.createNewFile();but it is not working. and give me "File/Floder not found" exception. but when i copy same code in a java class having main() method. it is working fine.
plz tell me why this code is not working in struts but in main method, and what should i do to make it working in struts action class.
Thanks and regards
Shams

Why you would create a new file in a 'src' directory in a Struts action? The 'src' directory isn't even there when Struts is executing. But 'folder not found' means exactly that: you named a folder in the filename that doesn't exist. Not really a Struts problem, just a folder problem really.

Similar Messages

  • Unable to create a file in Application Server using OPEN DATASET stattement.

    I am unable to create a file in Application Server using the following statement.
    OPEN DATASET filename FOR OUTPUT
    IN TEXT MODE ENCODING DEFAULT
    MESSAGE msg.
    The message I'm getting is "Permission Denied". I have checked authorisation using SU53 which says "The last authorization check was successful". Please help.

    You can use following code to capture the error.
    TRY.
          OPEN DATASET filename FOR OUTPUT IN BINARY MODE MESSAGE V_MSG.
          CATCH CX_ROOT
          INTO EXCEPTION.
          CALL METHOD O_EXCEPTION ->IF_MESSAGE~GET_TEXT
            RECEIVING
            RESULT = V_MSG.
          MESSAGE v_msg
          TYPE 'E'.
    ENDTRY.
    You can capture error in v_msg.
    Following are the exceptions for the same:
    Exceptions
    Catchable Exceptions
    CX_SY_FILE_OPEN
    Cause: The file is already open.
    Runtime Error: DATASET_REOPEN
      CX_SY_CODEPAGE_CONVERTER_INIT   
    Cause: The desired conversion is not supported. (Due to specification of invalid code page or of language not supported in the conversion, with SET LOCALE LANGUAGE.)
    Runtime Error: CONVT_CODEPAGE_INIT
    CX_SY_CONVERSION_CODEPAGE
    Cause: Internal error in the conversion.
    Runtime Error: CONVT_CODEPAGE
    CX_SY_FILE_AUTHORITY
    Cause: No authorization for access to file
    Runtime Error: OPEN_DATASET_NO_AUTHORITY
    Cause: Authorization for access to this file is missing in OPEN DATASET with addition FILTER.
    Runtime Error: OPEN_PIPE_NO_AUTHORITY
      CX_SY_PIPES_NOT_SUPPORTED   
    Cause: The operating system does not support pipes.
    Runtime Error: DATASET_NO_PIPE
    CX_SY_TOO_MANY_FILES
    Cause: Maximum number of open files exceeded.
    Runtime Error: DATASET_TOO_MANY_FILES   Non-Catchable Exceptions   
    Cause: An attempt was made to open a pipe that is already open.
    Runtime Error: DATASET_PIPE_POSITION
    Hope that will help you.
    Please reward if useful.

  • After upgrade to CF9, CFIMAGE "Unable to create temporary file" error

    We recently upgraded from CF8 to CF9 Enterprise.  I'm getting an "Unable to create temporary file" error on
    my CFIMAGE resize calls.  We use sandbox security.  I assume I need to grant write access to whatever folder CF uses for temp files, but which folder is it?   The same code (and sandbox settings) ran fine in CF8....
    Note, if I attempt to add C:\JRun4\servers\cfusion\SERVER-INF\temp to the sandbox for this particular app, CF crashes on all requests across all apps on the server with a:
    Security: The requested template has been denied access to C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\cfclasses\cfapp2ecfc1510154633.c lass.
    The following is the internal exception message: access denied (java.io.FilePermission C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\cfclasses\cfapp2ecfc1510154633.c lass read)
    ColdFusion cannot determine the line of the template that caused this error. This is often caused by an error in the exception handling subsystem.
    I need to restart CF to get everything working again.

    Another update.   Had a problem with a sandboxed CF9 site doing a simple CFIMAGE READ to a memory variable.  Got an "Unable to create temporary file" error.
    Inserted the following code in the file upload page:
    <cfscript>
    writeoutput("Temp Dir : " & createobject("java","java.lang.System").getProperty("java.io.tmpdir") );
    </cfscript>
    ... and it reveals the temp directory as C:\WINDOWS\TEMP.  Added that to the sandbox, and the CFIMAGE READ is working properly now.
    Note this seems inconsistent with CFIMAGE RESIZE behavior which appears to use the CF GetTempDirectory() value, which in my case is C:\JRun4\servers\cfusion\SERVER-INF\temp\cfusion-war-tmp\
    For reference, see the section "Sandbox Considerations" at this link:
    http://help.adobe.com/en_US/ColdFusion/9.0/Admin/WSc3ff6d0ea77859461172e0811cbf364104-7fc8 .html#WSc3ff6d0ea77859461172e0811cbf364104-7fcc

  • Acrobat 8 Pro now unable to create pdf files

    Been using Acrobat 8 for well over a year.  Installed new release of AutoCAD 2012, now unable to create pdf files from AutoCAD or MS Office programs.  Can anybody help?

    You may still want to at least give a repair a shot. Won't hurt and sometimes customer suport (I assume you mean Adobe customer support?) will miss some things. I believe in your version you can find it under the Help menu.
    BtlMage918 wrote:
    No because the
    customer support person I spoke with first said the problem was within the
    creation portion of the program and did not fell that reinstallation or
    deactivate/activate would resolve.
    Charles Blake
    Annette Miller Architects
    204 S. Ludlow St., Suite 310
    Dayton, Ohio 45402
    937.228.7841
    <http://www.amillerarchitects.com/> www.amillerarchitects.com

  • Unable to create PDF - file could not be printed

    I am having a problem with a user who is unable to create a pdf using Adobe Standard 8
    The error messages is as follows:
    your file could not be printed due to an error on adobe pdf on Ne 04
    http://i45.photobucket.com/albums/f97/bsucards/584872418744_adobe.jpg
    I have tried to uninstall Adobe Standard 8 and reinstall and do all the updates
    I have uninstalled Adobe Reader 9 and downgraded it to Adobe Reader 8
    I have reinstalled Office XP
    I have created a new profile for this user
    The only way I can get it to work is to make the user an admin, which is not an option.  We have other users in the company using this version of Adobe without any problems

    Hi I dont think this is a permissions issue I just created a new WINDOWS PROFILE this fixed the issue the user already was a admin on the computer.  The issue was trying to save/print any file to PDF to either network or local to computer.  Once the new profile was made I was able to test and could once again create pdf files.  There must have been something in the old profile causing the issue and the new profile fixed the issue it was a last thing to to try as had tried everything I could think of.

  • URGENT: Is it possible to upload multiple files using STRUTS

    Hi,
    Is it possible to upload multiple files using STRUTS.
    I am able to upload a single file. But how do i upload multiple files ??
    upload.jsp
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
    <%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <html:html>
    <head>
    <title>New Page 1</title>
    </head>
    <body>
    <html:form action="/secure/uploadFile.do" enctype="multipart/form-data" method="POST" type="com.smartstream.webconnect.user.actions.UploadActionForm">
    <p>File to upload
    <html:file property="fileUpload" size="20"/></p>
    <p><html:submit/></p>
    </html:form>
    </body>
    </html:html>
    UploadAction.java
    public class UploadAction extends BaseAction {
        Logger log = Logger.getLogger(AttachMessageAction.class);
        public ActionForward executeAction(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ActionException {
            System.out.println("executeAction of UploadAction");
            UploadActionForm uploadActionForm = (UploadActionForm) form;
            int fileSize = uploadActionForm.getFileUpload().getFileSize();
            System.out.println("uploadActionForm.getFileUpload().getFileSize() = " + uploadActionForm.getFileUpload().getFileSize());
            byte buffer[] = new byte[1024];
            try {
                BufferedInputStream bufferedInputStream = new BufferedInputStream(uploadActionForm.getFileUpload().getInputStream());
                FileOutputStream fos = new FileOutputStream("s:\\uploaded\\" + uploadActionForm.getFileUpload().getFileName());
                int read;
                while ( (read = bufferedInputStream.read(buffer,0,buffer.length)) != -1) {
                    fos.write(buffer, 0, read);
                fos.flush();
                fos.close();
                bufferedInputStream.close();
                return mapping.findForward("success");
            } catch (IOException e) {
                e.printStackTrace();
                return mapping.findForward("error");
            }catch(OutOfMemoryError o){
                o.printStackTrace();
                System.out.println("o.getMessage() " + o.getMessage());
                return mapping.findForward("error");
    UploadActionForm.java
    public class UploadActionForm extends ActionForm{
        private FormFile fileUpload;
        private byte[] fileContent;
        public FormFile getFileUpload() {
            org.apache.struts.taglib.html.FormTag _jspx_th_html_form_0;
            return fileUpload;
        public byte[] getFileContent() {
            return fileContent;
        public void setFileUpload(FormFile fileUpload) {
            this.fileUpload = fileUpload;
        public void setFileContent(byte[] fileContent) {
            this.fileContent = fileContent;
    }--Bhupendra Mahajan

    Yes, you could try using the multipart handler...
    But I have a better idea...
    Determine the maximum number of file uploads that the
    user can do at one time. I mean, you can't
    realistically have the user upload a million files at
    one time. So say the max is 20. So you create your
    action form class with 20 FormFile fields called file1
    to file20.
    Then when you dynamically create your page, you
    dynamically create the specified number of file fields
    and 1 hidden field called "totalFiles" which contains
    the number of file fields you created. This should be
    an int field in the form bean.
    Then when you do your action processing, you just loop
    thru the totalFiles... Or well, actually, you may not
    need that at all. You could just check all the
    FormFile fields and whatever ones aren't null contain
    files.But what about UploadActionForm.java[b]
    How do i have exact mapping of the HTML form in this file ??
    --[b]Bhupendra Mahajan

  • SecurityException: Unable to create temporary file with applet

    My applet tries to write a temp file
    try {
              File temp = java.io.File.createTempFile("student", ".log");
              strFilename = temp.getAbsolutePath();
    } catch (IOException e1) {
              e1.printStackTrace();
    }But when I run, it throws an exception:
    java.lang.SecurityException: Unable to create temporary file
    I tried to sign the applet, as to http://www.developer.com/java/data/article.php/3303561 but it's still the same.
    There's another way: using java.policy,
    grant {
      permission java.security.AllPermission;
    };but it seems to be not very gentle. Could you show me the solution please? Thanks in advance.
    Cheers,

    Yes, that's what I found. Here is the summary to do it, hope it helps someone else:
    1. Create key for signed jar:
    keytool -genkey -keystore abc.com -keyalg rsa -dname "CN=Abc, OU=Def, O=GHI, L=KLMN, ST=OP, C=XY" -alias TheCert -validity 3600 -keypass password -storepass password2. Make jar file
    3. Sign the jar file
    jarsigner -keystore abc.com -storepass password -keypass password -signedjar SignedAppletTest.jar OrgAppletTest.jar TheCertIt works for me.
    I'd like to thank harmmeijer and everyone who interests.
    Cheers,

  • Can't create a file using fm 'File_Get_Name'

    hi gurus,
    Can you please help me with this issue. There's a program that have to create a file using the said fm. It was working before when it was set in OS NT. But when the settings and codes have been changed to UNIX, the program was able to generate the program. But the file doesn't exist. It seems it  doesn't create a file in that server.
    What else do I need to check?
    Points will be rewarded. Thanks
    Here's the code for your reference:
    CALL FUNCTION 'FILE_GET_NAME'
           EXPORTING
    *         CLIENT                  = SY-MANDT
                logical_filename        = 'Z_SYSBRIDGE' 
             OPERATING_SYSTEM        = SY-OPSYS
    *         PARAMETER_1             = ' '
    *         PARAMETER_2             = ' '
    *         USE_PRESENTATION_SERVER = ' '
    *         WITH_FILE_EXTENSION     = ' '
    *         USE_BUFFER              = ' '
           IMPORTING
    *         emergency_flag          =
    *         file_format             =
                file_name               = ltfile-out_path
           EXCEPTIONS
                file_not_found          = 1
                OTHERS                  = 2.

    Hi Maui,
    Did you check SM69, where the code that ties to this FM creates a file after it execute your FM...
    SM69 are os commands that does UNIX execution or other OS commands...
    or maybe you have missed another FM like FM 'SXPG_OS_COMMAND' or of some sort.
    Thanks
    William Wilstroth

  • Rep-0118:Unable to create temporary file error in Report Builder

    I have installed Report Builder (latest edition) for windows 2000 server, but my users on windows XP cannot create the report it gives them
    Rep-0118:Unable to create temporary file error
    Please help me out
    Vijay

    You have to change registry settings by going through REGEDIT. Under hkey_local_machine/software/oracle/<oracle home>, look for variable REPORTS_TMP. Change value for this, for example c:\windows\temp or something like that where you want oracle reports to create temp files.

  • Creating new file using report generation express vi

    Hello,
    In my application, I need to write certain data in excel sheet. For that I created an excel template and I used the express vi in report generation toolkit to save the appropriate data in appropritate columns. I need a new file created everyday by that day's name and write the data to it rest of the day. I am having problems creating new file using this express vi. I tried using the low level vi's but not been able to it properly.
    Attaching my code and excel template.
    Please help.
    Thanks!
    Solved!
    Go to Solution.
    Attachments:
    excel write2.vi ‏119 KB
    Book2111.xltx ‏8 KB

    r_te wrote:
    The thing is everyday there cannot be a file provided.
    Sure there can.  Don't you see the input on the Express VI for a file? "Path To Save Report" is the name of the input you want.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Unable to check-in file using CHECKIN_UNIVERSAL in UCM11g through SOA

    Hello all,
    I am unable to checkin/uploading files using CHECKIN_UNIVERSAL in UCM 11g through SOA. I am getting below error:
    error">Error: java.lang.NullPointerException
    Below are invoke operation that I am using:
    <messages>
    <Invoke_Generic_Soap_Port_Ref_GenericSoapOperation_InputVariable>
    <part  name="GenericRequest">
    <GenericRequest  webKey="cs">
    <tns:Service  IdcService="CHECKIN_UNIVERSAL">
    <tns:Document>
    <tns:File  name="primaryFile"  href="/u01/app/oracle/ftp/test/Test_UCM_Upload.txt"/> 
    </tns:Document>
    </tns:Service>
    </GenericRequest>
    </part>
    </Invoke_Generic_Soap_Port_Ref_GenericSoapOperation_InputVariable>
    <Invoke_Generic_Soap_Port_Ref_GenericSoapOperation_OutputVariable>
    <part  name="GenericResponse">
    <ns2:GenericResponse  webKey="cs">
    <ns2:Service  IdcService="CHECKIN_UNIVERSAL">
    <ns2:Document>
    <ns2:Field  name="error">Error: java.lang.NullPointerException</ns2:Field> 
    </ns2:Document>
    </ns2:Service>
    </ns2:GenericResponse>
    </part>
    </Invoke_Generic_Soap_Port_Ref_GenericSoapOperation_OutputVariable>
    </messages>
    Can anyone help me out please.
    -Ayan

    Hi TDN,  
    Thanks for your post.
    You’re using TFS 2013 Update 4 and VS 2013 Update 4?
    According the error message, it seems TFS Server think this file is not changed.
    After step 8, if there’s the edited icon shows on your testfile1.txt in Source Control Explorer?
    Please click Refresh button in your Source Control Explorer, then re-edit your testfile1.txt file and try check-in again.
    And try to reproduce this scenario on your another client(VS 2013 installed), check if this issue can be reproduce on another client or not.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • I am trying to find out how to assign files with particular extensions to the appropriate software. At the moment when I create a file using Word it is apparently given the extension .docx but Word doesn't recognise its own files. How do I alocate th

    I am trying to find out how to assign files with particular extensions to the appropriate software. At the moment when I create a file using Word it is apparently given the extension .docx but Word doesn't recognise its own files. How do I allocate the extension .docx to Word? There used to be a way of doing it, I think under "Preferences" but I can't seem to find it.

    Still in the same location:
    File > Get Info > Open with (select) > Change All (button)

  • No ability to create PDF Files using Acrobat 6.01_6.06 after installing Word 2010. (Windows XP)

    Since installing Word 2010 (upgrading from Word 2003) there are no visable PDF Icons nor ability to create PDF Files using Adobe Acrobat 6.06.  Operating system is Windows XP.  Browser is IE8.  Various attempts to bypass this situation have not been successful.  No problems had been experienced earlier using Acrobat 6.01 through 6.06 with Word 2003 and earlier Word versions during the passed 10 years or so.  Adobe's support is not responding to recognize mentioned situations, nor is there any a solution to fix the problem.  Low volume small businesses,with limited need to create PDF files, are being considerably burdened to substante a $200 investment to upgrade to Acrobat X, which may as well not be the solution.  It is appealed for Adobe Forums readers to share similar experiences with possible fixes at hand.  Responses will be greatly appreciated.  Thank you...

    Your response is greatly appreciated, Bernd...
    Unfortunately, those of us who milk software packages for eons such as
    Acrobat 6.06 Standard, a full version of Acrobat X is quoted to be $299
    with no ability to upgrade since 7.0 is the cutoff which remains to be
    only $139.
    It seems to me, Military personal, retired or just ole toots who did
    their think, would offer considerations such as Staples, Lowe's, and
    other big boxes offer.  Such is greed for some who do not consider 
    alternatives above their noses...
    Thank you,
    Skip

  • I am unable to create adobe file from attached document from email

    I am unable to create adobe file from attached document from email. No 'open in' link is available as given in directions. What to do?

    Because there is no abode on the IOS.  you'll need to do a search in the app store to resolve your issue.

  • Hi Folks,   I have a problem with OBIEE EM, There in Enterprise Manager i am unable to navigate into the options like when i clik on any Tab it is not working and even  i am unable to create a report using analysis.

    Hi Folks,
      I have a problem with OBIEE EM, There in Enterprise Manager i am unable to navigate into the options like when i clik on any Tab it is not working and even  i am unable to create a report using analysis.
    Thanks in advance

    i have also tried that but no use can u give me any other way.......

Maybe you are looking for