FileUpload Help

I have installed the jakarta FileUpload.
I have spent a couple of days trying to get the sample file upload to work. Did web search and forum searches. However could not find any solutions to my error.
My FileUpload.java
package com.upload;
import org.apache.commons.fileupload.*;
import java.lang.*;
import java.util.*;
import java.io.*;
import java.io.FileWriter;
import javax.servlet.http.*;
import javax.servlet.*;
public class FileUpload {
    public void doPost(HttpServletRequest req, HttpServletResponse res)
        DiskFileUpload fu = new DiskFileUpload();
        // maximum size before a FileUploadException will be thrown
        fu.setSizeMax(1000000);
        // maximum size that will be stored in memory
        fu.setSizeThreshold(4096);
        // the location for saving data that is larger than getSizeThreshold()
        fu.setRepositoryPath("/temp");
        List fileItems = fu.parseRequest(req);
        // assume we know there are two files. The first file is a small
        // text file, the second is unknown and is written to a file on
        // the server
        Iterator i = fileItems.iterator();
        String comment = ((FileItem)i.next()).getString();
        FileItem fi = (FileItem)i.next();
        // filename on the client
        String fileName = fi.getName();
        // save comment and filename to database
        // write the file
     fi.write("/unzipped/" + fileName);
}My error:
C:\Tomcat 5.0\webapps\ROOT\WEB-INF\classes\com\upload\FileUpload.java:44: write(java.io.File) in org.apache.commons.fileupload.FileItem cannot be applied to (java.lang.String)
fi.write("/unzipped/" + fileName);
^
1 error
Tool completed with exit code 1
Any help would be appreciated.

Hi,
This is taken from the apache website
http://jakarta.apache.org/commons/fileupload/apidocs/index.html
Normal usage example:
    public void doPost(HttpServletRequest req, HttpServletResponse res)
        DiskFileUpload fu = new DiskFileUpload();
        // maximum size before a FileUploadException will be thrown
        fu.setSizeMax(1000000);
        // maximum size that will be stored in memory
        fu.setSizeThreshold(4096);
        // the location for saving data that is larger than getSizeThreshold()
        fu.setRepositoryPath("/tmp");
        List fileItems = fu.parseRequest(req);
        // assume we know there are two files. The first file is a small
        // text file, the second is unknown and is written to a file on
        // the server
        Iterator i = fileItems.iterator();
        String comment = ((FileItem)i.next()).getString();
        FileItem fi = (FileItem)i.next();
        // filename on the client
        String fileName = fi.getName();
        // save comment and filename to database
        // write the file
        fi.write(new File("/www/uploads/", fileName)); // your problem lies here - the write method needs a java.io.File parameter not a java.lang.String parameter as you have specified.
    }Regards,
bazooka.

Similar Messages

  • Help me out to get the jar files for FileUpload using MyFaces.

    hi,
    Can anyone help to get the jar files for FileUpload using MyFaces.
    I want myfaces-extensions.jar and commons-fileupload-1.0.jar.
    Thank you.

    you can't control the speed of a for-loop.
    you can remove your code from a for-loop and use a function to execute the code in your for-loop and you control how frequently you call the function.

  • Need Help on FileUpload/FileDownload

    Hi experts,
    Iam new to Web Dynpro ABAP. I want to know how to use FileUpload UI element to store file at specified path in server. Using FileDownLoad I should be able to download the file. I know how to do it in WDJava ..
    But I need related code for doing it in WDABAP
    Please share some code here
    Thanks in advance
    Lakshmi

    Hi,
    Chek this standard document
    http://help.sap.com/saphelp_nw70/helpdata/EN/b3/be7941601b1d09e10000000a155106/frameset.htm
    Also check these forum threads
    Re: download a file
    File Upload/Download
    File download in Local PC
    Re: File Download to Excel
    for file upload control you can look at WDR_TEST_EVENTS component
    Edited by: suman kumar chinnam on Sep 29, 2008 12:30 PM

  • Help in mutlipart post FIle Upload using Apache FileUpload

    Hi there,
    I am using the FileUpload class of Apache and getting an issue when I try to write the multipart post data (file) into a physical disk on the server. I am attaching herewith the servlet code. The error I get when I compile the code is:
    Information: 1 error
    Information: 0 warnings
    Information: Compilation completed with 1 errors and 0 warnings
    C:\unzipped\commons-fileupload-1.0-src\commons-fileupload-1.0\src\java\FileUpload.java
    Error: line (80) write(java.io.File) in org.apache.commons.fileupload.FileItem cannot be applied to (java.lang.String)
    C:/unzipped/commons-fileupload-1.0-src/commons-fileupload-1.0/src/java/FileUpload.java:80: write(java.io.File) in org.apache.commons.fileupload.FileItem cannot be applied to (java.lang.String)
    Any help would be greatly appreciated.
    Thanks
    John

    are you calling the writeFile method trying to pass a String instead of a File object?

  • Help with fileupload (apache commons)

    Hey everyone,
    Im having some trouble with uploading mulitple files using the apache commons lib. It will only upload the first one! I bet im missing somthing stupid, but if someone could point out my mistake it would be great. Thanks ahead on time.
    JSP form:
    <form method=POST action="LunchFrontController" enctype="multipart/form-data">
            XML Menu<input type = "file" name="file"><br>
            Image Menu<input type = "file" name="file2"> <br>
            <input type=hidden name="<%=BeanNames.JSP_NAME%>" value="RestaurantUploader.jsp">
             <input type="submit" name="Submit">
    </form>Upload code:
    public String loadFile(HttpServletRequest request, ServletContext ctx) {
         boolean isMultipart = FileUpload.isMultipartContent(request);
         if(isMultipart) {
              List items = null;
              DiskFileUpload upload = new DiskFileUpload();
              upload.setSizeMax(500000);
              try {
                   items = upload.parseRequest(request);
                   Iterator iter = items.iterator();
                   while(iter.hasNext()) {
                         FileItem item = (FileItem) iter.next();
                         System.out.println(item);
                         if(!item.isFormField()) {
                               String name = item.getName();
                               String ext = name.substring(name.lastIndexOf(".")+1);
                               //if(ext.equals("xml") || ext.equals("jpg")) {
                                    String fileName = (String)ctx.getAttribute(BeanNames.FILE_URL);
                                    File f = new File(fileName + "//" + name);
                                       FileOutputStream fout = new FileOutputStream(f);
                                fout.write(item.get());
                                fout.close();
                                return item.getName();
                   catch(Exception e) {
                        e.printStackTrace();
              return "";
         }

    LOL found out what i did wrong last week, just posting the answer in case anyone was interested in the code... it would be nice if took out the return statement in the middle :)

  • PLEASE HELP WITH FILEUPLOADING

    Hi all,
    I Want to upload multiple files that I put in a java.util.list when the user explore and select the file and push a button.
    When the user do this (first file and push attach,second...,), it's necessary to put another button to send to the server the files in the List.
    Everything it's correct but when I try in the secon process to do:
    uploadedFile.write(file);
    It's trowing a exception with no detail.
    Here is my code:
    PROCESS TO PUT IN THE LIST---
    public String btnadjuntar_action() {
    UploadedFile uploadedFile = fileUpload1.getUploadedFile();
    this.getSessionBean1().getListaarchivos().add(uploadedFile);
    PROCESS TO RETRIEVE FROM LIST AND WRITE TO SERVER--
    public String button3_action() {
    try{
    Iterator iter=this.getSessionBean1().getListaarchivos().iterator();
    while ( iter.hasNext()) {
    UploadedFile uploadedFile =(UploadedFile)iter.next();
    String uploadedFileName = uploadedFile.getOriginalName();
    // algunos navegadores devuelven el nombre completo de la ruta, otros no
    // aseg�rese de que s�lo aparezca el nombre del archivo
    String justFileName = uploadedFileName.substring
    ( uploadedFileName.lastIndexOf(File.separatorChar) + 1 );
    ServletContext theApplicationsServletContext =
    (ServletContext) this.getExternalContext().getContext();
    String realPath="//PTL-ITM2/CONTROLSOPORTE/";
    String Extension=justFileName.substring(justFileName.lastIndexOf("."));
    String NombreArchivo=justFileName.substring(0,justFileName.lastIndexOf("."));
    String NombreFinal=NombreArchivo+"_copia"+Extension;
    File file = new File(realPath + File.separatorChar +
    NombreFinal);
    uploadedFile.write(file);
    catch (Exception E){
    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN,"Error de acceso:", E.getMessage()));
    pageAlert1.setDetail(E.getMessage());
    pageAlert1.setVisible(true);
    return null;
    ANY IDEAS ?
    Thank's in advance!!

    Still stuck huh? I don't think your method would work, but you may prove me wrong. See below please and I will try to write in simple terms friend.
    >
    public String btnadjuntar_action() {
    UploadedFile uploadedFile =
    fileUpload1.getUploadedFile();
    his.getSessionBean1().getListaarchivos().add(uploadedFile);
    }What you are adding here is not the actual bytes of the file, you are just adding some metadata (general information like file name, location ...). As soon as you press a button or a link, that file would better be persisted (serialized, written to) the server because as you go through those six life-cycle (or less) steps of submitting a JSF page, that information is lost.
    To check, see if you have anything written to the server, for even if you have some runtime errors, an uploaded file could still be written to the server.
    So, all that code below where you are iterating over your archive to get your files one by one is probably never even reached, and you should be able to check for that (write some info("...") statements followed by a return statement to see how far your reach).
    >
    public String button3_action() {
    try{
    Iteratoriter=this.getSessionBean1().getListaarchivos().iteratr();
    while ( iter.hasNext()) {...

  • Urgent Help In ABAP

    Hi Gurus,
    Please i need an urgent help from you guys. There is a demand file which consits of (Siteno(plant), Item No ,Item Description, Delivery due date) will be placed in a unix system or windows system. I need to write an interface which shows a radiobutton for unix & windows and fileupload button & download button.When user clicks should be able to select only one radiobutton (unix or windows) to upload or download.When the user clicks the fileupload / download button,it should pick up the file or drop the file at particular unix or windows system.
    Please help me or give me sample code where in i can select the radiobutton and i can upload / download from unix or windows path. and during upload process (for both unix/windows) ,i should be able to persist into a custom table (ztable,if iam not wrong) and while downloading read the records from custome table and create an excel file to be placedon unix/windows based on the radio button.
    Thanks in advance, i need ur help please.
    Regards
    Bruno

    Hi Bruno,
    Please checkout this code sample
    ABAP code for uploading a TAB delimited file into an internal table.
    The code is base on uploading a simple txt file.
    <b>
    http://www.sapdevelopment.co.uk/file/file_uptabpc.htm</b>
    Thanks,
    Aby

  • Can you help me with these exceptions??

    Hi guys,
    from sunday i try to eliminate these exceptions from my jsf application and i've lost any confidence in my possibility to realize it.....
    It's surely a simple problem but i'm a newbie of jsf and java.
    These are the exadel msg
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: #{MyBean.retrieveblob}: javax.faces.el.EvaluationException: java.lang.NullPointerException
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:209)
         org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
    root cause
    javax.faces.FacesException: #{MyBean.retrieveblob}: javax.faces.el.EvaluationException: java.lang.NullPointerException
         com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:78)
         javax.faces.component.UICommand.broadcast(UICommand.java:312)
         javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)
         javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381)
         com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
         com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
         org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
    ant these are the files
    MyBean.java
    package giu;
    import org.apache.myfaces.custom.fileupload.UploadedFile;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.sql.Blob;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.StringTokenizer;
    import java.util.Vector;
    public class MyBean {
         private UploadedFile myFile;
         private String geneid=null;
        private int row=0;
        private int numberOfNumericColumns=0;
        private int col=0;
        String[]intest=null;
        private ArrayList rows = new ArrayList();
        Head h;
        byte middlerow=' ';
        byte endrow=';';
        byte[] data=null;
        Vector temp=new Vector(100000);
        String g=null;
        Riga r;
        Double val[];
        private String[] arraylinee;
        public boolean insRighe(Riga nuovo){
               return rows.add(nuovo);
        public List stampaRows(){
             return rows;}
        public Head stampaHead(){
             return h;}
        public byte[] getdata(){
             return data;
        public UploadedFile getMyFile() {
            return myFile;
        public void setMyFile(UploadedFile myFile) {
            this.myFile = myFile;
        public int getcol(){
             return col;
        public void setcol(int col){
             this.col=col;
        public int getrow(){
             return row;
        public void setrow(int row){
             this.row=row;
        public String[] getarraylinee(){
             return arraylinee;
        public void setarraylinee(String[] arraylinee){
             this.arraylinee=arraylinee;
    public String retrieveblob(){
              Database2 db = new Database2("nomeDB","root","shevagol");     
              try
              Connection dbo=db.getConnection();
              System.out.println("eccezione buona2");
                   System.out.println("eccezione buona2,5");
                   Statement st = dbo.createStatement();
                   System.out.println("eccezione buona3");
                   ResultSet rs;
                   rs = st.executeQuery("SELECT Data FROM tbl WHERE Nome='16'");
                   rs.first();
                   Blob blob = rs.getBlob("Data");
                   byte[] read = blob.getBytes(1, (int) blob.length());
                   st.close();
                   String lettura=new String(read);
                   String[] arraylinee=lettura.split(";");
                   /*for (int i = 0; i < arraylinee.length; i++) {
                     System.out.println(arraylinee);
              catch(SQLException e)
                   System.out.println("Si � verificato il seguente errore: " + e.getMessage());
                   e.printStackTrace();
              return "retrOk";
    This is my result.jsp page
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <%@ page import="giu.MyBean" %>
    <%-- Instantiate class --%>
    <jsp:useBean id="myBean" class="giu.MyBean" scope="request"/>
    <html>
         <head>
              <title></title>
         </head>
         <body>
              <f:view>
                   <c:forEach items="${myBean.arraylinee}" var="linea" >
    <tr>
    <td>
    <c:out value="${linea}" />
    </td>
    </tr>
    </c:forEach>
              </f:view>
         </body>     
    </html>
    and these are web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC
    "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
         <context-param>
              <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
              <param-value>client</param-value>
         </context-param>
         <filter>
              <filter-name>ExtensionsFilter</filter-name>
              <filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
              <init-param>
                   <param-name>uploadMaxFileSize</param-name>
                   <param-value>100m</param-value>
              </init-param>
              <init-param>
                   <param-name>uploadThresholdSize</param-name>
                   <param-value>100k</param-value>
              </init-param>
         </filter>
         <filter-mapping>
              <filter-name>ExtensionsFilter</filter-name>
              <servlet-name>FacesServlet</servlet-name>
         </filter-mapping>
         <servlet>
              <servlet-name>FacesServlet</servlet-name>
              <servlet-class>
              javax.faces.webapp.FacesServlet</servlet-class>
              <load-on-startup>1</load-on-startup>
         </servlet>
         <servlet-mapping>
              <servlet-name>FacesServlet</servlet-name>
              <url-pattern>/faces/*</url-pattern>
         </servlet-mapping>
         <servlet-mapping>
              <servlet-name>FacesServlet</servlet-name>
              <url-pattern>*.faces</url-pattern>
         </servlet-mapping>
         <welcome-file-list>
              <welcome-file>index.jsp</welcome-file>
         </welcome-file-list>
    </web-app>
    and faces-config.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
                                  "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
    <faces-config>
    <managed-bean>
      <managed-bean-name>MyBean</managed-bean-name>
      <managed-bean-class>giu.MyBean</managed-bean-class>
      <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>
    <navigation-rule>
      <from-view-id>/pages/MyForm.jsp</from-view-id>
      <navigation-case>
       <from-outcome>success</from-outcome>
       <to-view-id>/pages/MyResult.jsp</to-view-id>
      </navigation-case>
    </navigation-rule>
    <navigation-rule>
      <from-view-id>/pages/Login.jsp</from-view-id>
      <navigation-case>
       <from-outcome>Ok</from-outcome>
       <to-view-id>/pages/Menu.jsp</to-view-id>
      </navigation-case>
    </navigation-rule>
    <navigation-rule>
      <from-view-id>/pages/Menu.jsp</from-view-id>
      <navigation-case>
       <from-outcome>upload</from-outcome>
       <to-view-id>/pages/MyForm.jsp</to-view-id>
      </navigation-case>
      <navigation-case>
       <from-outcome>admin</from-outcome>
       <to-view-id>/pages/UserForm.jsp</to-view-id>
      </navigation-case>
      <navigation-case>
       <from-outcome>view</from-outcome>
       <to-view-id>/pages/ViewForm.jsp</to-view-id>
      </navigation-case>
      <navigation-case>
       <from-outcome>register</from-outcome>
       <to-view-id>/pages/Register.jsp</to-view-id>
      </navigation-case>
    </navigation-rule>
    <navigation-rule>
      <from-view-id>/pages/ViewForm.jsp</from-view-id>
      <navigation-case>
       <from-outcome>Result</from-outcome>
       <to-view-id>/pages/Result.jsp</to-view-id>
      </navigation-case>
    </navigation-rule>
    </faces-config>I hope someone can helps me...............
    P.S.
    Can someone says me a good program to debug my applications...?
    I try with exadel but i find it bit intuitive....

    I don't know JSF, but it appears you haven't included part of your application - the one causing the error with the line: #{MyBean.retrieveblob}
    I would assume the error is that you instantiate the bean with the name "myBean" (<jsp:useBean id="myBean" class="giu.MyBean" scope="request"/>) then refer to it as "MyBean". Java is case sensitive.

  • Sending an email with attachments in Java using FileUpload UI Element

    Hello Experts,
    I'm using NWDS 7.01 SP6.
    I have an application that has a FileUpload ui element. The elements resource property is bound to a context node of type Resource from the Local Dictionary from uielementsdefinitions.
    The question I have is, how can I take the uploaded file from the context, and attach it to an email using the javax.mail.* api?
    Do I need to store it somewhere first or can it be taken directly from the context attribute? If I need to store it, where do I store it? 
    Any help or suggestions are appreciated.
    Thanks
    MM

    Hello Experts,
    I'm using NWDS 7.01 SP6.
    I have an application that has a FileUpload ui element. The elements resource property is bound to a context node of type Resource from the Local Dictionary from uielementsdefinitions.
    The question I have is, how can I take the uploaded file from the context, and attach it to an email using the javax.mail.* api?
    Do I need to store it somewhere first or can it be taken directly from the context attribute? If I need to store it, where do I store it? 
    Any help or suggestions are appreciated.
    Thanks
    MM

  • Help please to Upload a file from my PC to server's KM

    Hello:
    I can't Upload correctly a file from my local PC to a KM of the server.
    My problem is after that I've uploaded any file from my PC to KM, sometimes when I open or download it from the KM appears blank, and when I try another way to write the file (out.write()) I've uploaded a bad file that can't be downloaded or opened it. I can't get the file Data of the file for uploading, I need to set it with the fileResource (I tried with fileResource.read(false))
    I use a FileUpload in my view.
    <b>My Context:</b>
    File (node)
         |----fileResource  (com.sap.ide.webdynpro.uielementdefinitions.Resource)
         |----fileData  (binary)   
         |----fileName  (String)
    wdDoInit(){
         IPrivateUploadDownloadKMView.IFileElement fileBind = wdContext.createFileElement();
         wdContext.nodeFile().bind(fileBind);
         IWDAttributeInfo attInfo = wdContext.nodeFile().getNodeInfo().getAttribute("fileData");
         ISimpleTypeModifiable type = attInfo.getModifiableSimpleType();
    onActionSubir(){
          IPrivateUploadDownloadKMView.IFileElement fileElement = wdContext.currentFileElement();
          IWDResource resource = fileElement.getFileResource();
          fileElement.setFileName(resource.getResourceName());
          fileElement.setFileData(fileData);
          byte[] fileData=new byte[resource.read(false).available()];
          fileElement.setFileData(fileData);
          fileName = fileElement.getFileName();
         try{               
               File file = new File(fileName);
               FileOutputStream out = new FileOutputStream(file);
               out.write(fileElement.getFileData());
               out.close();
               fin = new FileInputStream(fileName);
               fin.read();
               Content content = new Content(fin,null, -1);
                IResource newResource = folder.createResource(fileElement.getFileName(),null, content);
          catch(Exception e){
                 IWDMessageManager mm = wdControllerAPI.getComponent().getMessageManager();
                 mm.reportWarning("error: "+e.getMessage());
    Can you help me?, any sugestions to solve my problem or improve my code?
    Regards
    Jonatan.

    If you have got the permission to access <b>content management</b> in portal appliction server consle,then click on content management >select the KM Repository and clik on it.Then right click on <b>folder</b>>new-->upload.After clicking the upload option one page will be open and then you can browse your local file and upload to the KM Repository.

  • Please Help me in solving this issue. i am a newbie to coldfusion

    i want to use a single home page where i will show a form (which is in another file) to user to upload a file,after uploading (action file result) i want to show result of upload also on the same page.
    these are my three files:
    1. index.cfm
    <!-- start -->
    <html>
    <head>
    <title>HomePage</title>
    <cfajaximport tags="CFFORM">
    </head>
    <body>
    <cfdiv id="Main" style="width:1000px; height:600px" >
            <cfdiv id="Options" style=" width:100%;height:20%" >
                Welcome Admin, <a href="javascript:ColdFusion.navigate('FileUpload.cfm','Content')" class="settings">Update  </a><a href="#" class="logout">Logout</a>
            </cfdiv>
            <cfdiv id="Content" style=" width:100%;height:80%">
    <h2>Here Goes Form and FileUploading</h2>
            </cfdiv>
    </cfdiv>
    </body>
    </html>
    <!--  -->
    2.FileUpload.cfm
    <!-- start -->
    <html>
        <head>
            <title>
                Upload A File
            </title>
        </head>
        <body >       
    <cflayout type="vbox" name="layout1">
    <cflayoutarea>
        <cfform  enctype="multipart/form-data"  action="FileReceiver.cfm" >
                            File To Upload:
                            <cfinput type="file" name="Filename" size="50" >
                 <br/>       
                            <cfinput type="submit" name="UploadFile" value="UPLOAD THIS FILE">
                    <br/>
            </cfform>
    </cflayoutarea>
    <cflayoutarea>       
        <table border="1" >
                <tr>
                <th >
                    Directory Information
                </th>
                </tr>
                <tr>
                    <td>
                    <cfoutput >
                        CurrectDirectory Path: #getdirectoryFromPath(expandPath("index.cfm"))#
                    </cfoutput>
                    </td>
                </tr>
            </table>
    </cflayoutarea>
    </cflayout>
        </body>
    </html>
    <!-- -->
    3.FileReceiver.cfm
    <!---start-->
    <cfif isdefined('UploadFile')  >
    <cfoutput >
    <cffile nameconflict="makeunique"
    action="upload"
    filefield="Form.Filename"
    destination="#getdirectoryFromPath(expandPath("index.cfm"))#" > <!--- or destination="c:\Upload\"--->
            File upload was successful!
    </cfoutput>
    </cfif>
    <!-- -->
    when i click on "update link" index page shows the FileUpload.cfm page in one of its container but while uploading file
    i always get ERROR MESSAGE:
    Error retrieving markup for element cf_layoutarea736558924094373 : Invalid content type: application/x-www-form-urlencoded; charset=UTF-8. [Enable debugging by adding 'cfdebug' to your URL parameters to see more information]
    Kindly Help me doing it right...i am unable to figure out problem ...

    Ah, I found the cause of the issue: Coldfusion stores the properties of user-interface tags like cfdiv and cflayoutarea in the form scope. That is what is destroying your upload form. To see it, run the following test code:
    <cfdump var="#form#">
    <cflayout type="vbox" name="layout1">
    <cflayoutarea name="myLayoutArea123">
    <cfform >
    <cfinput type="submit" name="submit" value="Test by posting form to same page.">
    </cfform>
    </cflayoutarea>
    </cflayout>
    Now, the search for a possible solution.

  • Error in my build.xml file (help with spotting syntax error requested)

    Hi
    I have written an XML file called build.xml for one of my applications. My XML editor complains that there is an error at the last line of the XML file, but I simply find it unable to correct the errror.
    It says:
    Fatal error:Build.xml[76:3-9]: End-Tag without start-tag
    The XML file itself:
    <project basedir="." default="deploy" name="concepts">
    <property name="src.dir" value="src"></property>
    <property name="build.dir" value="${basedir}/build"></property>
    <property name="build.lib" value="${build.dir}/lib"></property>
    <property name="dist.dir" value="dist"></property>
    <property name="classes.dir" value="${build.dir}/classes"></property>
    <property name="build.etc" value="${src.dir}/etc"></property>
    <property name="build.resources" value="${src.dir}/resources"></property>
    <property name="lib.dir" value="lib"></property>
    <property name="web-inf.dir" value="WEB-INF"></property>
    <property name="war.name" value="concepts"></property>
    <property file="../common.properties"></property>
    <target name="init">
    <mkdir dir="${build.dir}"></mkdir>
    <mkdir dir="${classes.dir}"></mkdir>
    <mkdir dir="${dist.dir}"></mkdir>
    </target>
    <target name="deploy" depends="clover-yes, clover-no">
    <javac srcdir="${src.dir}" destdir="${classes.dir}" classpath="${libs}" debug="off" optimize="on" deprecation="on" compiler="${compiler}">
    <include name="org/apache/commons/fileupload/**/*.java" />
    <include name="com/portalbook/portlets/**/*.java" />
    <include name="com/portalbook/portlets/content/**/*.java" />
    </javac>
    <target depends="init" name="compile">
    <javac debug="true" deprecation="true" destdir="${classes.dir}" optimize="false">
    <src>
    <pathelement location="${src.dir}"></pathelement>
    </src>
    <classpath>
    <fileset dir="${lib.dir}">
    <include name="*.jar">
    </include>
    </fileset>
    </classpath>
    </javac>
    </target>
    <target depends="compile" name="war">
    <war destfile="${dist.dir}/${war.name}.war" webxml="WEB-INF/web.xml">
    <classes dir="${classes.dir}"></classes>
    <lib dir="${lib.dir}"></lib>
    <webinf dir="${web-inf.dir}"></webinf>
    </war>
    </target>
    <!-- create the portal-concepts-lib.jar -->
    <jar jarfile="${build.lib}/concepts-lib.jar">
    <fileset dir="${classes.dir}"></fileset>
    </jar>
    <jar jarfile="${build.lib}/concepts.war" manifest="${build.etc}/concepts-war.mf">
    <fileset dir="${build.resources}/concepts-war"></fileset>
    </jar>
    <!-- concepts.ear -->
    <copy todir="${build.resources}/concepts-ear">
    <fileset dir="${build.lib}" includes="concepts.war,concepts-lib.jar"></fileset>
    </copy>
    <jar jarfile="${build.lib}/concepts.ear">
    <fileset dir="${build.resources}/concepts-ear" includes="concepts.war,concepts-lib.jar">
    </fileset>
    </jar>
    <target depends="deploy" name="explode">
    <taskdef classname="org.jboss.nukes.common.ant.Explode" classpath="${libs}" name="explode"></taskdef>
    <explode file="${build.lib}/concepts.ear" name="concepts.ear" todir="${build.lib}/exploded"></explode>
    </target>
    <target depends="war" name="all"></target>
    <target name="clean">
    <delete dir="${build.dir}">
    </delete>
    <delete dir="${dist.dir}">
    </delete>
    </target>
    </project>
    I am a little inexperienced in XML files. So I am unable to spot the error.
    I would greatly appreciate it, if some kind soul were to help me out.
    thanks a lot

    The tag
    <target name="deploy" depends="clover-yes, clover-no">...is never closed.
    close that tag:
    <target name="deploy" depends="clover-yes, clover-no">
         <javac srcdir="${src.dir}" destdir="${classes.dir}" classpath="${libs}" debug="off" optimize="on" deprecation="on" compiler="${compiler}">
              <include name="org/apache/commons/fileupload/**/*.java" />
              <include name="com/portalbook/portlets/**/*.java" />
              <include name="com/portalbook/portlets/content/**/*.java" />
         </javac>
    </target>Second error is that the depends in there (clover-yes, clover-no) are not existing as targets in your xml.

  • Guys Plz help me......its urgent

    Hi,
    I created a project with name "tech" n Enterprise application project name "techEAR".I am using RAD.
    i placed JSF related jars in tech/WebContent/ WEB-INF/lib folder.and placed my application related jars in techEAR.
    And i selected all my application jar files from tech->properties->java JAR Dependencies.And selected these jars from
    tech->properties->java buildpath->Order and Export.
    when i run my application sample JSF page it is looking for one of my application jar file in WEB-INF/lib but it is already
    in techEAR.i am getting problem with that jar file only, there is no problem with other jar files.i dont know why i am
    getting this problem.
    If i placed that jar file in WEB-INF/lib, the application works fine.But as my project developement, i should place that jar
    in techEAR only.please help me.
    the error its displaying is:
    com.navtech.util.rsa.jsf.tag.CommandButtonTag This is often caused by having the class at a higher point in the classloader
    hierarchy Dumping the current context classloader hierarchy: ==> indicates defining classloader *** indicates classloader
    where the missing class could have been found ***[0]
    com.ibm.ws.classloader.CompoundClassLoader@628e451c Local ClassPath:
    C:\projects\Apps\tech\WebContent\WEB-INF\classes;C:\projects\Apps\tech\WebContent\WEB-INF\lib\commons-beanutils.jar;C:\projec
    ts\Apps\tech\WebContent\WEB-INF\lib\commons-collections.jar;C:\projects\Apps\tech\WebContent\WEB-INF\lib\commons-digester.jar
    ;C:\projects\Apps\tech\WebContent\WEB-INF\lib\commons-fileupload.jar;C:\projects\Apps\tech\WebContent\WEB-INF\lib\commons-lan
    g.jar;C:\projects\Apps\tech\WebContent\WEB-INF\lib\commons-logging.jar;C:\projects\Apps\tech\WebContent\WEB-INF\lib\commons-v
    alidator.jar;C:\projects\Apps\tech\WebContent\WEB-INF\lib\jakarta-oro.jar;C:\projects\Apps\tech\WebContent\WEB-INF\lib\jaxen-
    full.jar;C:\projects\Apps\tech\WebContent\WEB-INF\lib\jsf-api.jar;C:\projects\Apps\tech\WebContent\WEB-INF\lib\jsf-ibm.jar;C:
    \projects\Apps\tech\WebContent\WEB-INF\lib\jsf-techpl.jar;C:\projects\Apps\tech\WebContent\WEB-INF\lib\jstl.jar;C:\projects\A
    pps\tech\WebContent\WEB-INF\lib\jstl_el.jar;C:\projects\Apps\tech\WebContent\WEB-INF\lib\saxpath.jar;C:\projects\Apps\tech\We
    bContent\WEB-INF\lib\standard.jar;C:\projects\Apps\tech\WebContent\WEB-INF\lib\struts.jar;C:\projects\Apps\tech\WebContent\WE
    B-INF\lib\taglibs-datetteche.jar;C:\projects\Apps\tech\WebContent\WEB-INF\lib\taglibs-mailer.jar;C:\projects\Apps\tech\WebCon
    tent\WEB-INF\lib\taglibs-string.jar;C:\projects\Apps\tech\WebContent\WEB-INF\lib\utility.jar;C:\projects\Apps\tech\WebContent
    \WEB-INF\lib\webarch.jar;C:\projects\Apps\tech\WebContent; Delegation Mode: PARENT_FIRST ==>[1]
    com.ibm.ws.classloader.JarClassLoader@1659208988 Local Classpath:
    C:\projects\Apps\techEAR\DisMidTier.jar;C:\projects\Apps\techEAR\TEB.jar;C:\projects\Apps\techEAR\pls.jar Delegation mode:
    PARENT_FIRST [2] com.ibm.ws.classloader.ExtJarClassLoader@1582138652 Local ClassPath: C:\Program Files\Rational
    Software\RAD6.0\runtteches\base_v51\lib\app; Delegation Mode: PARENT_LAST [3]
    com.ibm.ws.classloader.ProtectionClassLoader@599a051c [4] com.ibm.ws.bootstrap.ExtClassLoader@3097451d [5]
    sun.misc.Launcher$AppClassLoader@308d051d [6] sun.misc.Launcher$ExtClassLoader@30f1051d ---Original exception---
    java.lang.NoClassDefFoundError: com/sun/faces/taglib/html_basic/CommandButtonTag at java.lang.ClassLoader.defineClass0(Native
    Method) at java.lang.ClassLoader.defineClass(ClassLoader.java(Compiled Code)) at
    java.security.SecureClassLoader.defineClass(SecureClassLoader.java(Compiled Code)) at
    com.ibm.ws.classloader.CompoundClassLoader._defineClass(CompoundClassLoader.java:446) at
    com.ibm.ws.classloader.CompoundClassLoader.findClass(CompoundClassLoader.java(Compiled Code)) at
    com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:300) at
    java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code)) at
    com.ibm.ws.classloader.ReloadableClassLoader.loadClass(ReloadableClassLoader.java:83) at
    com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:294) at
    java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code)) at
    com.ibm.ws.webcontainer.jsp.compiler.BasicTagBeginGenerator.init(BasicTagBeginGenerator.java:77) at
    org.apache.jasper.compiler.JspParseEventListener$GeneratorWrapper.init(JspParseEventListener.java:1015) at
    org.apache.jasper.compiler.JspParseEventListener.addGenerator(JspParseEventListener.java:185) at
    org.apache.jasper.compiler.ConfigurableParseEventListener.handleTagBegin(ConfigurableParseEventListener.java:739) at
    org.apache.jasper.compiler.DelegatingListener.handleTagBegin(DelegatingListener.java:221) at
    org.apache.jasper.compiler.DelegatingListener.handleTagBegin(DelegatingListener.java:216) at
    org.apache.jasper.compiler.Parser$Tag.accept(Parser.java:862) at org.apache.jasper.compiler.Parser.parse(Parser.java:1155) at
    org.apache.jasper.compiler.Parser.parse(Parser.java:1113) at org.apache.jasper.compiler.Parser$Tag.accept(Parser.java:902) at
    org.apache.jasper.compiler.Parser.parse(Parser.java:1155) at org.apache.jasper.compiler.Parser.parse(Parser.java:1113) at
    org.apache.jasper.compiler.Parser$Tag.accept(Parser.java:902) at org.apache.jasper.compiler.Parser.parse(Parser.java:1155) at
    org.apache.jasper.compiler.Parser.parse(Parser.java:1113) at org.apache.jasper.compiler.Parser$Tag.accept(Parser.java:902) at
    org.apache.jasper.compiler.Parser.parse(Parser.java:1155) at org.apache.jasper.compiler.Parser.parse(Parser.java:1113) at
    org.apache.jasper.compiler.Parser.parse(Parser.java:1109) at
    org.apache.jasper.compiler.ParserController.parse(ParserController.java:344) at
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:225) at
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:129) at
    com.ibm.ws.webcontainer.jsp.servlet.JspServlet.loadJSP(JspServlet.java:956) at
    com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:285) at
    com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:317) at
    com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:683) at
    com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:781) at
    javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at
    com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110) at
    com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174) at
    com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313) at
    com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116) at
    com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283) at
    com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42) at
    com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40) at
    com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1019) at
    com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:592) at
    com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:204) at
    com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:125) at
    com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:286) at
    com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71) at
    com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182) at
    com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334) at
    com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56) at
    com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:615) at
    com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:912) ---
    end Original exception----

    Hi:
    Refer to SAP Best Pratices for Travel Management.
    http://help.sap.com/bp_bblibrary/500/BBlibrary_start.htm
    J09: Travel Management
    Also refer to
    http://www.easymarketplace.de/online-pdfs.php
    Travel Management (FI-TV)
    Please let me know if you need more information.
    Assign points if useful.
    Regards
    MSReddy

  • Help!!! Error while trying to Deploy on JRun 3.1

    Hello
    I'm trying to deploy my Ejbs for JRun 3.1. I have my deploy
    script as below:
    rem The base directory in which JRun is installed
    set JRUN_HOME=c:\JRun\3.1
    rem The Oracle JDBC Drivers
    set JDBC_DRIVER=%JRUN_HOME%\servers\lib\ojdbc14.jar
    set ECLIPSE_HOME=H:\eclipse\workspace
    rem The filename and location of the JAR file to build
    set JAR_FILE=%ECLIPSE_HOME%\lib\mtrack.jar
    rem The Classpath for EJB components
    set
    EJB_CP=%ECLIPSE_HOME%\lib\j2ee.jar;%JRUN_HOME%\lib\ejipt.jar;%ECLIPSE_HOME%\lib\jdom.jar; %ECLIPSE_HOME%\lib\xerces.jar;%ECLIPSE_HOME%\lib\ext\commons-fileupload-1.1.jar
    set
    JRUN_CP=%JRUN_HOME%\lib\install.jar;%JRUN_HOME%\lib\xt.jar;%JRUN_HOME%\lib\jrun.jar;%JRUN _HOME%\lib\jsp.jar;%JRUN_HOME%\lib\jsprt.jar;%JRUN_HOME%\lib\rhino.jar;%JRUN_HOME%\lib\ssi .jar;%JRUN_HOME%\lib\default_exports.jar;%JRUN_HOME%\lib\default_objects.jar;%JRUN_HOME%\l ib\ejipt.jar;%JRUN_HOME%\lib\ejipt_ejbeans.jar;%JRUN_HOME%\lib\ejipt_jms.jar;%JRUN_HOME%\l ib\ejipt_tools.jar;%JRUN_HOME%\lib\ejipt_client.jar
    set CP=.;%EJB_CP%;%JDBC_DRIVER%;%JAR_FILE%;%JRUN_CP%
    C:\java\jres\1.3.1\bin\java
    -Djava.security.policy=%JRUN_HOME%/lib/jrun.policy
    -Dejipt.home=%JRUN_HOME% -cp %CP% allaire.ejipt.tools.Deploy
    This script uses Jre 1.3.1 to deploy as I know that one works
    on another machine. Anyway, i get the following error, i starts
    doing the compilation and generating the stub then it fails:
    Generating EscalationManagerObject...
    Generating StatisticsManagerHomeObject...
    Generating StatisticsManagerObject...
    Compiling files...
    Exception: [15:24:29] java.io.IOException: CreateProcess:
    javac -classpath c:/JR
    un/3.1/servers/default/deploy/lib;c:/JRun/3.1/servers/default/deploy/mtrack.jar;
    lib/ejipt.jar;.;H:/eclipse/workspace/lib/j2ee.jar;c:/JRun/3.1/lib/ejipt.jar;H:/e
    clipse/workspace/lib/jdom.jar;H:/eclipse/workspace/lib/xerces.jar;H:/eclipse/wor
    kspace/lib/ext/commons-fileupload-1.1.jar;c:/JRun/3.1/servers/lib/ojdbc14.jar;H:
    /eclipse/workspace/lib/mtrack.jar;c:/JRun/3.1/lib/install.jar;c:/JRun/3.1/lib/xt
    .jar;c:/JRun/3.1/lib/jrun.jar;c:/JRun/3.1/lib/jsp.jar;c:/JRun/3.1/lib/jsprt.jar;
    c:/JRun/3.1/lib/rhino.jar;c:/JRun/3.1/lib/ssi.jar;c:/JRun/3.1/lib/default_export
    s.jar;c:/JRun/3.1/lib/default_objects.jar;c:/JRun/3.1/lib/ejipt.jar;c:/JRun/3.1/
    lib/ejipt_ejbeans.jar;c:/JRun/3.1/lib/ejipt_jms.jar;c:/JRun/3.1/lib/ejipt_tools.
    jar;c:/JRun/3.1/lib/ejipt_client.jar -d
    c:/JRun/3.1/servers/default/deploy/lib @
    c:/JRun/3.1/servers/default/deploy/src/list error=2
    at java.lang.Win32Process.create(Native Method)
    at java.lang.Win32Process.<init>(Unknown Source)
    at java.lang.Runtime.execInternal(Native Method)
    at java.lang.Runtime.exec(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at
    allaire.ejipt.tools.Deploy._compileFiles(allaire/ejipt/tools/Deploy.java:700)
    at
    allaire.ejipt.tools.Deploy.redeployJars(allaire/ejipt/tools/Deploy.java:236)
    at
    allaire.ejipt.tools.Deploy.deployJars(allaire/ejipt/tools/Deploy.java:184)
    at
    allaire.ejipt.tools.Deploy.main(allaire/ejipt/tools/Deploy.java:163)
    I'm completely stuck. Any help will be much appreciated.
    Thanks
    Pratim

    Hi dominikg,
    At first, You can try to restart the device-manager from system tray.
    If it doesn't help, then try the following:
    - stop the device manager
    - Remove c:\Docement and Settings\<your User>\javame-sdk folder.
    - Ran the device manager from <SDK>/bin directory
    - try to debug again.
    Did you tried to change port 51307 to another.
    Early access build had some problems with device manager, I hope that final release will be better :)
    BR,
    Igor

  • Could someone help me with this error: java.sql.SQLException: Closed Connec

    My code:
    <%@ include file="../setupcache.jsp"%>
    <%
    if(connectionPool_dig==null){
    %>
    <p>Could not connect to database. Please try again, thank!</p>
    <%          
         return ;
    Connection con = connectionPool_dig.getConnection();
    if(con==null){
    %>
    <p>Could not connect to database. Please try again, thank!</p>
    <%          
         return;
         String file = request.getParameter("m_FILE");
              file = "a";
         String sql = " SELECT *"+
              " FROM "+
              " FILEUPLOAD, SUBJECT"+
              " WHERE "+
              " FILEUPLOAD.SUBJECTCODE = SUBJECT.CODE AND UPPER(FILEUPLOAD.FILENAME) LIKE(UPPER(?))";
         PreparedStatement stmt = con.prepareStatement(sql);
         stmt.setString(1,"%"+file+"%");
         ResultSet rs = stmt.executeQuery();
         while(rs.next()){
              out.println("<br>"+rs.getString(1));
              out.println("<br>"+rs.getString(2));
              out.println("<br>"+rs.getString(3));
              out.println("<br>"+rs.getString(4));
         rs.close();
         stmt.close();
    try{
         con.close();
    }catch(SQLException e){}
    %>
    it usualy generate that error (once wrong then right then wrong....), but if I don't close connection (con.close), it work well. Could some one help me!

    Hi,
    I think that it should be better that returning the Connection
    instance back to the Connection Pool. The connection
    should not be close by you. it should controlled by the
    connection pool mechanism. So I think that you should
    check out your connection pool usage document for the
    right usage.
    If your code is the case, the connection in connection
    pool will get less and your connection pool mechanism
    may need to reallocate a new one for application. I
    don't think that it is right.
    good luck,
    Alfred Wu

Maybe you are looking for