Socket Programing in J2ME - Confused with Sun Sample Code

Hai Everybody,
I have confused with sample code provided by Sun Inc , for the demo of socket programming in J2ME. I found the code in the API specification of J2ME. The code look like :-
// Create the server listening socket for port 1234
ServerSocketConnection scn =(ServerSocketConnection) Connector.open("socket://:1234");
where Connector.open() method return an interface Connection which is the base interface of ServerSocketConnection. I have confused with this line , is it is possible to cast base class object to the derived class object?
Plese help me in this regards
Thanks in advance
Sulfikkar

There is nothing to be confused about. The Connector factory creates an implementation of one of the extentions of the Connection interface and returns it.
For a serversocket "socket://<port>" it will return an implementation of the ServerSocketConnection interface. You don't need to know what the implementation looks like. You'll only need to cast the Connection to a ServerSocketConnection .

Similar Messages

  • Problems with using sample code for WebService client

    Hi <br /><br />Ive downloaded the sample code from the Adobe <br />website but when i run the client i get an error which i dont understand:<br /><br />client side:<br />ERROR: java.lang.NullPointerException<br />AxisFault<br /> faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException<br /> faultSubcode: <br /> faultString: java.lang.NullPointerException<br /> faultActor: <br /> faultNode: <br /> faultDetail: <br />     {http://xml.apache.org/axis/}hostname:GRFNZTS1SRV<br /><br />java.lang.NullPointerException<br />     at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)<br />     at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)<br />     at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:10 87)<br />     at weblogic.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1411)<br />     at weblogic.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:16 13)<br />     at weblogic.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumen tScanner.java:1174)<br />     at weblogic.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:399 )<br />     at weblogic.apache.xerces.framework.XMLParser.parse(XMLParser.java:1138)<br />     at weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:135)<br />     at weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:133)<br />     at javax.xml.parsers.SAXParser.parse(Unknown Source)<br />     at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)<br />     at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)<br />     at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)<br />     at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62) <br />     at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)<br />     at org.apache.axis.client.Call.invokeEngine(Call.java:2784)<br />     at org.apache.axis.client.Call.invoke(Call.java:2767)<br />     at org.apache.axis.client.Call.invoke(Call.java:2443)<br />     at org.apache.axis.client.Call.invoke(Call.java:2366)<br />     at org.apache.axis.client.Call.invoke(Call.java:1812)<br />     at com.adobe.livecycle.samples.pdfgenerator.axis.PdfGenSoapBindingStub.getConfigurationXML(P dfGenSoapBindingStub.java:373)<br />     at com.adobe.livecycle.samples.pdfgenerator.webserviceclient.WebServiceClient.generatePDF(We bServiceClient.java:174)<br />     at com.adobe.livecycle.samples.pdfgenerator.webserviceclient.WebServiceClient.main(WebServic eClient.java:95)<br /><br />and on the server side:<br /><Error> <com.adobe.idp.um.businesslogic.authentication.AuthenticationManagerBean> <000000> <UserM:GENERIC_ERROR:     [Thread: ExecuteThread: '58' for queue: 'default', hc: 735284715 ]No Auth Providers found > <br /><Sep 17, 2007 8:27:43 PM IDT> <Warning> <com.adobe.idp.common.errors.exception.IDPLoggedException> <000000> <UserM:GENERIC_WARNING:     [Thread: ExecuteThread: '58' for queue: 'default', hc: 735284715 ]| [AuthenticationManagerBean] errorCode:12801 errorCodeHEX:0x3201 message:No Auth Providers found in Config>

    i get this exception
    C:\Program Files\JMF2.1.1e\bin\video>javac FrameAccess.java
    C:\Program Files\JMF2.1.1e\bin\video>java FrameAccess C:\Program Files\JMF2.1.1e
    \bin\video\gtrevor.avi
    Failed to create a processor from the given url: javax.media.NoProcessorExceptio
    n: Cannot find a Processor for: C:\Program
    how to solve it

  • Can we save the video file from Sun sample code TestEffect instead of playi

    can we save the video after adding an effect to it using the TestEffect sample code from Sun instead of playing it!

    Hi All,
    Please Update the Thread
    Regards
    Khanna

  • Problem with running sample code from XML Schema Processor for Java

    Hi there,
    I downloaded the XML Schema Processor for Java and tried it out. Unfortunately, it failed at the first step. FYI, I included all xmlparserv2.jar and xmlschema.jar in my classpath.
    I compiled XSDSample.java with a warning: XSDSample.java uses a deprecated API. Recompile with "-deprecation" for details. There was no problem with compiling XSDSetSchema.java.
    When I tried to run report.xml by typing java XSDSample report.xml, I got Parsing report.xml
    NonParserException: null.
    I guess that report.xml from the sample is not valid.
    Could any one give me a hint? Any suggestion would be greatly appreciated.
    ---Denali
    null

    Please post this message at:
    Forums Home » Oracle Technology Network (OTN) » Products » Database » XML DB

  • Problem with HttpUploadBean sample code

    Hello,
    I need upload files to a database and download files from database. I have some problems and i'm trying the sample in the help "File Upload and Download JavaBean and Class Descriptions" - "The HttpUploadBean".
    File UploadBean.html:
    <html><body>
    <form action="beanUploadExample.jsp" ENCTYPE="multipart/form-data" method=POST>
    <br> File to upload: <INPUT TYPE="FILE" NAME="File" SIZE="50" MAXLENGTH="120" >
    <br><INPUT TYPE="SUBMIT" NAME="Submit" VALUE="Send"> </form>
    </body></html>
    File beanUploadExample.jsp:
    <%@ page language="java" import="java.util.*, oracle.jsp.webutil.fileaccess.*"
    %>
    <html><body>
    <% String userdir = "fileaccess"; %> // user's part of the upload directory
    <jsp:useBean id="upbean"
    class="oracle.jsp.webutil.fileaccess.HttpUploadBean" >
    <jsp:setProperty name="upbean" property="destination" value="<%= userdir %>"
    />
    </jsp:useBean>
    <%
    upbean.setBaseDir(application, request);
    upbean.upload(request);
    Enumeration fileNames = upbean.getFileNames();
    while (fileNames.hasMoreElements()) { %>
    <br><%= (String)fileNames.nextElement() %>
    <% } %>
    <br>Done!
    </body></html>
    Content of fileaccess.properties file in directory G:\jdeveloper9i\jdev\mywork\AccessFiles\Upload\public_html\WEB-INF
    fileaccess.basedir=G:\jdeveloper9i\jdev\mywork\AccessFiles\Upload\public_html\files
    (the directory files has been created)
    Interner Explorer (version 5.00.3315.1000) show error 500 (Internal Server Error) after to select the file and click in the buttom "Send"
    In Debug mode, to press F8 (Step over) in the line upbean.upload(request); show the error:
    "Unable to find source file for package oracle.jsp.runtime, filename httpJsp.java"
    I'm trying jDeveloper9i version 9.0.2.829
    Any help is welcome
    Thanks

    Hi,
    I will try the HttpUploadBean very soon but haven't test it. Will this article would help : Re: File Upload tag and Bean
    Rgds.

  • AI CS6 install - sample code can't run correctly

    Hi
    I have problem with run sample code in AI CS6.
    I install AI CS6 and download SDK for AI CS6. I build plugin sample code (tutorial, webter). I build success but This program can't run in CS6.
    With Tutorial. It's apprirance in menu Help and menu Object->Filter->SDK->Tutorial. But no action when I click there
    With webter. It's apprirance in menu Help and menu Window->SDK->webter. But no action when I click there
    My Os is windown XP SP3.
    I build with visual studio 10.
    I can build success plugin sample code in SDK CS5 and run success with AI CS5.
    Do you have same problem ?

    Hi Hehiha,
    Because you have the menu items appearing I think the C++ side of the sample should be running correctly. However both these samples use a flash extension to provide the UI which is something that has changed between the CS5 and CS6 SDKs. If the extensions that provide this UI were not installed or running using Extension Builder then I would expect it to lead to the behaviour you are experiencing.
    To install  the extensions to confirm that this fixes the issue you can do the following:
    If you look in the TutorialUI or WebterUI folders you should see an output folder in with TutorialUI.zxp or WebterUI.zxp if you double click those files they should open Extension Manager and install the extension.
    If you restart Illustrator and retry the plugins I would expect them to now show a panel after you have clicked on the menu items. That is if the problem is what I have described.
    I hope that helps,
    Thanks,
    Robert

  • Sample code creating BOM for CS01 using BDC recording.

    Hi,
    Can anyone give me sample coding creating BOM for CS01 using BDC recording.
    I want to display the flat file records,under one (Alternative BOM).
    I m already working on it,but i m getting one A.BOM for each records.
    [       Header data          ]    [      Item Data               ]
    SOFTDRINKS   WIND   1       13            1     ml     l
    SOFTDRINKS   WIND   1       11            1     ml     l
    SOFTDRINKS   WIND   1       15        1     ml     l
    SOFTDRINKS   WIND   1       14       1     ml     l
    Code:
    report ZBOM
           no standard page heading line-size 255.
    *include bdcrecx1.
    *DATA: BEGIN OF bdc OCCURS 0,
          matnr(18),
          werks(4),
          stlan(1),
         END OF BDC.
    *DATA: BEGIN OF BDC1 OCCURS 0,
          idnrk(18),
          MENGE(18),
          MEINS(3),
          postp(1),
          posnr(4),
         END OF bdc1.
    DATA: BEGIN OF BDCDATA OCCURS 0,
             matnr(18),
             werks(4),
             stlan(1),
             idnrk(18),
             MENGE(18),
             MEINS(3),
             postp(1),
             posnr(4),
          END OF BDCDATA.
    data  ibdcdata type standard table of bdcdata WITH  header line.
    *start-of-selection.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = 'C:\Documents and Settings\dilipkumar.b\Desktop\soft.txt'
       FILETYPE                       = 'ASC'
       HAS_FIELD_SEPARATOR            = ','
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      VIRUS_SCAN_PROFILE            =
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                     =
      HEADER                         =
      TABLES
        DATA_TAB                      = BDCDATA
    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
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    *perform open_group.
    loop at bdcdata.
    perform bdc_dynpro      using 'SAPLCSDI' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29N-STLAN'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RC29N-MATNR'
                                  'SOFTDRINKS'.
    perform bdc_field       using 'RC29N-WERKS'
                                  'WIND'.
    perform bdc_field       using 'RC29N-STLAN'
                                  '1'.
    perform bdc_field       using 'RC29N-DATUV'
                                  '16.09.2008'.
    perform bdc_dynpro      using 'SAPLCSDI' '0110'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RC29K-BMENG'
                                  '1'.
    perform bdc_field       using 'RC29K-STLST'
                                  '1'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29K-EXSTL'.
    perform bdc_dynpro      using 'SAPLCSDI' '0111'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29K-LABOR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPLCSDI' '0140'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29P-POSTP(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=FCBU'.
    perform bdc_field       using 'RC29P-IDNRK(001)'
                                  BDCDATA-IDNRK.
    perform bdc_field       using 'RC29P-MENGE(001)'
                                  BDCDATA-MENGE.
    perform bdc_field       using 'RC29P-MEINS(001)'
                                  BDCDATA-MEINS.
    perform bdc_field       using 'RC29P-POSTP(001)'
                                  BDCDATA-POSTP.
    perform bdc_dynpro      using 'SAPLCSDI' '0130'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29P-POSNR'.
    perform bdc_field       using 'RC29P-POSNR'
                                   BDCDATA-POSNR.            "'0010'.
    perform bdc_field       using 'RC29P-IDNRK'
                                  BDCDATA-IDNRK.             "'15'.
    perform bdc_field       using 'RC29P-MENGE'
                                  BDCDATA-MENGE.             "'1'.
    perform bdc_field       using 'RC29P-MEINS'
                                  BDCDATA-MEINS.             "'ml'.
    perform bdc_dynpro      using 'SAPLCSDI' '0131'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29P-POTX1'.
    perform bdc_field       using 'RC29P-SANKA'
                                  'X'.
    *perform bdc_transaction using 'CS01'.
    *perform close_group.
    CALL TRANSACTION 'CS01' USING IBDCDATA MODE 'A' UPDATE 'S'.
    REFRESH IBDCDATA.
    clear ibdcdata.
    endloop.
           Start new screen                                              *
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR iBDCDATA.
      iBDCDATA-PROGRAM  = PROGRAM.
      iBDCDATA-DYNPRO   = DYNPRO.
      iBDCDATA-DYNBEGIN = 'X'.
      APPEND ibDCDATA .
    ENDFORM.
           Insert field                                                  *
    FORM BDC_FIELD USING FNAM FVAL.
    IF FVAL <> NODATA.
        CLEAR iBDCDATA.
        iBDCDATA-FNAM = FNAM.
        iBDCDATA-FVAL = FVAL.
        APPEND iBDCDATA .
    ENDIF.
    ENDFORM.

    Hi,
          I tried with the sample code but i m not getting the required result.
        Can anyone give some other soln.
    Code:
    REPORT  ZBOM2
    no standard page heading line-size 255.
    *include bdcrecx1.
    TYPES: BEGIN OF TY_FLAT,      " structure for flat file
            STRING(200),
           END OF TY_FLAT.
    TYPES: BEGIN OF TY_HEAD,     " structure for header file
            IND(2) TYPE N,
            MATNR(18),
            WERKS(4),
            STLAN(1),
           END OF TY_HEAD.
    TYPES : BEGIN OF TY_ITEM,    "structure for item file
              IND(2) TYPE N,
              POSTP(1),
              IDNRK(18),
              MENGE(13),
              meins(3),
            END OF TY_ITEM.
    TYPES :BEGIN OF TY_FLAT1,   " structure for final file
             MATNR(18),
             WERKS(4),
             STLAN(1),
             posnr(4),
             POSTP(1),
             IDNRK(18),
             MENGE(13),
             meins(3),
           END OF TY_FLAT1.
    INTERNAL TABLE DECLERATIONS:
    DATA : T_FLAT TYPE STANDARD TABLE OF TY_FLAT,
           T_FLAT1 TYPE STANDARD TABLE OF TY_FLAT1,
           T_HEAD TYPE STANDARD TABLE OF TY_HEAD,
           T_ITEM TYPE STANDARD TABLE OF TY_ITEM,
           T_BDCDATA TYPE STANDARD TABLE OF BDCDATA with header line ,
           T_BDCMSG TYPE STANDARD TABLE OF BDCMSGCOLL.
    WORK AREA DECLERATIONS:
    DATA : ST_FLAT TYPE TY_FLAT,
           ST_FLAT1 TYPE TY_FLAT1,
           ST_HEAD TYPE TY_HEAD,
           ST_ITEM TYPE TY_ITEM,
           ST_BDCDATA TYPE BDCDATA,
           ST_BDCMSG TYPE BDCMSGCOLL.
    VARIABLES:
    DATA : FNAM TYPE LOCALFILE,           "rlgrap-filename,
           FTYP TYPE RLGRAP-FILETYPE,
           LF_FNAM TYPE STRING.
    DATA : V_IND(2) TYPE N,                " value 1,
           V_FLD(20),
           V_NO(2) TYPE N.
    *start-of-selection.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = 'C:\Documents and Settings\dilipkumar.b\Desktop\soft.txt'
       FILETYPE                       = 'ASC'
       HAS_FIELD_SEPARATOR            = ','
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      VIRUS_SCAN_PROFILE            =
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                     =
      HEADER                         =
      TABLES
        DATA_TAB                      = T_FLAT
    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
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LOOP AT T_FLAT INTO ST_FLAT.
    SPLIT ST_FLAT AT CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB
    INTO ST_FLAT1-MATNR ST_FLAT1-WERKS
    ST_FLAT1-STLAN ST_FLAT1-POSTP
    ST_FLAT1-IDNRK ST_FLAT1-MENGE ST_FLAT1-MEINS.
    APPEND ST_FLAT1 TO T_FLAT1.
    CLEAR ST_FLAT1.
    ENDLOOP.
    SORT T_FLAT1 BY MATNR WERKS STLAN POSTP IDNRK MENGE MEINS.
    LOOP AT T_FLAT1 INTO ST_FLAT1.
    MOVE :
    ST_FLAT1-MATNR TO ST_HEAD-MATNR,
    ST_FLAT1-WERKS TO ST_HEAD-WERKS,
    ST_FLAT1-STLAN TO ST_HEAD-STLAN,
    ST_FLAT1-POSTP TO ST_ITEM-POSTP,
    ST_FLAT1-IDNRK TO ST_ITEM-IDNRK,
    ST_FLAT1-MENGE TO ST_ITEM-MENGE,
    ST_FLAT1-MENGE TO ST_ITEM-MEINS.
    AT new STLAN.
      ADD 1 TO V_IND.
    ENDAT.
    MOVE V_IND TO ST_HEAD-IND.
    MOVE V_IND TO ST_ITEM-IND.
    APPEND ST_HEAD TO T_HEAD.
    APPEND ST_ITEM TO T_ITEM.
    CLEAR ST_HEAD.
    CLEAR ST_ITEM.
    ENDLOOP.
    CLEAR V_IND.
    *perform open_group.
    SORT T_ITEM BY IND.
    SORT T_HEAD BY IND.
    DELETE ADJACENT DUPLICATES FROM T_HEAD.
    LOOP AT T_HEAD INTO ST_HEAD.
    perform bdc_dynpro      using 'SAPLCSDI' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29N-STLAN'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RC29N-MATNR'
                                  ST_HEAD-MATNR.
    perform bdc_field       using 'RC29N-WERKS'
                                  ST_HEAD-WERKS.
    perform bdc_field       using 'RC29N-STLAN'
                                  ST_HEAD-STLAN.
    perform bdc_field       using 'RC29N-DATUV'
                                  '16.09.2008'.
    perform bdc_dynpro      using 'SAPLCSDI' '0110'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RC29K-BMENG'
                                  '1'.
    perform bdc_field       using 'RC29K-STLST'
                                  '1'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29K-EXSTL'.
    perform bdc_dynpro      using 'SAPLCSDI' '0111'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29K-LABOR'.
    LOOP AT T_ITEM INTO ST_ITEM WHERE IND = ST_HEAD-IND.
    ADD 1 TO V_NO.
    perform bdc_dynpro      using 'SAPLCSDI' '0140'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29K-MENGE(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=FCBU'.
    perform bdc_dynpro      using 'SAPLCSDI' '0140'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29P-POSNR(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=FCBU'.
    perform bdc_field       using 'RC29P-IDNRK(01)'
                                  ST_ITEM-IDNRK.
    perform bdc_field       using 'RC29P-MENGE(01)'
                                  ST_ITEM-MENGE.
    perform bdc_field       using 'RC29P-MEINS(01)'
                                  ST_ITEM-MEINS.
    perform bdc_field       using 'RC29P-POSTP(01)'
                                  ST_ITEM-POSTP.
    CONCATENATE 'RC29K-IDNRK(' V_NO ')' INTO V_FLD.
    CONDENSE V_FLD.
    PERFORM BDC_FIELD USING V_FLD
    ST_ITEM-IDNRK.
    CONCATENATE 'RC29K-MENGE(' V_NO ')' INTO V_FLD.
    CONDENSE V_FLD.
    PERFORM BDC_FIELD USING V_FLD
    ST_ITEM-MENGE.
    CONCATENATE 'RC29K-MEINS(' V_NO ')' INTO V_FLD.
    CONDENSE V_FLD.
    PERFORM BDC_FIELD USING V_FLD
    ST_ITEM-MEINS.
    CONCATENATE 'RC29K-POSTP(' V_NO ')' INTO V_FLD.
    CONDENSE V_FLD.
    PERFORM BDC_FIELD USING V_FLD
    ST_ITEM-POSTP.
    V_NO = 1.
    ENDLOOP.
    CLEAR V_NO.
    *perform bdc_dynpro      using 'SAPLCSDI' '0130'.
    *perform bdc_field       using 'BDC_OKCODE'
                                 '/00'.
    *perform bdc_field       using 'BDC_CURSOR'
                                 'RC29P-POSNR'.
    *perform bdc_field       using 'RC29P-POSNR'
                                  POSNR.
    *perform bdc_field       using 'RC29P-IDNRK'
                                 bdcdata-IDNRK.
    *perform bdc_field       using 'RC29P-MENGE'
                                 bdcdata-MENGE.
    *perform bdc_field       using 'RC29P-MEINS'
                                 bdcdata-MEINS.
    perform bdc_dynpro      using 'SAPLCSDI' '0131'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29P-POTX1'.
    perform bdc_field       using 'RC29P-SANKA'
                                     'X'.
    perform bdc_dynpro      using 'SAPLCSDI' '0133'.
    perform bdc_field       using 'BDC_OKCODE'
                                    '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29P-matkl'.
    perform bdc_field       using 'RC29P-SANKA'
                                     'zv01'.
    perform bdc_dynpro      using 'SAPLCSDI' '0140'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29N-POSNR(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=FCBU'.
    *perform bdc_transaction using 'CS01'.
    perform close_group.
    CALL TRANSACTION 'CS01' USING t_bdcdata MODE 'A' UPDATE 'S'.
    REFRESH t_bdcdata.
    clear t_bdcdata.
    endloop.
           Start new screen                                              *
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR st_bdcdata.
      st_bdcdata-PROGRAM  = PROGRAM.
      st_bdcdata-DYNPRO   = DYNPRO.
      st_bdcdata-DYNBEGIN = 'X'.
      APPEND st_bdcdata to t_bdcdata .
    ENDFORM.
           Insert field                                                  *
    FORM BDC_FIELD USING FNAM FVAL.
    IF FVAL <> NODATA.
        CLEAR st_bdcdata.
        st_bdcdata-FNAM = FNAM.
        st_bdcdata-FVAL = FVAL.
        APPEND st_bdcdata to t_bdcdata.
    ENDIF.
    ENDFORM.

  • Sample code to send a mail from SAP

    Hi guys
    could any one provide me with the
    sample code to send a mail from SAP with text as the main body of that mail via bcs classes

    Hi,
         Please go through this code: U can send mail;
    Tables : zchp_cust-info.
    DATA: OBJCONT LIKE SOLISTI1 OCCURS 5 WITH HEADER LINE.
    DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
    DATA: DOC_CHNG LIKE SODOCCHGI1.
    DATA: ENTRIES LIKE SY-TABIX.
    DATA: NAME(15).
    DATA: CON_NAME(20).
    DATA: req_num like zchp_cust_info.
    DATA: I_TAB_CHP LIKE ZCHP_CUST_INFO OCCURS 0 WITH HEADER LINE.
    *data: reno like ZCHP_CUST_INFO-req_num value .
    data input for the mail
    select * from zchp_cust_info
    appending table i_tab_chp where req_num = c_knumv.
    LOOP AT I_TAB_CHP.
    concatenate i_tab_chp-created_by i_tab_chp-req_num into CON_NAME.
    *WRITE: / con_name.
    ENDLOOP.
    Fill the document
    DOC_CHNG-OBJ_NAME = 'Refe'.
    DOC_CHNG-OBJ_DESCR = 'TESCRA Ref Number !'.
    DOC_CHNG-SENSITIVTY = 'P'.
    *OBJCONT = 'Tescra'.
    OBJCONT = CON_NAME.
    APPEND OBJCONT.
    OBJCONT = con_name.
    APPEND OBJCONT.
    DESCRIBE TABLE OBJCONT LINES ENTRIES.
    READ TABLE OBJCONT INDEX ENTRIES.
    DOC_CHNG-DOC_SIZE = ( ENTRIES - 1 ) * 255 + STRLEN( OBJCONT ).
    Fill the receiver list
    CLEAR RECLIST.
    RECLIST-RECEIVER = SY-UNAME.  " replace with <login name>
    RECLIST-REC_TYPE = 'B'.
    RECLIST-EXPRESS = 'X'.
    APPEND RECLIST.
    CLEAR RECLIST.
    RECLIST-RECEIVER = 'sapuser'.
    RECLIST-REC_TYPE = 'U'.
    APPEND RECLIST.
    Send the document
    CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
         EXPORTING
              DOCUMENT_TYPE  = 'RAW'
              DOCUMENT_DATA  = DOC_CHNG
              PUT_IN_OUTBOX  = 'X'
         TABLES
              OBJECT_CONTENT = OBJCONT
              RECEIVERS      = RECLIST
         EXCEPTIONS
              TOO_MANY_RECEIVERS         = 1
                   DOCUMENT_NOT_SENT          = 2
                  OPERATION_NO_AUTHORIZATION = 4
                   OTHERS                     = 99.
        CASE SY-SUBRC.
          WHEN 0.
            LOOP AT RECLIST.
              IF RECLIST-RECEIVER = SPACE.
                NAME = RECLIST-REC_ID.
              ELSE.
                NAME = RECLIST-RECEIVER.
              ENDIF.
              IF RECLIST-RETRN_CODE = 0.
                WRITE: / NAME, ': succesfully sent'.
              ELSE.
                WRITE: / NAME, ': error occured'.
              ENDIF.
            ENDLOOP.
          WHEN 1.
            WRITE: / 'Too many receivers specified !'.
          WHEN 2.
            WRITE: / 'No receiver got the document !'.
          WHEN 4.
            WRITE: / 'Missing send authority !'.
          WHEN OTHERS.
            WRITE: / 'Unexpected error occurred !'.
        ENDCASE.
    <b>Please provide points if the issue is solved.</b>
    Regards,
    Sunil

  • Need Sample code to retrieve Data from Portal DB(Oracle)

    Would anyone provide me steps to create application with a sample code to retrieve data from portal DB which is oracle and see the output in table format.

    Hi Bris ,
    The sample code , you didnt specified from where do u want to access the oracle thorough java code or through webdynpro .
    Sample code to access through Java
    import java.sql.*;
    class Customer
    public static void main(String args[]) throws SQLException
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    System.out.println("Connecting to the database...");
    try
    Connection cn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","scott","t");
    Statement st=cn.createStatement();
    ResultSet rs=st.executeQuery("select 'Connected' from dual");
    rs.next();
    String s=rs.getString(1);
    System.out.println(s);
    st.close();
    cn.close();
    catch(Exception ex)
    System.out.println("The exception raised is:" + ex);
    [code]
    If accessing through JDBC datasorce.
    https://www.sdn.sap.com/irj/sdn/thread?threadID=328550
    https://www.sdn.sap.com/irj/sdn/thread?threadID=309386
    [code]
    package com.dhl.employeemodel;
    import java.sql.Connection;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.sql.DataSource;
    public class DBConnectionManager {
         Connection connection;
          * @return
         public Connection getConnection() {
              try
                   Context jndiContext = new InitialContext();
                   DataSource ds = (DataSource)jndiContext.lookup("jdbc/MyAlias");
                   connection = ds.getConnection();
             catch(Exception connectionErrEx)
                   //connectionErrEx.printStackTrace();
                   return null;
              return connection;
    Thanx
    Pankaj

  • J2ME socket programming

    i am doing a final year project in which i have a java program running on pc connected to internet which uses bsnl as an isp.i am provided with a public ip
    i have a J2me client.I connect the mobile to internet with gprs.
    I use gprs wap settings of vodafone which uses proxies.i have searched internet
    and found out that i dont access actual internet using gprs wap. ie we only access wap sites.i want to try purely socket communications.i am using n72 mobile for midlets and socket communications.
    sc = (SocketConnection)Connector.open("socket://my bsnl ip:5000");
    is = sc.openInputStream();
    os = sc.openOutputStream();
    i have used simulator and tried communication it was successful.
    i tried socket communications form internet client and my server
    i also tried different ports too.
    now with actual n72 mobile i am having a problem of socket communication.
    summary of problems
    1.Is direct socket communication possible through gprs with client on N72
    with a java server
    2.Do i have to use wap settings or internet settings of vodafone

    here is my client on mobile..it is same as networkdemo in suns WTK2.5
    we used it for testing the connection...
    SocketMIdlet:
    package socket;
    import java.io.*;
    import javax.microedition.io.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    public class SocketMIDlet extends MIDlet implements CommandListener {
    private static final String SERVER = "Server";
    private static final String CLIENT = "Client";
    private static final String[] names = { SERVER, CLIENT };
    private static Display display;
    private Form f;
    private ChoiceGroup cg;
    private boolean isPaused;
    private Server server;
    private Client client;
    private Command exitCommand = new Command("Exit", Command.EXIT, 1);
    private Command startCommand = new Command("Start", Command.ITEM, 1);
    public SocketMIDlet() {
    display = Display.getDisplay(this);
    f = new Form("Socket Demo");
    cg = new ChoiceGroup("Please select peer", Choice.EXCLUSIVE, names, null);
    f.append(cg);
    f.addCommand(exitCommand);
    f.addCommand(startCommand);
    f.setCommandListener(this);
    display.setCurrent(f);
    public boolean isPaused() {
    return isPaused;
    public void startApp() {
    isPaused = false;
    public void pauseApp() {
    isPaused = true;
    public void destroyApp(boolean unconditional) {
    if (server != null) {
    server.stop();
    if (client != null) {
    client.stop();
    public void commandAction(Command c, Displayable s) {
    if (c == exitCommand) {
    destroyApp(true);
    notifyDestroyed();
    } else if (c == startCommand) {
    String name = cg.getString(cg.getSelectedIndex());
    if (name.equals(SERVER)) {
    server = new Server(this);
    server.start();
    } else {
    client = new Client(this);
    client.start();
    Client:
    package socket;
    import java.io.*;
    import javax.microedition.io.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    public class Client implements Runnable, CommandListener {
    private SocketMIDlet parent;
    private Display display;
    private Form f;
    private StringItem si;
    private TextField tf;
    private boolean stop;
    private Command sendCommand = new Command("Send", Command.ITEM, 1);
    private Command exitCommand = new Command("Exit", Command.EXIT, 1);
    InputStream is;
    OutputStream os;
    SocketConnection sc;
    Sender sender;
    public Client(SocketMIDlet m) {
    parent = m;
    display = Display.getDisplay(parent);
    f = new Form("Socket Client");
    si = new StringItem("Status:", " ");
    tf = new TextField("Send:", "", 30, TextField.ANY);
    f.append(si);
    f.append(tf);
    f.addCommand(exitCommand);
    f.addCommand(sendCommand);
    f.setCommandListener(this);
    display.setCurrent(f);
    * Start the client thread
    public void start() {
    Thread t = new Thread(this);
    t.start();
    public void run() {
    try {
    sc = (SocketConnection)Connector.open("socket://59.95.23.211:4000");
    si.setText("Connected to server");
    is = sc.openInputStream();
    os = sc.openOutputStream();
    // Start the thread for sending messages - see Sender's main
    // comment for explanation
    sender = new Sender(os);
    // Loop forever, receiving data
    while (true) {
    StringBuffer sb = new StringBuffer();
    int c = 0;
    while (((c = is.read()) != '\n') && (c != -1)) {
    sb.append((char)c);
    if (c == -1) {
    break;
    // Display message to user
    si.setText("Message received - " + sb.toString());
    stop();
    si.setText("Connection closed");
    f.removeCommand(sendCommand);
    } catch (ConnectionNotFoundException cnfe) {
    Alert a = new Alert("Client", "Please run Server MIDlet first", null, AlertType.ERROR);
    a.setTimeout(Alert.FOREVER);
    a.setCommandListener(this);
    display.setCurrent(a);
    } catch (IOException ioe) {
    if (!stop) {
    ioe.printStackTrace();
    } catch (Exception e) {
    e.printStackTrace();
    public void commandAction(Command c, Displayable s) {
    if ((c == sendCommand) && !parent.isPaused()) {
    sender.send(tf.getString());
    if ((c == Alert.DISMISS_COMMAND) || (c == exitCommand)) {
    parent.notifyDestroyed();
    parent.destroyApp(true);
    * Close all open streams
    public void stop() {
    try {
    stop = true;
    if (sender != null) {
    sender.stop();
    if (is != null) {
    is.close();
    if (os != null) {
    os.close();
    if (sc != null) {
    sc.close();
    } catch (IOException ioe) {
    Sender:
    package socket;
    import java.io.*;
    import javax.microedition.io.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    public class Sender extends Thread {
    private OutputStream os;
    private String message;
    public Sender(OutputStream os) {
    this.os = os;
    start();
    public synchronized void send(String msg) {
    message = msg;
    notify();
    public synchronized void run() {
    while (true) {
    // If no client to deal, wait until one connects
    if (message == null) {
    try {
    wait();
    } catch (InterruptedException e) {
    if (message == null) {
    break;
    try {
    os.write(message.getBytes());
    os.write("\r\n".getBytes());
    } catch (IOException ioe) {
    ioe.printStackTrace();
    // Completed client handling, return handler to pool and
    // mark for wait
    message = null;
    public synchronized void stop() {
    message = null;
    notify();
    Server:
    package socket;
    import java.io.*;
    import javax.microedition.io.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    public class Server implements Runnable, CommandListener {
    private SocketMIDlet parent;
    private Display display;
    private Form f;
    private StringItem si;
    private TextField tf;
    private boolean stop;
    private Command sendCommand = new Command("Send", Command.ITEM, 1);
    private Command exitCommand = new Command("Exit", Command.EXIT, 1);
    InputStream is;
    OutputStream os;
    SocketConnection sc;
    ServerSocketConnection scn;
    Sender sender;
    public Server(SocketMIDlet m) {
    parent = m;
    display = Display.getDisplay(parent);
    f = new Form("Socket Server");
    si = new StringItem("Status:", " ");
    tf = new TextField("Send:", "", 30, TextField.ANY);
    f.append(si);
    f.append(tf);
    f.addCommand(exitCommand);
    f.setCommandListener(this);
    display.setCurrent(f);
    public void start() {
    Thread t = new Thread(this);
    t.start();
    public void run() {
    try {
    si.setText("Waiting for connection");
    scn = (ServerSocketConnection)Connector.open("socket://:4000");
    // Wait for a connection.
    sc = (SocketConnection)scn.acceptAndOpen();
    si.setText("Connection accepted");
    is = sc.openInputStream();
    os = sc.openOutputStream();
    sender = new Sender(os);
    // Allow sending of messages only after Sender is created
    f.addCommand(sendCommand);
    while (true) {
    StringBuffer sb = new StringBuffer();
    int c = 0;
    while (((c = is.read()) != '\n') && (c != -1)) {
    sb.append((char)c);
    if (c == -1) {
    break;
    si.setText("Message received - " + sb.toString());
    stop();
    si.setText("Connection is closed");
    f.removeCommand(sendCommand);
    } catch (IOException ioe) {
    if (ioe.getMessage().equals("ServerSocket Open")) {
    Alert a = new Alert("Server", "Port 5000 is already taken.", null, AlertType.ERROR);
    a.setTimeout(Alert.FOREVER);
    a.setCommandListener(this);
    display.setCurrent(a);
    } else {
    if (!stop) {
    ioe.printStackTrace();
    } catch (Exception e) {
    e.printStackTrace();
    public void commandAction(Command c, Displayable s) {
    if ((c == sendCommand) && !parent.isPaused()) {
    sender.send(tf.getString());
    if ((c == Alert.DISMISS_COMMAND) || (c == exitCommand)) {
    parent.notifyDestroyed();
    parent.destroyApp(true);
    * Close all open streams
    public void stop() {
    try {
    stop = true;
    if (is != null) {
    is.close();
    if (os != null) {
    os.close();
    if (sc != null) {
    sc.close();
    if (scn != null) {
    scn.close();
    } catch (IOException ioe) {
    Client connects to server...server can send messages to server..but clients
    message does not reach server..that it cant be observed on server..how to debug jar file on mobile??

  • Sun comm 7 vmware appliance ,can not login with user sample

    Dear Expert ,
    I just download sun communication suite 7 (vmware appliance) :
    1.Unzip all part SunJava_Comms_Suite7u0_VM-part-1 until SunJava_Comms_Suite7u0_VM-part-5
    2. Open vmware and open it
    3. change the password
    4. reboot
    5.Click firefox on desktop ,i see sample username and password
    6. I try login with 2 sample user (login from http://chimaera.varrius.org/iwc )but i got meessage "The server has encountered an error. Please try again later"
    I am try start stop app server on /opt/SUNWappserver/domains/domain1/bin
    My question , how to solve this issue ?
    thanks
    hadi

    Hi Share,
    Thanks for reply , here the log
    [#|2010-02-01T22:55:21.822-0800|INFO|sun-appserver2.1|com.sun.comms.iss.common.InitContext|_ThreadID=10;_ThreadName=main;|Retry creating InitialContext|#]
    [#|2010-02-01T22:55:51.823-0800|WARNING|sun-appserver2.1|com.sun.comms.iss.common.InitContext|_ThreadID=10;_ThreadName=main;_RequestID=8bb98af7-fdbc-41e5-a151-c04e3584e529;|Retry creating InitialContext failed
    javax.naming.CommunicationException: chimaera.varrius.org:389 [Root exception is java.net.ConnectException: Connection refused]
    at com.sun.jndi.ldap.Connection.<init>(Connection.java:207)
    at com.sun.jndi.ldap.LdapClient.<init>(LdapClient.java:118)
    at com.sun.jndi.ldap.LdapClient.getInstance(LdapClient.java:1580)
    at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2652)
    at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:293)
    at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175)
    at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:193)
    at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:136)
    at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:66)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
    at javax.naming.InitialContext.init(InitialContext.java:223)
    at javax.naming.InitialContext.<init>(InitialContext.java:197)
    at com.sun.comms.iss.common.InitContext.getInitialContext(InitContext.java:57)
    at com.sun.comms.iss.common.ServiceProxy.<init>(ServiceProxy.java:171)
    at com.sun.comms.iss.common.ServiceProxy.getInstance(ServiceProxy.java:263)
    at com.sun.comms.iss.rest.RestServlet.initAccountStates(RestServlet.java:419)
    at com.sun.comms.iss.rest.RestServlet.<init>(RestServlet.java:71)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at com.noelios.restlet.ext.servlet.ServerServlet.createApplication(ServerServlet.java:285)
    at com.noelios.restlet.ext.servlet.ServerServlet.getApplication(ServerServlet.java:704)
    at com.noelios.restlet.ext.servlet.ServerServlet.init(ServerServlet.java:819)
    at javax.servlet.GenericServlet.init(GenericServlet.java:270)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:292)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
    at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:325)
    at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:208)
    at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1091)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1020)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4948)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:5355)
    at com.sun.enterprise.web.WebModule.start(WebModule.java:353)
    at com.sun.enterprise.web.LifecycleStarter.doRun(LifecycleStarter.java:58)
    at com.sun.appserv.management.util.misc.RunnableBase.runSync(RunnableBase.java:304)
    at com.sun.appserv.management.util.misc.RunnableBase._submit(RunnableBase.java:176)
    at com.sun.appserv.management.util.misc.RunnableBase.submit(RunnableBase.java:192)
    at com.sun.enterprise.web.VirtualServer.startChildren(VirtualServer.java:1762)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1247)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:971)
    at com.sun.enterprise.web.LifecycleStarter.doRun(LifecycleStarter.java:58)
    at com.sun.appserv.management.util.misc.RunnableBase.runSync(RunnableBase.java:304)
    at com.sun.appserv.management.util.misc.RunnableBase._submit(RunnableBase.java:176)
    at com.sun.appserv.management.util.misc.RunnableBase.submit(RunnableBase.java:192)
    at com.sun.enterprise.web.EmbeddedWebContainer$WebEngine.startChildren(EmbeddedWebContainer.java:497)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1247)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:549)
    at org.apache.catalina.startup.Embedded.start(Embedded.java:952)
    at com.sun.enterprise.web.WebContainer.start(WebContainer.java:872)
    at com.sun.enterprise.web.PEWebContainer.startInstance(PEWebContainer.java:792)
    at com.sun.enterprise.web.PEWebContainerLifecycle.onStartup(PEWebContainerLifecycle.java:89)
    at com.sun.enterprise.server.ApplicationServer.onStartup(ApplicationServer.java:446)
    at com.sun.enterprise.server.ondemand.OnDemandServer.onStartup(OnDemandServer.java:134)
    at com.sun.enterprise.server.PEMain.run(PEMain.java:409)
    at com.sun.enterprise.server.PEMain.main(PEMain.java:336)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.enterprise.server.PELaunch.main(PELaunch.java:415)
    Caused by: java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
    at java.net.Socket.connect(Socket.java:525)
    at java.net.Socket.connect(Socket.java:475)
    at java.net.Socket.<init>(Socket.java:372)
    at java.net.Socket.<init>(Socket.java:186)
    at com.sun.jndi.ldap.Connection.createSocket(Connection.java:349)
    at com.sun.jndi.ldap.Connection.<init>(Connection.java:184)
    ... 67 more
    thanks
    hadi

  • Any socket programming sample program or API for transfer file?

    Do there any java socket programming sample program or API for transfer file ,list file and make directory from client side?
    Thank you

    http://forum.java.sun.com/thread.jspa?threadID=603685&tstart=0

  • Sun ejb tutorial compilation problem with sample code

    I have been trying to follow the ejb tutorial off of Sun's web site. However, I get the following problem when I try to compile the sample code.
    prompt>javac Demo.java
    works fine
    Prompt>javac DemoBean.java
    works fine
    Prompt>javac DemoHome.java
    DemoHome.java:23: cannot resolve symbol
    symbol : class Demo
    location: interface ejb.demo.DemoHome
    public Demo create() throws CreateException, RemoteException;
    ^
    1 error
    Prompt>
    Can anyone help me out as I have tried several books which conveniently skip the part about compiling errors.
    I noticed I don't have a CLASSPATH variable and then i created one with just '.' in it and that didn't work. any help would be appreciated as this is driving me crazy. Thanks.

    try to change the order of the exception.
    first RemoteException and then CreateException

  • How to control tcp connection with java tcp socket programing ??

    Hi,
    I am connecting a server as using java socket programming.
    When server close the connection (socket object) as using close() method ,
    I can not detect this and My program continue sending data as if there is a connection with server.
    How to catch the closing connection ( socket ) with java socket programming.
    My Client program is as following :
    import java.io.PrintWriter;
    import java.net.Socket;
    public class client
      public client()
       * @param args
      public static void main(String[] args)
        Socket socket=null;
        PrintWriter pw=null;
        try
                          socket = new Socket("localhost",5555);
                          pw = new PrintWriter(socket.getOutputStream(),true);
                          int i=0;
                          while (true)
                            i++;
                            pw.println(i+". message is being send.");
                            Thread.sleep(5000);
        } catch (Exception ex)
                          ex.printStackTrace();
        } finally
                          try
                            if(pw!=null)pw.close();
                            if(socket!=null)socket.close();
                          } catch (Exception ex)
                            ex.printStackTrace();
                          } finally
    }

    I changed the code as following. But I couldn't catch the EOFException when I read from the socket. How can I catch this exception ?
    import java.io.BufferedReader;
    import java.io.EOFException;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.PrintWriter;
    import java.net.Socket;
    import java.net.UnknownHostException;
    public class client
      public client()
       * @param args
      public static void main(String[] args)
        Socket socket=null;
        PrintWriter pw=null;
        BufferedReader bufIn=null;
        InputStreamReader inRead=null;
        InputStream in=null;
        try
                          socket = new Socket("localhost",5555);
                          in = socket.getInputStream();
                          inRead = new InputStreamReader(in);
                          bufIn = new BufferedReader(inRead);
                          pw = new PrintWriter(socket.getOutputStream(),true);
                          int i=0;
                          while (true)
                            i++;
                            try
                              bufIn.readLine();
                              pw.println(i+". message is being send.");
                              System.out.println(i+". message has been send");
                            } catch (Exception ex2)
                              System.out.println(ex2.toString());
                              System.out.println(i+". message could not be send");
                            } finally
                            Thread.sleep(5000);
        } catch (EOFException ex)
                          ex.printStackTrace();
        } catch (InterruptedException ex)
                          ex.printStackTrace();
        } catch (IOException ex)
                          ex.printStackTrace();
        } finally
                          try
                            if(pw!=null)pw.close();
                            if(socket!=null)socket.close();
                          } catch (Exception ex)
                            ex.printStackTrace();
                          } finally
    }

  • Scan Rate - Sample Rate confusion with the E-Series

    I have been reading a lot of post on the messaging board concerning the scan rate and the sample rate but I still dont get it. I am using an E series and am aware that this card does not have a simultaneous
    sampling of each channel
    I want a time stamp for each value i get from each channel. If I have channels 1,2,3,4 with rate dividors
    1,2,4,8
    sample rate set to X
    scan rate set to X/(Number of channels+1) (ghost channel in order to avoid error -10092) ie X/5
    what is the sample rate of each channel ?

    VKral,
    Here are a few KnowledgeBase entries that I hope will clear up the confusion:
    Data Acquisition Sampling Terminology
    http://digital.ni.com/public.nsf/websearch/DBE7AC32661BCF9B86256AC000682154?OpenDocument
    How Is the Actual Scan Rate Determined When I Specify the Scan Rate for My Data Acquisition?
    http://digital.ni.com/public.nsf/websearch/5782F1B396474BAF86256A1D00572D6E?OpenDocument
    Hope this helps. Have a great day!

Maybe you are looking for