Problem while sending seriailized  object from applet to servlet

Hi I m having Object communication between Applet and Servlet.
I m getting error stack trace as
java.io.EOFException
     at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
     at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source)
at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
     at java.io.ObjectInputStream.<init>(Unknown Source)
     at com.chat.client.ObjectClient.write(ObjectClient.java:56)
at the line
ObjectInputStream ois = new ObjectInputStream(conn.getInputStream());
thanks in advance
Ravi
the whole code is as follows....
public Serializable write(Serializable obj) throws IOException,ClassNotFoundException{
          URLConnection conn = serverURL.openConnection();
          conn.setDoOutput(true);
          conn.setDoInput(true);
          conn.setUseCaches(false);
          conn.setRequestProperty("Content-Type", "java-internal/"+obj.getClass().getName());
          conn.connect();
          ObjectOutputStream oos= null;
          try{
          oos = new ObjectOutputStream(
               conn.getOutputStream());
                    oos.writeObject(obj);
               catch(Exception ee){
                                   ee.printStackTrace();
               finally{
                    if(oos!=null){
                         oos.flush();
                         oos.close();
                    return the reponse to the client
               ObjectInputStream ois=null;
               try{
\\this is the line where i m getting the error               
ois = new ObjectInputStream(conn.getInputStream());
                         return (Serializable)ois.readObject();
                    catch(Exception ee){
                                        System.out.println("Error in Object Client inputstream ");
                                        ee.printStackTrace();
                                        return null;
                    finally{
                         if(ois!=null){
                              ois.close();

Did anyone find a fix to this problem. I am having a similiar problem. Sometimes I receive an EOFException and othertimes I don't. When I do receive an EOFException I check for available() in the stream and it appears 0 bytes were sent to the Servlet from the Applet.
I am always open to produce this problem when I use File->New in IE my applet loads on the new page.. and then I navigate to a JSP sitting on the same application server. When I go to the Applet on the initial page and try to send an object to the server I get an EOFException. No idea!

Similar Messages

  • Problem  while sending the mail from sap

    Hi experts,
                     I am facing some problem while sending mail from sap to external mail.
    this is th code i am using but it is not working. plz check and tell me.
    REPORT  ZMAIL_DEMO.
    data: maildata type sodocchgi1.
    data: mailtxt type table of solisti1 with header line.
    data: mailrec type table of somlrec90 with header line.
    start-of-selection.
    break-point.
    clear: maildata, mailtxt, mailrec.
    refresh: mailtxt, mailrec.
    maildata-obj_name = 'TEST'.
    maildata-obj_descr = 'Test'.
    maildata-obj_langu = sy-langu.
    mailtxt-line = 'This is a test'.
    append mailtxt.
    mailrec-receiver = 'SOME MAIL ID'.
    mailrec-rec_type = 'U'.
    append mailrec.
    call function 'SO_NEW_DOCUMENT_SEND_API1'
    exporting
    document_data = maildata
    document_type = 'RAW'
    put_in_outbox = 'X'
    tables
    object_header = mailtxt
    object_content = mailtxt
    receivers = mailrec
    exceptions
    too_many_receivers = 1
    document_not_sent = 2
    document_type_not_exist = 3
    operation_no_authorization = 4
    parameter_error = 5
    x_error = 6
    enqueue_error = 7
    others = 8.
    if sy-subrc = 0.   "( did not receive any mail) *
    write : 'mail sent'.
    endif.

    Hi,
    Please check with the following code.
    TABLES: KNA1.
    data for send function
    DATA DOC_DATA  LIKE SODOCCHGI1.
    DATA OBJECT_ID LIKE SOODK.
    DATA OBJCONT   LIKE SOLI OCCURS 10 WITH HEADER LINE.
    DATA RECEIVER  LIKE SOMLRECI1 OCCURS 1 WITH HEADER LINE.
    SELECT * FROM KNA1 WHERE ANRED LIKE 'C%'.
      WRITE:/ KNA1-KUNNR, KNA1-ANRED.
    send data internal table
      CONCATENATE KNA1-KUNNR KNA1-ANRED
                             INTO OBJCONT-LINE SEPARATED BY SPACE.
      APPEND OBJCONT.
    ENDSELECT.
    insert receiver (sap name)
      REFRESH RECEIVER.
      CLEAR RECEIVER.
      MOVE: 'any_email'_ TO RECEIVER-RECEIVER,                " SY-UNAME
            'X'      TO RECEIVER-EXPRESS,
            'U'      TO RECEIVER-REC_TYPE.
      APPEND RECEIVER.
    insert mail description
      WRITE 'Sending a mail through abap'
                     TO DOC_DATA-OBJ_DESCR.
    CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
         EXPORTING
              DOCUMENT_DATA              = DOC_DATA
         IMPORTING
              NEW_OBJECT_ID              = OBJECT_ID
         TABLES
              OBJECT_CONTENT             = OBJCONT
              RECEIVERS                  = RECEIVER
         EXCEPTIONS
              TOO_MANY_RECEIVERS         = 1
              DOCUMENT_NOT_SENT          = 2
              DOCUMENT_TYPE_NOT_EXIST    = 3
              OPERATION_NO_AUTHORIZATION = 4
              PARAMETER_ERROR            = 5
              X_ERROR                    = 6
              ENQUEUE_ERROR              = 7
              OTHERS                     = 8.

  • Sending a file from Applet to servlet HELP me Please

    Sorry, i have the problem this is my code Applet & Servlet but it seems working asynchronously if you have some ideas please reply me i send bytes on outputstream but the inputstream of servlet receive nothing bytes but write my system.out.print on screen server:
    Applet:
    URL servletURL = new URL(codebase, "/InviaFile/servlet/Ricevi");
    HttpURLConnection urlConnection = (HttpURLConnection) servletURL.openConnection();
    urlConnection.setRequestMethod("POST");
    urlConnection.setUseCaches(false);
    urlConnection.setDoOutput(true);
    urlConnection.setDoInput(true);
    urlConnection.setAllowUserInteraction(false);
    urlConnection.setRequestProperty("Content-Type", "application/octet-stream");
    urlConnection.setRequestProperty("Content-length", String.valueOf(100));
    urlConnection.connect();
    if(urlConnection.HTTP_BAD_REQUEST == HttpURLConnection.HTTP_BAD_REQUEST){
    /*System.out.println("Cattiva Richiesta: "+urlConnection.getContentEncoding());
    System.out.println("Tipo di metodo: "+urlConnection.getRequestMethod());
    System.out.println("Tipo di Risposta: "+urlConnection.getResponseCode());
    System.out.println("Tipo di messaggio: "+urlConnection.getResponseMessage());
    System.out.println("Tipo di contenuto: "+urlConnection.getContentType());
    System.out.println("Tipo di lunghezza contenuto: "+urlConnection.getContentLength());
    System.out.println("Tipo di doinput: "+urlConnection.getDoInput());
    System.out.println("Tipo di doouput: "+urlConnection.getDoOutput());
    System.out.println("Tipo di URL: "+urlConnection.getURL());
    System.out.println("Tipo di propriet� richiesta: "+urlConnection.getRequestProperty("Content-Type"));
    System.out.println("Entra if");
    DataOutputStream dout = new DataOutputStream(urlConnection.getOutputStream());
    InputStream is = urlConnection.getInputStream();
    if(ritornaFile("C:/Ms.tif", dout))System.out.println("Finita lettura");
    dout.close();
    urlConnection.disconnect();
    System.out.println("Fine Applet");
    }catch(Exception e) { System.err.println(e.getMessage());e.printStackTrace();}
    public boolean ritornaFile(String file, OutputStream ots)throws Exception{
    FileInputStream f = null;
    try{
    f = new FileInputStream(file);
    byte[] buf = new byte[4 * 1024];
    int byteLetti;
    while((byteLetti = f.read()) != -1){ots.writeByte(buf, 0, byteLetti);ots.flush();
    while((byteLetti = f.read()) != -1){ots.write(byteLetti);ots.flush();
    System.out.println("byteLetti= "+byteLetti);
    return true;
    }catch(Exception ex){
    System.err.println(ex.getMessage());
    return false;
    }finally{
    if(f != null)f.close();
    Servlet:
    HttpSession ses = request.getSession(true);
    System.out.println("Passa servlet "+request.getMethod());
    System.out.println("Passa servlet "+ses.getId());
    ServletInputStream servletinputstream = request.getInputStream();
    DataInputStream dis = new DataInputStream(request.getInputStream());
    int c = dis.available();
    System.out.println("c="+c);
    //ServletOutputStream servletoutputstream
    //response.getOutputStream();
    response.setContentType("application/octet-stream");
    System.out.println("URI= "+request.getRequestURI());
    System.out.println("pathTranslated: "+request.getPathTranslated());
    System.out.println("RemoteUser: "+request.getRemoteUser());
    System.out.println("UserInRole: "+String.valueOf(request.isUserInRole("")));
    System.out.println("pathInfo: "+request.getPathInfo());
    System.out.println("Protocollo: "+request.getProtocol());
    System.out.println("RemoteAddr:"+request.getRemoteAddr());
    System.out.println("RemoteHost:"+request.getRemoteHost());
    System.out.println("SessionID:"+request.getRequestedSessionId());
    System.out.println("Schema:"+request.getScheme());
    System.out.println("SeesionValido:"+String.valueOf(request.isRequestedSessionIdValid()));
    System.out.println("FromURL:"+String.valueOf(request.isRequestedSessionIdFromURL()));
    int i = request.getContentLength();
    System.out.println("i: "+i);
    ritornaFile(servletinputstream, "C:"+File.separator+"Pluto.tif");
    System.out.println("GetMimeType= "+getServletContext().getMimeType("Ms.tif"));
    InputStream is = request.getInputStream();
    int in = is.available();
    System.out.println("Legge dallo stream in="+in);
    DataInputStream diss = new DataInputStream(servletinputstream);
    int ins = diss.read();
    System.out.println("Legge dallo stream ins="+ins);
    int disins = diss.available();
    System.out.println("Legge dallo stream disins="+disins);
    is.close();
    System.out.println("Fine Servlet");
    catch(Exception exception) {
    System.out.println("IOException occured in the Server: " + exception.getMessage());exception.printStackTrace();
    public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, java.io.IOException {
    processRequest(request, response);
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, java.io.IOException {
    processRequest(request, response);
    /** Returns a short description of the servlet.
    public String getServletInfo() {
    return "Short description";
    public void ritornaFile(InputStream its, String fileDest )throws Exception{
    FileOutputStream f = null;
    try{
    f = new FileOutputStream(fileDest);
    byte[] buf = new byte[2 * 1024];
    int byteLetti;
    while((byteLetti = its.read()) != -1){
    f.write(buf, 0, byteLetti);
    f.flush();
    System.out.println("Byteletti="+byteLetti);
    }catch(Exception ex){
    System.err.println(ex.getMessage());
    }finally{
    if(f != null)f.close();

    Hi all,
    Can anyone help me.I am trying to send an audio file from a applet to servlet with HTTP method(no raw sockets), also the servlet shld be able to save the file on the server.Any suggestions welcome.USing audiostream class from javax.sound.sampled.
    The part of applet code which calls servlet is :
    URL url = new URL("http://" + host + "/" + context + "/servlet/UserUpdateWorkLogAudio?userid=" + userId.replace(' ', '+') + "&FileName=" + filename.replace(' ', '+'));
    URLConnection myConnection = url.openConnection();
    myConnection.setUseCaches(false);
    myConnection.setDoOutput(true);
    urlConnection.setRequestProperty("Content-Type", "application/octet-stream");
    myConnection.connect();
    out = new BufferedOutputStream(myConnection.getOutputStream());
    AudioSystem.write(audioInputStream, fileType,out); // IS THIS RIGHT APPROACH?
    ************************end of applet code**********************
    ************************servlet code******************************
    try
    {BufferedInputStream in = new BufferedInputStream(request.getInputStream());
    ????????What code shld i write here to get the audio file stream
    BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(filename));
    *********************************************end***********************
    Thanks
    Joe.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to send multiple objects from appleto to servlet and vice versa

    how can i send multiple objects(ArrayLists and String) from servlet to applet and applet to servlet?

    Use an HTTPUrlConnection from the Applet to the Servlet to send data to the server, or request information from the servlet. To actually transfer the objects you will have to use a serialized version of the objects, almost always by wrapping the streams generated via the UrlConnection in ObjectOutputStream and ObjectInputStreams.

  • Updation problem while creating multiple objects from enterprise portal

    Hi All,
    From enterprise portal i am calling an RFC 'BAPI_PROJECT_MAINTAIN' to create objects .
    While trying to create multiple objects simultaneously it gives error "sapuser is currently using, can't be created".
    It seems like as i am creating multiple objects by calling RFC repeatedly , while the first one is not updated fully i am sending the second value to be processed.
    Pl. tell me how to overcome this. Do I need to add any sleep time in EP or any other method is there in SAP to overcome this situation.
    thanks
    sandeep

    Dear Sandeep,
    I have discussed this problem with EP team lead in my organisation, i have given your email id to him he will forward the solution on your id.
    If usefull reward points helpfull....
    Regards,
    Rajneesh Gupta

  • Problem while sending e-mail from SAP

    Hi,
    I need to modify customized report, my problem is i need to download as .XLS file as well i need to send as an attachment to e-mail. If i select with NO-Delimeter the attachment comming as .TXT file and if i select any delimeter that occupying one cell in .XLS file.
    Can anyone help me out in this.
    Thanks,
    Yogesh

    Hi Yogesh,
    Refer the following code as pointer to sending email with attachment.
    REPORT ZSAMPL_001 .
    INCLUDE ZINCLUDE_01.
    DATA
    DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
    DATA : file_name TYPE string.
    data : path like PCFILE-PATH.
    data : extension(5) type c.
    data : name(100) type c.
    SELECTION SCREEN
    PARAMETERS : receiver TYPE somlreci1-receiver lower case.
    PARAMETERS : p_file LIKE rlgrap-filename
    OBLIGATORY.
    AT SELECTION SCREEN
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    CLEAR p_file.
    CALL FUNCTION 'F4_FILENAME'
    IMPORTING
    file_name = p_file.
    START-OF-SELECTION
    START-OF-SELECTION.
    PERFORM ml_customize USING 'Tst' 'Testing'.
    PERFORM ml_addrecp USING receiver 'U'.
    PERFORM upl.
    PERFORM doconv TABLES itab objbin.
    PERFORM ml_prepare USING 'X' extension name.
    PERFORM ml_dosend.
    SUBMIT rsconn01
    WITH mode EQ 'INT'
    AND RETURN.
    FORM
    FORM upl.
    file_name = p_file.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = file_name
    filetype = 'BIN'
    TABLES
    data_tab = itab
    EXCEPTIONS
    *file_open_error = 1
    *file_read_error = 2
    *no_batch = 3
    *gui_refuse_filetransfer = 4
    *invalid_type = 5
    *no_authority = 6
    *unknown_error = 7
    *bad_data_format = 8
    *header_not_allowed = 9
    *separator_not_allowed = 10
    *header_too_long = 11
    *unknown_dp_error = 12
    *access_denied = 13
    *dp_out_of_memory = 14
    *disk_full = 15
    *dp_timeout = 16
    *OTHERS = 17.
    path = file_name.
    CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
    EXPORTING
    complete_filename = path
    CHECK_DOS_FORMAT =
    IMPORTING
    DRIVE =
    EXTENSION = extension
    NAME = name
    NAME_WITH_EXT =
    PATH =
    EXCEPTIONS
    INVALID_DRIVE = 1
    INVALID_EXTENSION = 2
    INVALID_NAME = 3
    INVALID_PATH = 4
    OTHERS = 5
    ENDFORM. "upl
    ***INCLUDE ZINCLUDE_01 .
    Data
    tables crmrfcpar.
    DATA: docdata LIKE sodocchgi1,
    objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
    objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
    objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
    objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
    objhex LIKE solix OCCURS 10 WITH HEADER LINE,
    reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
    DATA: tab_lines TYPE i,
    doc_size TYPE i,
    att_type LIKE soodk-objtp.
    DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
    data v_rfcdest LIKE crmrfcpar-rfcdest.
    FORM
    FORM ml_customize USING objname objdesc.
    Clear Variables
    CLEAR docdata.
    REFRESH objpack.
    CLEAR objpack.
    REFRESH objhead.
    REFRESH objtxt.
    CLEAR objtxt.
    REFRESH objbin.
    CLEAR objbin.
    REFRESH objhex.
    CLEAR objhex.
    REFRESH reclist.
    CLEAR reclist.
    REFRESH listobject.
    CLEAR listobject.
    CLEAR tab_lines.
    CLEAR doc_size.
    CLEAR att_type.
    Set Variables
    docdata-obj_name = objname.
    docdata-obj_descr = objdesc.
    ENDFORM. "ml_customize
    FORM
    FORM ml_addrecp USING preceiver prec_type.
    CLEAR reclist.
    reclist-receiver = preceiver.
    reclist-rec_type = prec_type.
    APPEND reclist.
    ENDFORM. "ml_customize
    FORM
    FORM ml_addtxt USING ptxt.
    CLEAR objtxt.
    objtxt = ptxt.
    APPEND objtxt.
    ENDFORM. "ml_customize
    FORM
    FORM ml_prepare USING bypassmemory whatatt_type whatname.
    IF bypassmemory = ''.
    Fetch List From Memory
    CALL FUNCTION 'LIST_FROM_MEMORY'
    TABLES
    listobject = listobject
    EXCEPTIONS
    OTHERS = 1.
    IF sy-subrc <> 0.
    MESSAGE ID '61' TYPE 'E' NUMBER '731'
    WITH 'LIST_FROM_MEMORY'.
    ENDIF.
    CALL FUNCTION 'TABLE_COMPRESS'
    IMPORTING
    COMPRESSED_SIZE =
    TABLES
    in = listobject
    out = objbin
    EXCEPTIONS
    OTHERS = 1
    IF sy-subrc <> 0.
    MESSAGE ID '61' TYPE 'E' NUMBER '731'
    WITH 'TABLE_COMPRESS'.
    ENDIF.
    ENDIF.
    Header Data
    Already Done Thru FM
    Main Text
    Already Done Thru FM
    Packing Info For Text Data
    DESCRIBE TABLE objtxt LINES tab_lines.
    READ TABLE objtxt INDEX tab_lines.
    docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
    CLEAR objpack-transf_bin.
    objpack-head_start = 1.
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = tab_lines.
    objpack-doc_type = 'TXT'.
    APPEND objpack.
    Packing Info Attachment
    att_type = whatatt_type..
    DESCRIBE TABLE objbin LINES tab_lines.
    READ TABLE objbin INDEX tab_lines.
    objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
    objpack-transf_bin = 'X'.
    objpack-head_start = 1.
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = tab_lines.
    objpack-doc_type = att_type.
    objpack-obj_name = 'ATTACHMENT'.
    objpack-obj_descr = whatname.
    APPEND objpack.
    Receiver List
    Already done thru fm
    ENDFORM. "ml_prepare
    FORM
    FORM ml_dosend.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = docdata
    put_in_outbox = 'X'
    commit_work = 'X' "used from rel. 6.10
    IMPORTING
    SENT_TO_ALL =
    NEW_OBJECT_ID =
    TABLES
    packing_list = objpack
    object_header = objhead
    contents_bin = objbin
    contents_txt = objtxt
    CONTENTS_HEX = objhex
    OBJECT_PARA =
    object_parb =
    receivers = reclist
    EXCEPTIONS
    too_many_receivers = 1
    document_not_sent = 2
    document_type_not_exist = 3
    operation_no_authorization = 4
    parameter_error = 5
    x_error = 6
    enqueue_error = 7
    OTHERS = 8
    IF sy-subrc <> 0.
    MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
    WITH docdata-obj_name.
    ENDIF.
    ENDFORM. "ml_customize
    FORM
    FORM ml_spooltopdf USING whatspoolid.
    DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
    Call Function
    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
    EXPORTING
    src_spoolid = whatspoolid
    TABLES
    pdf = pdf
    EXCEPTIONS
    err_no_otf_spooljob = 1
    OTHERS = 12.
    Convert
    PERFORM doconv TABLES pdf objbin.
    ENDFORM. "ml_spooltopdf
    FORM
    FORM doconv TABLES
    mypdf STRUCTURE tline
    outbin STRUCTURE solisti1.
    Data
    DATA : pos TYPE i.
    DATA : len TYPE i.
    Loop And Put Data
    LOOP AT mypdf.
    pos = 255 - len.
    IF pos > 134. "length of pdf_table
    pos = 134.
    ENDIF.
    outbin+len = mypdf(pos).
    len = len + pos.
    IF len = 255. "length of out (contents_bin)
    APPEND outbin.
    CLEAR: outbin, len.
    IF pos < 134.
    outbin = mypdf+pos.
    len = 134 - pos.
    ENDIF.
    ENDIF.
    ENDLOOP.
    IF len > 0.
    APPEND outbin.
    ENDIF.
    ENDFORM. "doconv
    FORM
    FORM ml_saveforbp USING jobname jobcount.
    Data
    *data : yhead like yhrt_bp_head.
    *DATA : ydocdata LIKE yhrt_bp_docdata,
    *yobjtxt LIKE yhrt_bp_objtxt OCCURS 0 WITH HEADER LINE,
    *yreclist LIKE yhrt_bp_reclist OCCURS 0 WITH HEADER LINE.
    *DATA : seqnr TYPE i.
    Head
    *yhead-jobname = jobname.
    *yhead-jobcount = jobcount..
    *MODIFY yhrt_bp_head FROM yhead.
    Doc Data
    *ydocdata-jobname = jobname.
    *ydocdata-jobcount = jobcount.
    *MOVE-CORRESPONDING docdata TO ydocdata.
    *MODIFY yhrt_bp_docdata FROM ydocdata.
    Objtxt
    *seqnr = 0.
    *LOOP AT objtxt.
    *seqnr = seqnr + 1.
    *yobjtxt-jobname = jobname.
    *yobjtxt-jobcount = jobcount.
    *yobjtxt-seqnr = seqnr.
    *MOVE-CORRESPONDING objtxt TO yobjtxt.
    *MODIFY yhrt_bp_objtxt FROM yobjtxt.
    *ENDLOOP.
    RecList
    *seqnr = 0.
    *LOOP AT reclist.
    *seqnr = seqnr + 1.
    *yreclist-jobname = jobname.
    *yreclist-jobcount = jobcount.
    *yreclist-seqnr = seqnr.
    *MOVE-CORRESPONDING reclist TO yreclist.
    *MODIFY yhrt_bp_reclist FROM yreclist.
    *ENDLOOP.
    ENDFORM. "ml_saveforbp
    FORM
    FORM ml_fetchfrombp USING jobname jobcount.
    *CLEAR docdata.
    *REFRESH objtxt.
    *REFRESH reclist.
    *SELECT SINGLE * FROM yhrt_bp_docdata
    *INTO corresponding fields of docdata
    *WHERE jobname = jobname
    *AND jobcount = jobcount.
    *SELECT * FROM yhrt_bp_objtxt
    *INTO corresponding fields of TABLE objtxt
    *WHERE jobname = jobname
    *AND jobcount = jobcount
    *ORDER BY seqnr.
    *SELECT * FROM yhrt_bp_reclist
    *INTO corresponding fields of TABLE reclist
    *WHERE jobname = jobname
    *AND jobcount = jobcount
    *ORDER BY seqnr.
    ENDFORM. "ml_fetchfrombp
    <b>Please reward points if it helps.</b>
    Regards,
    Amit Mishra

  • Problem in sending image from applet to servlet

    dear friends,
    i have a need to send an image from applet to servlet via HttpConnection and getting back that image from applet.
    i am struggling with this sice many hours and got tired by searching any post that would help me but haven't got yet.
    i tried using this code but it dosent make any execution sit right. i got NPE at ImageIcon.getDescription() line;
    at applet side
          jf.setContentPane(getJContentPane());
                     FileDialog fd=new FileDialog(jf,"hi");
                     fd.setMode(FileDialog.LOAD);
                     fd.setVisible(true);   
                     v=new Vector();
                     try{                                                
                               FileInputStream fis=new FileInputStream(new File(fd.getDirectory()+fd.getFile()));      
                               byte[] imgbuffer=new byte[fis.available()];
                               fis.read(imgbuffer);
                               ImageIcon imgdata=new ImageIcon(imgbuffer);
                               v.add(0,imgicon);
                                String strwp ="/UASProject/Storeimage";              
                                URL servletURL = new URL(getCodeBase(),strwp);             
                                HttpURLConnection servletCon = (HttpURLConnection)servletURL.openConnection();       
                                servletCon.setDoInput(true); 
                                servletCon.setDoOutput(true);
                                servletCon.setUseCaches(false);
                                servletCon.setDefaultUseCaches(false);   
                                servletCon.setRequestMethod("POST");     
                                servletCon.setRequestProperty("Content-Type", "application/octet-stream");   
                                servletCon.connect();            
                                ObjectOutputStream oboutStream = new ObjectOutputStream(servletCon.getOutputStream());                     
                                oboutStream.writeObject(v);
                                v.remove(0);
                                oboutStream.flush();      
                                oboutStream.close();  
                                //read back from servlet
                                ObjectInputStream inputStream = new ObjectInputStream(servletCon.getInputStream());
                                 v= (Vector)inputStream.readObject();                     
                                 imgicon=(ImageIcon)v.get(1);
                                 showimg.setIcon(imgicon);
                                 this.getContentPane().validate();
                                 this.validate();  
                                inputStream.close();                                                        
                             //  repaint();
                     }catch(Exception e){e.printStackTrace();}  and this is at servlet side
            try {       
                         Vector v=new Vector();                    
                         ObjectInputStream inputFromjsp = new ObjectInputStream(request.getInputStream());                                      
                          v = (Vector)inputFromjsp.readObject();                                                                                                          
                          imgicon=(ImageIcon)v.get(0);                     
                          inputFromjsp.close();            
                          System.out.println(imgicon.getDescription());                                      
                          v.remove(0);
                          v.add(1,imgicon);
    //sending back to applet
                           response.setContentType("application/octet-stream");
                          ObjectOutputStream oboutstream=new ObjectOutputStream(response.getOutputStream());            
                          oboutstream.writeObject(v);
                          oboutstream.flush();
                          oboutstream.close();
                   } catch (Exception e) {e.printStackTrace();}  i really need your help. please let me out of this headche
    thanks
    Edited by: san_4u on Nov 24, 2007 1:00 PM

    BalusC wrote:
    san_4u wrote:
    how can i made a HttpClient PostMethod using java applets? as i have experience making request using HttpURLConnection.POST method. ok first of all i am going make a search of this only after i will tell. please be onlineOnce again, see link [3] in my first reply of your former topic.
    yeah! i got the related topic at http://www.theserverside.com/tt/articles/article.tss?l=HttpClient_FileUpload. please look it, i am reading it right now and expecting to be reliable for me.
    well what i got, when request made by html code(stated above) then all the form fields and file data mixed as binary data and available in HttpServletRequest.getinputstream. and at servlet side we have to use a mutipart parser of DiskFileItemFactory class that automatically parse the file data and return a FileItem object cotaing the actual file data,right?.You can also setup the MultipartFilter in your environment and don't >care about it further. Uploaded files will be available as request attributes in the servlet.is the multipartfilter class file available in jar files(that u suggested to add in yours article) so that i can use it directly? one more thing the import org.apache.commons.httpclient package is not available in these jar files, so where can got it from?
    one mere question..
    i looked somewhere that when we request for a file from webserver using web browser then there is a server that process our request and after retrieving that file from database it sends back as response.
    now i confused that, wheather these webservers are like apache tomcat, IBM's webspher etc those processes these request or there is a unique server that always turned on and process all the request?
    because, suppose in an orgnisation made it's website using its own server then, in fact, all the time it will not turned on its server or yes it will? and a user can make a search for kind of information about this orgnisation at any time.
    hopes, you will have understand my quary, then please let me know the actual process
    thanks
    Edited by: san_4u on Nov 25, 2007 11:25 AM

  • Problem while sending IDOC to File Senario

    Hi Experts
        I am having problem while sending the Idoc from SAP R/3 to File
       I have done all the setting in SAP as well in XI but while pushing IDOC
       I am getting error in the transaction sm58 in SAP R/3
      " <b>The service for the client 300(My SAP R/3 client) is not present in Integration
      Directory</b>"
    I can any one explain me what to done on this....all the connections are fine
    Waiting for Response
    Adv points and thanx
    Rakesh

    Reason and Prerequisites
    You send IDocs from system ABC to the exchange infrastructure (XI) of system XIZ, and error messages are issued in system ABC (Transaction SM58) for the IDOC_INBOUND_ASYNCHRONOUS function module.
    This note proposes solutions for the following error messages:
    a) No service for system SAPABC client 123 in the integration directory
    b) Transaction IDX1: Port SAPABC, client 123, RFC destination
    c) ::000
    d) NO_EXEC_PERMISSION: "USER" "Business_System"
    e) IDoc adapter inbound: Error error ...
    Solution
    a) Error message: No service for system SAPABC client 123 in the integration directory
    Solution:
    You send IDocs from system ABC to XI. In the control record of the IDoc, the SNDPOR field contains the value "SAPABC". The client of the sending system is determined by the MANDT field of the control record. The system ID and client are then used to determine a service without party of the type (business-system/business-service):
    Business system
    Activities in the System Landscape Directory (SLD)(Create technical system):
    Create a technical system for system ABC in the SLD, and create the client for this. Do not forget to assign an "ALE logical system" (for example, "ABCCLNT123") to this technical system.
    SLD (Business system):
    You can now explicitly assign a business system to this client.
    For more details, refer to the SLD documentation.
    Activities in system ABC (self-registration in the SLD):
    Alternatively, you can register the system in the SLD in system ABC with Transaction RZ70. You will find detailed information about the SLD registration of systems on the SAP Service Marketplace for the "Exchange Infrastructure" in the document "Exchange_Installation_Guide.pdf".
    In system ABC, you can check your configuration with TransactionSLDCHECK.
    Activities in Integration Directory (import business system from SLD):
    You will find the business systems under Services Without Party in the Integration Services. In the Service menu, you will find the system identifiers, the client, and the corresponding ALE logical system under "Objects"->"Adapter-specific identifiers".
    Use the Import/Update button to copy the data from the SLD, to create business systems, or to update their identifiers.
    Business service
    Activities in the Integration Builder directory:
    You want to create a service without party that is not part of your system infrastructure and is therefore not maintained in the SLD.
    In the Integration Builder directory, you will find the "Business-Services" under Services Without Party. In the Service menu, you will find the system identifiers, the client, and the corresponding ALE logical system under "Objects"->"Adapter-specific identifiers".
    Activate the change list in Integration Directory.
    In system ABC, you can restart the incorrect entry from Transaction SM58 .
    b) Error message: Transaction IDX1: Port SAPABC, client 123, RFC destination
    Solution:
    The Integration Server tries to load the IDoc metadata from the sending system. The IDoc schemas from the Integration Repository cannot be used because they are release-dependent.
    The sending system is determined by the value of the "SNDPOR" field from the IDoc control record (for example, "SAPABC").
    Activities in the central XI system:
    In Transaction IDX1, you can assign an RFC destination to the sending system (for example, "SAPABC"). This must be created beforehand in Transaction SM59.
    Note that the IDoc metadata is cross-client data. In Transaction IDX1, only one entry must be maintained for each system. Only the lowest client is used by the runtime for Idoc metadata retrieval with RFC.
    Ensure that only SAPABC and not "SAPABC_123" is entered in the port name.
    c) Error message: "::000"
    Solution:
    This error occurs if the central XI system tries to load the IDoc metadata from the sending system by RFC.
    There may be several different reasons for the failure of the metadata import, the error is not transferred in full by tRFC completely, and this results in the error message above.
    User cannot log onto sending system
    User/password/client is not correct or the user is logged due to too many failed logons.
    Activities in sender system ABC:
    Transaction SM21 contains entries for failed logons.
    Activities in the central XI system:
    Determine the sending port from the IDoc control record of the IDoc. If the ID of the sending system has the value "ABC", the value of the sending port is "SAPABC". You will find the RFC destination used for the "SAPABC" sending port with the lowest client in Transaction IDX1. In Transaction SM59, you will find the RFC destination containing the maintained logon data .
    User does not have the required authorizations
    Activities in the sender system ABC:
    In Transaction SM21, you will find entries relating to authorization problems and more exact details.
    Contact your system administrator and, if necessary, assign the user the required roles in user administration.
    IDoctyp/Cimtyp cannot be loaded
    Activities in sender system ABC:
    In the sender system, you can check your IDoc types in Transaction WE30 (IDoc type editor)  Take note not only of the errors, but also of the warnings.
    The most common errors are:
    - IDoc type or segments not released
    - Segments that no longer exist are listed in the IDoc type
    - Data elements that do not exist in the DDIC are assigned to fields
      in the segment.
    Contact your system administrator and correct these errors in the IDoc type.
    d) Error message: NO_EXEC_PERMISSION: "User" "Business_System"
    Solution:
    You created a list of users in the directory who are authorized to use the "Business_System". The user in the error message is not on the list.
    Alternatively, the same error is used if you have created a sender agreement with a channel of the IDoc type for the "Business_System" and the interface used. The user in the error message is not contained in the list of all authorized users defined there.
    e) Error message: IDoc adapter inbound: Error error
    Solution:
    You send IDocs to the central XI system, where they are received by the IDoc adapter. The IDocs are converted into IDoc XML, and a corresponding XI message is generated and transferred to the XI Runtime Engine. The Engine tries to read its own business system from the "Exchange Profile". If the Exchange Profile is currently unavailable, the message is not processed and it is returned to the sending system with an error message.
    Regard's
    Prabhakar.....

  • Problem while sending the message using RWB

    Dear All,
    I am facing a problem while sending a message from RWB. I sent the message using Test Message in component monitoring, it says message sent but I am not able to see any message in sxi_monitor.
    When I send the same message using the http client it successfully processed by XI and I can see the success message in sxi_monitor.
    Please let me know if anyone has face similar kind of issue.
    Thanks,
    Alok
    Edited by: Alok Raoka on May 26, 2008 5:08 PM

    Dear All,
    I am facing a problem while sending a message from RWB. I sent the message using Test Message in component monitoring, it says message sent but I am not able to see any message in sxi_monitor.
    When I send the same message using the http client it successfully processed by XI and I can see the success message in sxi_monitor.
    Please let me know if anyone has face similar kind of issue.
    Thanks,
    Alok
    Edited by: Alok Raoka on May 26, 2008 5:08 PM

  • Sending an object from client to server always on button press

    What I need is to send an object from client to server but I need to make server wait until another object is sent. What I have is the JFrame where you put the wanted name and surname, then you create a User object with these details and on button press you send this object to the server. I just can't hold the connection because when I send the first object, server doesn't wait for another button click and throws EOFexception. Creating the while loop isn't helpfull as well because it keeps sending the same object again and again. The code is here
    public class ClientFrame extends JFrame {
        private JButton btnSend;
        private JTextField txfName;
        private JTextField txfSurname;
        public ClientFrame() {
            this.setTitle(".. ");
            Container con = this.getContentPane();
            con.setLayout(new BorderLayout());
            txfName = new JTextField("name");
            txfSurname = new JTextField("surname");
            btnSend = new JButton(new AbstractAction() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    SSLSocketFactory f =
                            (SSLSocketFactory) SSLSocketFactory.getDefault();
                    try {
                        SSLSocket c =
                                (SSLSocket) f.createSocket("localhost", 8888);
                        c.startHandshake();
                        OutputStream os = c.getOutputStream();
                        ObjectOutputStream oos = new ObjectOutputStream(os);
                        InputStream is = c.getInputStream();
                        ObjectInputStream ois = new ObjectInputStream(is);
                        boolean done = false;
                        while (!done) {
                            String first = txfName.getText();
                            String last = txfSurname.getText();
                            User u = new User();
                            u.setFirstName(first);
                            u.setLastName(last);
                            oos.reset();
                            oos.writeObject(u);
                            String str = (String) ois.readObject();
                            if (str.equals("rcvdOK")) {
                                System.out.println("received on the server side");
                            } else if (str.equals("ERROR")) {
                                System.out.println("ERROR");
                        //oos.writeObject(confirmString);
                        oos.close();
                        os.close();
                        c.close();
                    } catch (ClassNotFoundException ex) {
                        Logger.getLogger(ClientFrame.class.getName()).log(Level.SEVERE, null, ex);
                    } catch (IOException ex) {
                        System.err.println(ex.toString());
            btnSend.setText("send object");
            con.add(btnSend, BorderLayout.PAGE_START);
            con.add(txfName, BorderLayout.CENTER);
            con.add(txfSurname, BorderLayout.PAGE_END);
            this.pack();
            setSize(200, 150);
            setVisible(true);
    public class TestServer {
        public static void main(String[] args) {
            try {
                KeyStore ks = KeyStore.getInstance("JKS");
                ks.load(new FileInputStream(ksName), ksPass);
                KeyManagerFactory kmf =
                        KeyManagerFactory.getInstance("SunX509");
                kmf.init(ks, ctPass);
                SSLContext sc = SSLContext.getInstance("TLS");
                sc.init(kmf.getKeyManagers(), null, null);
                SSLServerSocketFactory ssf = sc.getServerSocketFactory();
                SSLServerSocket s = (SSLServerSocket) ssf.createServerSocket(8888);
                printServerSocketInfo(s);
                SSLSocket c = (SSLSocket) s.accept();
                InputStream is = c.getInputStream();
                ObjectInputStream ois = new ObjectInputStream(is);
                OutputStream os = c.getOutputStream();
                ObjectOutputStream oos = new ObjectOutputStream(os);
                boolean done = false;
                User u;
                  while(!done){
                    u = (User) ois.readObject();
                    String confirmString = "rcvdOK";
                    String errorString = "ERROR";
                    if (u != null) {
                        System.out.println(u.getFirstName() + " " + u.getLastName());
                        oos.writeObject(confirmString);
                    } else if (u == null) {
                        oos.writeObject(errorString);
                is.close();
                s.close();
                c.close();
            } catch (Exception e) {
                    System.err.println(e.toString());
    }Thanks for any help, btw this doesnt need to be via ssl, the problem would be the same using only http. Please anyone help me:)
    Edited by: Vencicek on 7.5.2012 2:19
    Edited by: EJP on 7/05/2012 19:53
    Edited by: Vencicek on 7.5.2012 3:36

    Current code fails because it's sending still the same entity again(using while loop)No it's not. You are creating a new User object every time around the loop.
    which makes the system freezeWhich means that you are executing network code in the event thread. Don't do that, use a separate thread. At the moment you're doing all that sending inside the constructor for ClientFrame which is an even worse idea: you can never get out of there to the rest of your client program. This is a program design problem, not a networking problem.
    and doesn't allow me to set new parameters of the new entityI do not understand.
    I need to find a way to keep Server running even when the client doesn't send any data and wait until the client doesnt press the send button again to read a new object.That's exactly what happens. readObject() blocks until data is received.

  • While transporting the objects from dev to q or production what are the err

    Hi all,
    While transporting the objects from one system to another what are the errors we get?
    Thanks
    Kiran Kumar

    Hi Kiran,
    The purpose of the Forums is to help people with problems, not to "fish" for answers to what appear to be interview questions. There are many ways to become educated in SAP Administration, such as training classes and help documetnation. Please choose these avenues for your questions instead of making these kind of posts in the Forums.
    Best Regards,
    Matt

  • Transportation failed while sending a request from DEV - Quality

    Hi sdns,,,
                       I got an error while sending a request from DEV -> Quality...Am new to transportation.. mayi know.. wat was this error and wat kind of action i need to take over here...
    I got an error message like this,,
    Start of the after-import method for object type R3TR ELEM (Activation Mode)          
    Element 0QWSUMHUOOK19OOUIFCLB4T8C was copied from 'modified' to 'active'              
    Error when activating element 45HKXU7KAG6V1I0L1W3LWEDZC                               
    Element 3Z571P6G8RCDNR3NQAEI8S6YW is missing in version M                                                                               
    Start of the after-import method for object type R3TR ELEM (Delete Mode)              
    Errors occurred during post-handling RS_AFTER_IMPORT for ELEM L                       
    RS_AFTER_IMPORT belongs to package RS                                                 
    The errors affect the following components:                                           
       BW-WHM (Warehouse Management)                                                      
    Post-import method RS_AFTER_IMPORT completed for ELEM L, date and time: 20070417044624
    Post-import methods of change/transport request I11K903499 completed                  
         Start of subsequent processing ... 20070417044621                                
         End of subsequent processing... 20070417044624                                   
    Answering getz really appreciated,
    Thanks & Regards,
    Aluri

    Hi,
    This error will come when your are transporting any Query/ BW elements to Production system.
    when there is element in the deve. class $TEM in your collected objects this error may come, so identify this elements and change this Dev.class to other package used in transportaion.
    To change all the elements to common dev. class first collecting the elements using transport connection. secondly, using the Pencil button at the menu of trasnport change to required dev.class.
    you can change individaul elements also.
    Regards,
    Vish.

  • Problem  while reading XML file from Aplication server(Al11)

    Hi Experts
    I am facing a problem while  reading XML file from Aplication server  using open data set.
    OPEN DATASET v_dsn IN BINARY MODE FOR INPUT.
    IF sy-subrc <> 0.
        EXIT.
      ENDIF.
      READ DATASET v_dsn INTO v_rec.
    WHILE sy-subrc <> 0.
      ENDWHILE.
      CLOSE DATASET v_dsn.
    The XML file contains the details from an IDOC number  ,  the expected output  is XML file giving  all the segments details in a single page and send the user in lotus note as an attachment, But in the  present  output  after opening the attachment  i am getting a single XML file  which contains most of the segments ,but in the bottom part it is giving  the below error .
    - <E1EDT13 SEGMENT="1">
      <QUALF>001</QUALF>
      <NTANF>20110803</NTANF>
      <NTANZ>080000</NTANZ>
      <NTEND>20110803<The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    Invalid at the top level of the document. Error processing resource 'file:///C:/TEMP/notesD52F4D/SHPORD_0080005842.xml'.
    /SPAN></NTEND>
      <NTENZ>000000</NTENZ>
    for all the xml  its giving the error in bottom part ,  but once we open the source code and  if we saved  in system without changing anything the file giving the xml file without any error in that .
    could any one can help to solve this issue .

    Hi Oliver
    Thanx for your reply.
    see the latest output
    - <E1EDT13 SEGMENT="1">
      <QUALF>003</QUALF>
      <NTANF>20110803</NTANF>
      <NTANZ>080000</NTANZ>
      <NTEND>20110803</NTEND>
      <NTENZ>000000</NTENZ>
      <ISDD>00000000</ISDD>
      <ISDZ>000000</ISDZ>
      <IEDD>00000000</IEDD>
      <IEDZ>000000</IEDZ>
      </E1EDT13>
    - <E1EDT13 SEGMENT="1">
      <QUALF>001</QUALF>
      <NTANF>20110803</NTANF>
      <NTANZ>080000</NTANZ>
      <NTEND>20110803<The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    Invalid at the top level of the document. Error processing resource 'file:///C:/TEMP/notesD52F4D/~1922011.xml'.
    /SPAN></NTEND>
      <NTENZ>000000</NTENZ>
    E1EDT13 with QUALF>003 and  <E1EDT13 SEGMENT="1">
    with   <QUALF>001 having almost same segment data . but  E1EDT13 with QUALF>003  is populating all segment data
    properly ,but E1EDT13 with QUALF>001  is giving in between.

  • Problem while sending unicode (utf-8) xml to IE.

    Hi,
    I have encoding problem while sending utf-8 xml from servlet to IE (Client), where i am parsing the xml using Ajax.
    In the log I can see proper special characters that are being sent from the servlet. but when same is seen in the client end,, it is showing ? symbols instead of special charcters.
    This is the code that sends the xml from servlet.
    ByteArrayOutputStream stream = new ByteArrayOutputStream(2000);
    transformer.transform(new DOMSource(document), new StreamResult(new OutputStreamWriter(stream, "iso-8859-1")));
    _response.setContentType("text/xml; charset=UTF-8");
    _response.setHeader("Cache-Control", "no-cache");
    _response.getWriter().println(new String(stream.toByteArray(),  "UTF-8"));
    In the log i can see :
    <response status="success" value="1154081722531" hasNextPage="false" hasPreviousPage="false" ><row row_id="PARTY_test_asdasd" column_0="PARTY_test_asdasd" column_1="asdasd �" mode="edit" column_en_US="asdasd �" column_de_DE="? xyz" column_fr_FR="" ></row></response>
    But in the Client side I am able to see
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <response status="success" value="1154082795061" hasNextPage="false" hasPreviousPage="false"><row row_id="PARTY_test_asdasd" column_0="PARTY_test_asdasd" column_1="asdasd ?" mode="edit" column_en_US="asdasd ?" column_de_DE="? xyz" column_fr_FR=""/></response>
    I am getting ? instead of �.
    It will be greatful if somebody tell how to send utf xml from servlet, for ajax purpose.
    Thanks,
    Siva1

    This is the code that sends the xml from servlet.
    ByteArrayOutputStream stream = new
    ByteArrayOutputStream(2000);
    transformer.transform(new DOMSource(document), new
    StreamResult(new OutputStreamWriter(stream,
    "iso-8859-1")));Here you produce XML that's encoded in ISO-8859-1. (!!!)
    _response.setContentType("text/xml; charset=UTF-8");Here you tell the browser that it's encoded in UTF-8.
    _response.getWriter().println(new String(stream.toByteArray(), "UTF-8"));Here you convert the XML to a String, assuming that it was encoded in UTF-8, which it wasn't.
    Besides shooting yourself in the foot by choosing ISO-8859-1 for no good reason, you're also doing a lot of translating from bytes to chars and back again. Not only is that a waste of time, it introduces errors if you don't do it right. Try this instead:_response.setContentType("text/xml; charset=UTF-8");
    _response.setHeader("Cache-Control", "no-cache");
    _transformer.transform(new DOMSource(document_),
                    new StreamResult(_response.getOutputStream()));

  • Problems while sending mail using java mail

    hi all,
    the following are the errors i get while sending a mail from my smtp local host-
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.*;
    import javax.mail.Authenticator;
    import javax.mail.PasswordAuthentication;
    public class SendEmail
         public static void main(String[] args)
    System.out.println(args.length);
              if (args.length != 6)
                   System.out.println("usage: sendmessage <to> <from> <smtphost> <true|false> <subject> <text>");
                   System.exit(1);System.out.println("jj"+args.length);
         SendEmail m=new SendEmail();
         m.SendMessage(args[0],args[1], args[2], args[3], args[4], args[5]);
    public static String SendMessage(String emailto, String emailfrom, String smtphost, String emailmultipart, String msgSubject, String msgText)
    boolean debug = false; // change to get more information
    String msgText2 = "multipart message";
    boolean sendmultipart = Boolean.valueOf(emailmultipart).booleanValue();
    // set the host
    Properties props = new Properties();
    props.put("mail.smtp.host",smtphost);
         props.put("mail.smtp.starttls.enable","true");
    props.put("mail.smtp.auth", "true");
    props.put("mail.smtp.sendpartial", "true");
    Authenticator loAuthenticator = new SMTPAuthenticator();
    System.out.println("f");
    // create some properties and get the default Session
    Session session = Session.getDefaultInstance(props, loAuthenticator );
    session.setDebug(debug);
    try
    // create a message
    Message msg = new MimeMessage(session);
    // set the from
    InternetAddress from = new InternetAddress(emailfrom);
    msg.setFrom(from);
    InternetAddress[] address =
    new InternetAddress(emailto)
    //InternetAddress ad=new InternetAddress(session);
    msg.setRecipients(Message.RecipientType.TO, address);
    System.out.println("fc");
    msg.setSubject(msgSubject);
    System.out.println("fvf");
    if(!sendmultipart)
    // send a plain text message
    msg.setContent(msgText, "text/plain");
    System.out.println("fif");
    else
    System.out.println("felsd");
    // send a multipart message// create and fill the first message part
    MimeBodyPart mbp1 = new MimeBodyPart();
    mbp1.setContent(msgText, "text/plain");
    // create and fill the second message part
    MimeBodyPart mbp2 = new MimeBodyPart();
    mbp2.setContent(msgText2, "text/plain");
    // create the Multipart and its parts to it
    Multipart mp = new MimeMultipart();
    mp.addBodyPart(mbp1);
    mp.addBodyPart(mbp2);
    // add the Multipart to the message
    msg.setContent(mp);
    Transport transport = session.getTransport("smtp");
         transport.connect(smtphost,"[email protected]","xyz");
    msg.saveChanges();
    System.out.println("fconn");
              //transport.sendMessage(msg,msg.getAllRecipients());
    transport.sendMessage(msg,msg.getAllRecipients());
    transport.close();     
    //Transport.send(msg);
    catch(MessagingException mex)
    mex.printStackTrace();
    return "Email sent to " + emailto;
    class SMTPAuthenticator extends Authenticator
    public PasswordAuthentication getPasswordAuthentication()
    String username = "[email protected]";
    String password = "xyz";
    return new PasswordAuthentication(username, password);
    i dont understand what the problem is..inspite of having the right code..
    i guess some firewall problem..
    can somebody help me please..il be highly obliged..thanks..

    hi all,
    the following are the errors i get while sending a mail from my smtp local host-
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.*;
    import javax.mail.Authenticator;
    import javax.mail.PasswordAuthentication;
    public class SendEmail
         public static void main(String[] args)
    System.out.println(args.length);
              if (args.length != 6)
                   System.out.println("usage: sendmessage <to> <from> <smtphost> <true|false> <subject> <text>");
                   System.exit(1);System.out.println("jj"+args.length);
         SendEmail m=new SendEmail();
         m.SendMessage(args[0],args[1], args[2], args[3], args[4], args[5]);
    public static String SendMessage(String emailto, String emailfrom, String smtphost, String emailmultipart, String msgSubject, String msgText)
    boolean debug = false; // change to get more information
    String msgText2 = "multipart message";
    boolean sendmultipart = Boolean.valueOf(emailmultipart).booleanValue();
    // set the host
    Properties props = new Properties();
    props.put("mail.smtp.host",smtphost);
         props.put("mail.smtp.starttls.enable","true");
    props.put("mail.smtp.auth", "true");
    props.put("mail.smtp.sendpartial", "true");
    Authenticator loAuthenticator = new SMTPAuthenticator();
    System.out.println("f");
    // create some properties and get the default Session
    Session session = Session.getDefaultInstance(props, loAuthenticator );
    session.setDebug(debug);
    try
    // create a message
    Message msg = new MimeMessage(session);
    // set the from
    InternetAddress from = new InternetAddress(emailfrom);
    msg.setFrom(from);
    InternetAddress[] address =
    new InternetAddress(emailto)
    //InternetAddress ad=new InternetAddress(session);
    msg.setRecipients(Message.RecipientType.TO, address);
    System.out.println("fc");
    msg.setSubject(msgSubject);
    System.out.println("fvf");
    if(!sendmultipart)
    // send a plain text message
    msg.setContent(msgText, "text/plain");
    System.out.println("fif");
    else
    System.out.println("felsd");
    // send a multipart message// create and fill the first message part
    MimeBodyPart mbp1 = new MimeBodyPart();
    mbp1.setContent(msgText, "text/plain");
    // create and fill the second message part
    MimeBodyPart mbp2 = new MimeBodyPart();
    mbp2.setContent(msgText2, "text/plain");
    // create the Multipart and its parts to it
    Multipart mp = new MimeMultipart();
    mp.addBodyPart(mbp1);
    mp.addBodyPart(mbp2);
    // add the Multipart to the message
    msg.setContent(mp);
    Transport transport = session.getTransport("smtp");
         transport.connect(smtphost,"[email protected]","xyz");
    msg.saveChanges();
    System.out.println("fconn");
              //transport.sendMessage(msg,msg.getAllRecipients());
    transport.sendMessage(msg,msg.getAllRecipients());
    transport.close();     
    //Transport.send(msg);
    catch(MessagingException mex)
    mex.printStackTrace();
    return "Email sent to " + emailto;
    class SMTPAuthenticator extends Authenticator
    public PasswordAuthentication getPasswordAuthentication()
    String username = "[email protected]";
    String password = "xyz";
    return new PasswordAuthentication(username, password);
    i dont understand what the problem is..inspite of having the right code..
    i guess some firewall problem..
    can somebody help me please..il be highly obliged..thanks..

Maybe you are looking for

  • DVI Out Flicker and connection issues- Macbook Pro 2006

    No matter which monitors/cable combination I use, my external display flickers at random times. Sometimes, the signal will come back a second or two later, other times it will go out until a reboot. From my unofficial "tests", this happens more (but

  • Bootcamp - OSx on one hard drive and windows 7 64bit on another hard drive

    I have browsed the forum and the net without getting a clear answer Fact: With optical bay and two hard drives there is a posibility to use two harddrives within the sam MacBook Pro. The reason is space and speed, I want loads of space to all my proj

  • Resolution for scaled up apps in ios 8

    I just received my iphone 6 this morning :-) As I got everything setup I am noticing that the 3rd party apps that are getting scaled up due to the bigger screen size look really bad and feel low resolution due to this I recall during the setup there

  • Trying to burn an album and PE won't do it

    It keeps going in a search mode looking for lost or misplaced files.  What can I do to get around this problem?

  • How can copy GL account created at one chart of account to another COA

    Hello sap experts we have a requirement where client is using one chart of acocunt ND12 & they want to copy all the g.l account created at this chart of account to a new chart of account ND13. Kindly suggest is there any way to copy g.l accounts from