Naming method calls dynamicly

I'm trying to make an applet that uses the rectangle class to set areas for action listeners the problem is that the number of calls needed to be made to the rectangle class is not preset. the names will be detumined by a seperate file
An example:
int nC= //some ammount, nC is the number of calls that will be needed to made.
String names[nC]; //assume that names is filled with the strings already
for(int x=0; x<nC;x++)
      Rectangle /* this is were I need it to fit the string from names[x] */ =new Rectangle;
}Is that even possible, or is there another way to get the same effect?
Message was edited by:
Shibby

I'm trying to make an Applet with a menu on the side in the shapes of rectangles, and I just need some way to tell if a hit has occured in the rectangles, but the number of rectangles is not a set ammount, and need to be dynamic.

Similar Messages

  • Using a dynamic variable in the Import command of a Method call

    Hi,
    I am trying to make a Method call fully dynamic.
    I have found out how to make the Method name dynamic, but I am having trouble figuring out how to make the Importing statement dynamic.
    in my code below:
          CALL METHOD o_main->(v_call)
            IMPORTING
              it_ekko = i_ekko.
    I would like to know if it's possible to make both "it_ekko" AND "i_ekko" dynamic so I can use this same call for various tables.
    Hope that makes sense...thanks for your help.
    Andy

    Hi Andrew,
    The method call is fully dynamic; not only the parameters can be specified dynamically but also the method name.
    This is a help extract:
    DATA: line     TYPE c LENGTH 80,
          text_tab LIKE STANDARD TABLE OF line,
          filename TYPE string,
          filetype TYPE c LENGTH 10,
          fleng    TYPE i.
    DATA: meth  TYPE string,
          class TYPE string,
          ptab TYPE abap_parmbind_tab,
          ptab_line TYPE abap_parmbind,
          etab TYPE abap_excpbind_tab,
          etab_line TYPE abap_excpbind.
    DATA: exc_ref TYPE REF TO cx_sy_dyn_call_error,
          exc_text TYPE string.
    class    = 'CL_GUI_FRONTEND_SERVICES'.
    meth     = 'GUI_DOWNLOAD'.
    filename = 'c:\temp\text.txt'.
    filetype = 'ASC'.
    ptab_line-name = 'FILENAME'.
    ptab_line-kind = cl_abap_objectdescr=>exporting.
    GET REFERENCE OF filename INTO ptab_line-value.
    INSERT ptab_line INTO TABLE ptab.
    ptab_line-name = 'FILETYPE'.
    ptab_line-kind = cl_abap_objectdescr=>exporting.
    GET REFERENCE OF filetype INTO ptab_line-value.
    INSERT ptab_line INTO TABLE ptab.
    ptab_line-name = 'DATA_TAB'.
    ptab_line-kind = cl_abap_objectdescr=>changing.
    GET REFERENCE OF text_tab INTO ptab_line-value.
    INSERT ptab_line INTO TABLE ptab.
    ptab_line-name = 'FILELENGTH'.
    ptab_line-kind = cl_abap_objectdescr=>importing.
    GET REFERENCE OF fleng INTO ptab_line-value.
    INSERT ptab_line INTO TABLE ptab.
    etab_line-name = 'OTHERS'.
    etab_line-value = 4.
    INSERT etab_line INTO TABLE etab.
    TRY.
        CALL METHOD (class)=>(meth)
          PARAMETER-TABLE
            ptab
          EXCEPTION-TABLE
            etab.
        CASE sy-subrc.
          WHEN 1.
        ENDCASE.
      CATCH cx_sy_dyn_call_error INTO exc_ref.
        exc_text = exc_ref->get_text( ).
        MESSAGE exc_text TYPE 'I'.
    ENDTRY.
    BR,
    Valentin

  • Working with class based exception and dynamic method calls

    Hi Gurus,
    we just changed out ERP from EHP6 to EHP7.
    Since we did so we are facing an issue with an Z-Report we are using quite often.
    This reports looks up Workitems and executes the according methods so that we can go into debugging if we were facing any problems or errors.
    since the EHP Upgrade this statement has problems:
      data:        lt_parmbind   type abap_parmbind_tab,         lt_excpbind   type abap_excpbind_tab,         lo_runtime    type ref to object.     call method lo_runtime->(iv_cls_method)       parameter-table       lt_parmbind       exception-table       lt_excpbind.this CALL METHOD Statement has Problem with the Exception Table. We are quite often getting DYN_CALL_METH_EXCP_NOT_FOUND short dumps with Exception "CX_SY_DYN_CALL_EXCP_NOT_FOUND".
    The system has problems handling the content of lt_excpbind. if i clear this table the CALL METHOD statement works fine.
    AS an example we are trying to call /IDXGC/CL_PD_PROCESS_STEPS-->CREATE_DATA. This method has 2 exceptions
    /IDXGC/CX_PROCESS_ERROR
    Process Layer Exception
    CX_BO_TEMPORARY
    Temporary Business Exception
    The Content of LT_EXCPBIND is
    INDEX
    NAME
    VALUE
    2
    /IDXGC/CX_PROCESS_ERROR
    1
    2
    CX_BO_TEMPORARY
    2
    From my point of view the Problem ist, that they are marked as "class based". I think so because if you looked up the SAP Help for the EXCEPTION-TABLE Statement it is written that is statement only works for none-classbased exception.
    I think that restriction is quiet clear. But what i am wondering about is.. that restriction also exists for EHP6. And in EHP6 it work. Does anyone know why? Or how i can change me CALL METHOD Statement that i will work again?
    Best Regards
    Udo

    Class-based exceptions must be caught using try/catch statement.
    Calling dynamically a method catchable exceptions are:
    CX_SY_DYN_CALL_EXCP_NOT_FOUND
    CX_SY_DYN_CALL_ILLEGAL_CLASS 
    CX_SY_DYN_CALL_ILLEGAL_METHOD
    CX_SY_DYN_CALL_PARAM_MISSING 
    CX_SY_DYN_CALL_PARAM_NOT_FOUND 
    CX_SY_REF_IS_INITIAL
    Anyway catching cx_root (as shown by Matthias) will catch everything is catchable.

  • Dynamic method calls in bounded task flows?

    Hi!
    I have the following scenario:
    We are developing a framework in which we would include modules as ADF libraries (as JAR files) with bounded task flows. This framework contains a bean class with bindings for some UI components in framework which I enable or disable (depends on user action). That is the main reason bean class should be present in framework application.
    I have a bounded task flow in every module which needs to call a method in bean with UI component's bindings that would enable or disable that component.
    How can I achieve that? To pass bean as a parameter into bounded task flow and then call its methods? That is dynamic method calls for bean.
    I'm using JDeveloper 11.1.2.1.0
    Thanks for your help
    Regards, Marko

    Hi,
    I explained this; +"I have a bounded task flow in every module which needs to call a method in bean with UI component's bindings that would enable or disable that component. How can I achieve that? To pass bean as a parameter into bounded task flow and then call its methods?"+ a couple of times already (not sure if it was all for you) and don't think I change my position here. I also explained how to use a ValueExpression to lookp a managed bean containing component bindings (should be in requestscope).
    Frank

  • Dynamic Method call with CHANGING

    Hi,
    I have the following method call:
          CALL METHOD o_salv->DISPLAY_SALV
            CHANGING
              it_data = it_ekko.
    I would like to make this dynamic so that I can call it multiple times from my program with the came set of code.
    I have this working for other Method calls, but the use the same parameters on both sides such as:
          CALL METHOD o_main->get_date
            IMPORTING
              it_ekko = it_ekko.
    being coded as such:
          CALL METHOD o_main->(v_method)
            PARAMETER-TABLE
              ptab.
    Can someone please give me some guidance on how to code the top example dynamically when the 2 variables are different?
    Hope that makes sense...thanks for your help!
    Andy

    Hello Bjorn
    I would suggest the following approach:
    (1) Collect all your GUI control instances in an itab whose line type is TYPE REF TO cl_gui_control.
    (2) Define your "free" method:
    LOOP AT mt_gui_controls INTO lo_gui_control.
    * See if gui control was text editor
      TRY.
        lo_textedit ?= lo_gui_control.
      CATCH cx_sy_move_cast_error INTO lo_error.
      ENDTRY.
      IF ( lo_error IS NOT BOUND ).
        lo_textedit->free.
    *   ... your coding
        CONTINUE.
      ENDIF.
    * See if gui control was tree
      TRY.
        lo_tree ?= lo_gui_control.
      CATCH cx_sy_move_cast_error INTO lo_error.
      ENDTRY.
    ENDLOOP.
    The FREE methods are redefined in the subclasses. However, you could try to call lo_gui_control->free directly because I am not sure if the coding of the superclass or subclass is called (I cannot test this at the moment).
    Regards
      Uwe

  • Type conflict during dynamic method call.

    While executing the following program I get the error "Type conflict during dynamic method call.":
    DATA: container_r  TYPE REF TO object,
          grid_r       TYPE REF TO object,
          itab_saplane TYPE TABLE OF saplane.
    * IMPORTANT NOTE: class names must be in UPPER CASE
    DATA: str_cnt TYPE seoclsname VALUE 'CL_GUI_CUSTOM_CONTAINER',
          str_gui TYPE seoclsname VALUE 'CL_GUI_ALV_GRID',
          meth_name TYPE STRING VALUE 'SET_TABLE_FOR_FIRST_DISPLAY'.
    TYPE-POOLS abap.
    DATA: ptab    TYPE abap_parmbind_tab,
          wa_ptab LIKE LINE OF ptab,
          ref     TYPE REF TO data.
    CREATE OBJECT container_r TYPE (str_cnt)
      EXPORTING container_name = 'CUSTOM_CONTROL1'. " Name of the custom control area (UC!)
    * Construct parameter itab
    GET REFERENCE OF container_r INTO ref.
    wa_ptab-name  = 'I_PARENT'.  " Must be upper-case
    wa_ptab-value = ref.
    INSERT wa_ptab INTO TABLE ptab.
    *   EXPORTING i_parent = container_r.
    CREATE OBJECT grid_r TYPE (str_gui)
      PARAMETER-TABLE ptab.
    SELECT * FROM saplane INTO CORRESPONDING FIELDS OF TABLE itab_saplane.
    * Cannot call set_table_for_first_display directly...
    CALL METHOD grid_r->(meth_name)
      EXPORTING I_STRUCTURE_NAME = 'SAPLANE'  " Type of the rows in the internal table  (UC!)
      CHANGING  IT_OUTTAB = itab_saplane.     " The internal table itself
    CALL SCREEN 100.
    Any help would be appreciated!

    Hi ...
    Apologies ... for confusion ... actually both are required ...
    the type 'E' as well as CL_GUI_CONTAINER.
    The below code worked for me ...
    check out how I cast it to the parent class type ...
      DATA : lv_container   TYPE seoclsname VALUE 'CL_GUI_CUSTOM_CONTAINER',
             lv_control     TYPE seoclsname VALUE 'CL_GUI_ALV_GRID',
             lv_method      TYPE string VALUE 'SET_TABLE_FOR_FIRST_DISPLAY',
             lt_par_tab     TYPE abap_parmbind_tab,
             ls_param       LIKE LINE OF lt_par_tab,
             lref_cont      TYPE REF TO cl_gui_container,
             lv_data        TYPE REF TO data.
    CREATE OBJECT lref_container
          TYPE
            (lv_container)
          EXPORTING
            container_name = 'ALV_AREA'.
        ls_param-name = 'I_PARENT'.
        ls_param-kind = 'E'.
        lref_cont ?= lref_container.
        GET REFERENCE OF lref_cont INTO lv_data.
        ls_param-value = lv_data.
        INSERT ls_param INTO TABLE lt_par_tab.
    **  Now create ALV Control.
        CREATE OBJECT lref_alv_ctrl
          TYPE
            (lv_control)
          PARAMETER-TABLE
            lt_par_tab.
    **  Set table for 1st display
        DATA : lv.
        lv = lref_alv_ctrl->mc_fc_print.
        CALL METHOD lref_alv_ctrl->(lv_method)
          EXPORTING
            i_structure_name = 'T001'
          CHANGING
            it_outtab        = lt_company.
    Cheers
    Edited by: Varun Verma on Aug 12, 2008 4:19 PM

  • SSDT vs 2013 and Clr function, call a Clr method name dynamically using SQLCMD variables

    Hello,
    My question is this, hopefully this makes sense:
    How could I got about doing this, inside a SQL function, I would like to re-name the Clr method call based on a SQLCMD variable? 
    I have a Clr project to encrypt/decrypt data, there are different method names depending on the deployment types.
    For the definition of a function called dbo.EncryptThis, I would like to use a SQLCMD variable to change the name depending on SQLCMD variables. This works fine in SQL Server Mgmt studio, but VS 2013 fails to recognize the SQLCMD variable and the build fails
    with: "Error
    1
    SQL71521: A method with a matching signature was not found in the loaded assembly.".
    THis code works fine in SQL Server Mgmt Studio, but fails to build in the SSDT project.
    In the SSDT project I have the SQLCMD variable defined and think I have SQLCMD mode enabled, by doing this:
    Right click file > Execution Settings > SQLCMD mode
    CREATE FUNCTION [dbo].[EncryptData]
    (@str NVARCHAR (MAX))
    RETURNS NVARCHAR (MAX)
    AS
    EXTERNAL NAME [CryptoClrAssembly].[LibName].[EncryptData$(MethodName)]
    Is this even possible in SSDT? or would I have to do this in a post-deploy script?

    Hi Kevin,
    Thanks for the info.
    Bummer, so the only other solution I have is to create a post-deploy script to change the function based on a SQLCMD variable or other logic?
    What would be really cool, would be if during the build process the SQLCMD variables would get replaced with the default value to the SQLCMD variable, thus would allow to build the project. Also, during deployment, if someone entered an incorrect method
    from the assembly it would just fail.

  • How to differentiate which is exporting and importing parameters when calling dynamically using CL_ABAP_OBJECTDESCR

    Hello All,
    First of all sorry for posting the question in general abap queries, since somehow I am not able to post in ABAP objects discussions.
    My requirement is
    Step 1 :  To get table name as input  and dynamically derive all fields which is going to be passed as parameters for a method
    I did this using  cl_abap_typedescr class
    Step 2:  Then Pass the values into the relevant fields using below code
    ptab_line-name = 'DATA_TAB'.
    ptab_line-kind =
    cl_abap_objectdescr=>changing.
    GET REFERENCE OF text_tab INTO
    ptab_line-value.
    INSERT ptab_line INTO TABLE ptab.
    Step 3:  Later I am calling dynamic class like
        CALL METHOD (class)=>(meth)
          PARAMETER-TABLE
            ptab
          EXCEPTION-TABLE
            etab.
    I have read most of the post using Class cl_abap_typedescr=>describe_by_name to get parameter where I have to give correct parameter type.
    But my issue is that I also need to know which fields are acting as importing , exporting and changing parameter.
    Is there anyway to determine and pass method's paramter type as well ?
    Thanks!
    Regards,
    Ramya

    Might be I can use table view VSEOMEPARA

  • Method calling

    Hello,
    I have a problem in calling a method in say ClassA from ClassB. In my scenario, ClassA knows the name of the calling class, namely ClassB as it has been stored only as a string variable.
    So, In ClassA, I have a declaration statement like
    String name=classB;
    And I also know the method in classB to be called, say classB.run( ). But, I cant create an object of classB and call its method directly from classA, as I have the classname (classB) only as a value of string variable in classA. This is because, the classname (classB) is known only during runtime, thatis in my case, the classname is a value of an attribute in a xml file that is collected during parsing and rendering stage.
    So, can anyone please guide to further proceed with my work.
    Thank you,
    Shiv.

    You can use the reflection API for this:
         * Instantiate Java object from a class by calling the constructor that matches the given parameters.
         * @param className
         * @param classes Constructor parameter types (class names).
         * @param values Constructor parameter values.
         * @return Java object.
         * @throws ClassNotFoundException if class can't be found in classpath.
         * @throws NoSuchMethodException if there's no constructor with the given types.
         * @throws InvocationTargetException if the constructor throws an exception.
         * @throws IllegalAccessException if access to the constructor is denied.
         * @throws InstantiationException if the class is abstract and therefore can't be instantiated.
         * @since 1.8.3
        static public Object getInstance(String className, Class[] classes, Object[] values) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException {
            Object result = null;
            if (className != null) {
                Class c = Class.forName(className);
                if (classes != null && values != null) { //constructor with arguments:
                    Constructor cc = c.getConstructor(classes);
                    result = cc.newInstance((Object[]) values);
                } else { //empty constructor:
                    result = c.newInstance();
            }//else: input unavailable
            return result;
        }//getInstance()
         * Call a (non-static) Java method.
         * @param instance Java object created via the instantiate() method.
         * @param methodName Name of instance method.
         * @param classes Optional method parameter types.
         * @param values Optional method parameter values.
         * @return Result of method call.
         * @throws ClassNotFoundException if parameter type can't be found in classpath.
         * @throws NoSuchMethodException if <i>methodName</i> is invalid.
         * @throws InvocationTargetException if the method throws an exception.
         * @throws IllegalAccessException if access to the method is denied.
         * @since 1.8.3
        static public Object call(Object instance, String methodName,  Class[] classes, Object[] values) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
            Object result = null;
            if (instance != null && methodName != null) {
                Method method = instance.getClass().getMethod(methodName, classes);
                result = method.invoke(instance, (Object[]) values);
            }//else: input unavailable
            return result;
        }//call()

  • NET8의 LOCAL NAMING METHODS 이용관련 CHECK POINTS & TROUBLESHOOTING

    제품 : SQL*NET
    작성날짜 : 2000-12-15
    ===================================================================
    Net8의 Local Naming Methods 이용관련 Check Points & Troubleshooting
    ====================================================================
    Net8 관련 내용중 Local Naming Methods(sqlnet.ora와 tnsnames.ora
    를 이용해서 DB에 Connect하는 방법)에 관한 일반적인 Check Points 및
    Troubleshooing 사항을 정리해보도록 하겠다.
    [Client Connection : Local Naming Methods]
    1. Local Naming method resolves service names by using the local configuration files tnsnames.ora and sqlnet.ora.
    2. One of the benefits of the Local Naming method is that it provides a simple method for resolving service name addresses. It is easy to configure local naming by using a GUI called the Net8 Assistant. When you configure a client machine for local naming by using the Net8 Assistant, a tnsnames.ora file is generated. To configure all the other client machines on the network that need to use the same database services, you can simply copy this file to the client machines.
    3. Another benefit of using the local-naming method is that it resolves service name across networks running different protocols.
    [Local Naming : Configuration]
    1. The local-naming method resolves service names by using the information configured and stored on each individual client. Local naming is most appropriate for simple distributed networks with a small number of services that change infrequently.
    2. Local naming requires the configuration of two local files, tnsnames.ora and sqlnet.ora. The tnsnames.ora file contains the address needed to direct a connection request to the specified listener on the specified node by using the specified database. The sqlnet.ora file stores information about the selected naming method.
    3. Local naming is easy to configure by using the Net8 Assistant. The Net8 Assistant is implemented in Java and is packed with the Java Runtime Environment. You can run the Net8 Assistant on any platform on which Net8 is installed.
    4. When you configure an Oracle8 server to use the local-naming method for service names resolution, the client-side configuration files tnsnames.ora and sqlnet.ora are automatically generated. After the configuration is complete, you copy these two files from the server to the client machines.
    [Client Files : Parameters]
    1. The tnsnames.ora and sqlnet.ora files are generated at the default location ORACLE_HOME\net80\admin.
    2. The first parameter in the tnsnames.ora file specifies the service name and the domain name for the client.
    3. The tnsnames.ora file contains a parameter called DESCRIPTION. This parameter contains information about the connect descriptor for the client.
    4. The ADDRESS parameter in the tnsnames.ora file specifies the network address of the host to which the client is connected. If multiple addresses are specified, use the keyword ADDRESS_LIST before the ADDRESS parameter.
    5. Another parameter in the tnsnames.ora file is the CONNECT_DATA parameter. This parameter specifies the SID of the database to which the client is connected.
    6. The DEFAULT_DOMAIN parameter of the sqlnet.ora file specifies the domain from which the client most often requests names. When this parameter is set, the domain name is automatically appended to the service name in a connect string.
    7. The DIRECTORY_PATH parameter is another key parameter of the sqlnet.ora file. This parameter specifies the names resolution method to be used for the client-server connection.
    8. The sqlnet.ora file also contains a parameter called DEFAULT_ZONE.
    This parameter specifies the region to which the client belongs.
    [Troubleshooting the Client Side]
    These are common client-side problems and the error messages associated with
    each error code.
    ORA-12154: "TNS: could not resolve service name"
    ORA-12198: "TNS: could not find path to destination"
    ORA-12203: "TNS: unable to connect to destination"
    ORA-12533: "TNS: illegal ADDRESS parameters"
    1. The ORA-12154 error occurs when Net8 cannot locate the connect descriptor specified in the tnsnames.ora configuration file. To solve this problem, first verify that a tnsnames.ora file exists and is accessible. Next, verify that multiple copies of the tnsnames.ora file are not present. After checking the existence of the tnsnames.ora file, verify that the service name specified in the connect string is mapped to a connect descriptor in the tnsnames.ora file. Verify also that the file does not contain any syntaz errors. The ORA-12154 error also occur if there is more than one copy of the sqlnet.ora file. Verify that duplicate copies of the sqlnet.ora file are not present.
    2. The ORA-12198 and ORA-12203 errors occur when the client is unable to find the required database. To solve this problem, first verify that you have correctly entered the service name that you want to use. Next verify that the service name parameters in the ADDRESS section of the connect descriptor in the tnsnames.ora file are correctly defined. Then, verify that the tnsnames.ora file is stored in the correct directory. The ORA-12198 and ORA-12203 errors can also occur if the listener on the remote node is not running. Verify that the listener on the remote node has started and is running. If the listener is not running, start the listener by using the Listener Control(LSNRCTL) utility.
    3. The ORA-12533 error occurs if the protocol-specific parameters in the ADDRESS section of the designated connect descriptor in the tnsnames.ora file are incorrect. To solve this problem, use the correct protocol-specific parameters in the ADDRESS section of the connect descriptor.
    4. The ORA-12545 error occurs when the listener on the remote node cannot be contacted. This may happen if the values of the ADDRESS parameter in the tnsnames.ora file and the listener.ora file are incorrect. In this case replace the incorrect values with the correct values in both the files. The ORA-12545 error can also occur if the listener on the remote node is not
    started. To verify whether or not the listener is started, determine its status with the STATUS command of the LSNRCTL utility. If necessary, start the listener on the remote node with the START command.

    제품 : SQL*NET
    작성날짜 : 2000-12-15
    ===================================================================
    Net8의 Local Naming Methods 이용관련 Check Points & Troubleshooting
    ====================================================================
    Net8 관련 내용중 Local Naming Methods(sqlnet.ora와 tnsnames.ora
    를 이용해서 DB에 Connect하는 방법)에 관한 일반적인 Check Points 및
    Troubleshooing 사항을 정리해보도록 하겠다.
    [Client Connection : Local Naming Methods]
    1. Local Naming method resolves service names by using the local configuration files tnsnames.ora and sqlnet.ora.
    2. One of the benefits of the Local Naming method is that it provides a simple method for resolving service name addresses. It is easy to configure local naming by using a GUI called the Net8 Assistant. When you configure a client machine for local naming by using the Net8 Assistant, a tnsnames.ora file is generated. To configure all the other client machines on the network that need to use the same database services, you can simply copy this file to the client machines.
    3. Another benefit of using the local-naming method is that it resolves service name across networks running different protocols.
    [Local Naming : Configuration]
    1. The local-naming method resolves service names by using the information configured and stored on each individual client. Local naming is most appropriate for simple distributed networks with a small number of services that change infrequently.
    2. Local naming requires the configuration of two local files, tnsnames.ora and sqlnet.ora. The tnsnames.ora file contains the address needed to direct a connection request to the specified listener on the specified node by using the specified database. The sqlnet.ora file stores information about the selected naming method.
    3. Local naming is easy to configure by using the Net8 Assistant. The Net8 Assistant is implemented in Java and is packed with the Java Runtime Environment. You can run the Net8 Assistant on any platform on which Net8 is installed.
    4. When you configure an Oracle8 server to use the local-naming method for service names resolution, the client-side configuration files tnsnames.ora and sqlnet.ora are automatically generated. After the configuration is complete, you copy these two files from the server to the client machines.
    [Client Files : Parameters]
    1. The tnsnames.ora and sqlnet.ora files are generated at the default location ORACLE_HOME\net80\admin.
    2. The first parameter in the tnsnames.ora file specifies the service name and the domain name for the client.
    3. The tnsnames.ora file contains a parameter called DESCRIPTION. This parameter contains information about the connect descriptor for the client.
    4. The ADDRESS parameter in the tnsnames.ora file specifies the network address of the host to which the client is connected. If multiple addresses are specified, use the keyword ADDRESS_LIST before the ADDRESS parameter.
    5. Another parameter in the tnsnames.ora file is the CONNECT_DATA parameter. This parameter specifies the SID of the database to which the client is connected.
    6. The DEFAULT_DOMAIN parameter of the sqlnet.ora file specifies the domain from which the client most often requests names. When this parameter is set, the domain name is automatically appended to the service name in a connect string.
    7. The DIRECTORY_PATH parameter is another key parameter of the sqlnet.ora file. This parameter specifies the names resolution method to be used for the client-server connection.
    8. The sqlnet.ora file also contains a parameter called DEFAULT_ZONE.
    This parameter specifies the region to which the client belongs.
    [Troubleshooting the Client Side]
    These are common client-side problems and the error messages associated with
    each error code.
    ORA-12154: "TNS: could not resolve service name"
    ORA-12198: "TNS: could not find path to destination"
    ORA-12203: "TNS: unable to connect to destination"
    ORA-12533: "TNS: illegal ADDRESS parameters"
    1. The ORA-12154 error occurs when Net8 cannot locate the connect descriptor specified in the tnsnames.ora configuration file. To solve this problem, first verify that a tnsnames.ora file exists and is accessible. Next, verify that multiple copies of the tnsnames.ora file are not present. After checking the existence of the tnsnames.ora file, verify that the service name specified in the connect string is mapped to a connect descriptor in the tnsnames.ora file. Verify also that the file does not contain any syntaz errors. The ORA-12154 error also occur if there is more than one copy of the sqlnet.ora file. Verify that duplicate copies of the sqlnet.ora file are not present.
    2. The ORA-12198 and ORA-12203 errors occur when the client is unable to find the required database. To solve this problem, first verify that you have correctly entered the service name that you want to use. Next verify that the service name parameters in the ADDRESS section of the connect descriptor in the tnsnames.ora file are correctly defined. Then, verify that the tnsnames.ora file is stored in the correct directory. The ORA-12198 and ORA-12203 errors can also occur if the listener on the remote node is not running. Verify that the listener on the remote node has started and is running. If the listener is not running, start the listener by using the Listener Control(LSNRCTL) utility.
    3. The ORA-12533 error occurs if the protocol-specific parameters in the ADDRESS section of the designated connect descriptor in the tnsnames.ora file are incorrect. To solve this problem, use the correct protocol-specific parameters in the ADDRESS section of the connect descriptor.
    4. The ORA-12545 error occurs when the listener on the remote node cannot be contacted. This may happen if the values of the ADDRESS parameter in the tnsnames.ora file and the listener.ora file are incorrect. In this case replace the incorrect values with the correct values in both the files. The ORA-12545 error can also occur if the listener on the remote node is not
    started. To verify whether or not the listener is started, determine its status with the STATUS command of the LSNRCTL utility. If necessary, start the listener on the remote node with the START command.

  • Question about method calling (Java 1.5.0_05)

    Imagine for example the javax.swing.border.Border hierarchy.
    I'm writing a BorderEditor for some gui builder, so I need a function that takes a Border instance and returns the Java code. Here is my first try:
    1 protected String getJavaInitializationString() {
    2     Border border = (Border)getValue();
    3     if (border == null)
    4         return "null";
    5
    6     return getCode(border);
    7 }
    8
    9 private String getCode(BevelBorder border) {...}
    10 private String getCode(EmptyBorder border) {...}
    11 private String getCode(EtchedBorder border) {...}
    12 private String getCode(LineBorder border) {...}
    13
    14 private String getCode(Border border) {
    15     throw new IllegalArgumentException("Unknown border class " + border.getClass());
    16 }This piece of code fails. Because no matter of what class is border in line 6, this call always ends in String getCode(Border border).
    So I replaced line 6 with:
    6     return getCode(border.getClass().cast(border));But with the same result. So, I try with the asSubClass() method:
    6     return getCode(Border.class.asSubClass(border.getClass()).cast(border));And the same result again! Then i try putting a concrete instance of some border, say BevelBorder:
    6     return getCode(BevelBorder.class.cast(border));Guess what! It worked! But this is like:
    6     return getCode((BevelBorder)border);And I don't want that! I want dynamic cast and correct method calling.
    After all tests, I give up and put the old trusty and nasty if..else if... else chain.
    Too bad! I'm doing some thing wrong?
    Thank in advance
    Quique.-
    PS: Sorry about my english! it's not very good! Escribo mejor en espa�ol!

    Hi, your spanish is quite good!
    getCode(...) returns the Java code for the given border.
    So getCode(BevelBorder border) returns a Java string that is something like this "new BevelBorder()".
    I want Java to resolve the method to call.
    For example: A1, A2 and A3, extends A.
    public void m(A1 a) {...}
    public void m(A2 a) {...}
    public void m(A3 a) {...}
    public void m(A a) {...}
    public void p() {
        A a = (A)getValue();
        // At this point 'a' could be instance of A1, A2 or A3.
        m(a); // I want this method call, to call the right method.
    }This did not work. So, i've used instead of m(a):
        m(a.getClass().cast(a));Didn't work either. Then:
        m(A.class.asSubClass(a.getClass()).cast(a));No luck! But:
        m(A1.class.cast(a)); // idem m((A1)a);Woks for A1!
    I don't know why m(A1.class.cast(a)) works and m(a.getClass().cast(a)) doesn't!
    thanks for replying!
    Quique

  • Passing a method call to a facelet tag

    Hello,
    I am trying to create a JSF confirmation box that replaces the Javascript confirm() function. I am using Seam and Rich Faces 3.2.1. The confirm box is a facelet tag that pops up a modal box with 'cancel' and a 'continue' buttons. Everything is working correctly except for one crucial piece; passing the method call for continue button.
    Here is the set up for the facelets tag in the main xhtml page:
    <at:confirm
        id="confirm"
        title="Confirm"
        message="Do you want to continue"
        buttonText="Continue"
        backingBean="#{confirmAction}"
        method="testMethodTwo"
    />Here is the code for the button inside the facelets tag:
    <a4j:commandLink
        styleClass="rdSplGr1"
        href="#"
        action="#{backingBean[method]}">
        <s:span>#{buttonText}</s:span>
    </a4j:commandLink>The method simply does nothing when the use clicks the button. I am assuming this is due to the lack of "()" however there does not seem to be a way to get those in there. I have tried the following:
    1) placing the parens like this - method="testMethodTwo()"
    2) placing the parens like this - action="#{backingBean[method]()}"
    The first does nothing, the second causes an EL exception.
    I know that it has nothing to do with the modal as I have also placed a button like this into the modal:
    <a4j:commandLink
        styleClass="rdSplGr1"
        href="#"
        action="#{confirmAction.testMethodOne()}">
         <s:span>MethodOne</s:span>
    </a4j:commandLink>That button as you can see has what I am trying to create dynamically and it works like a charm.
    So how do I pass a method call correctly? Or if that is impossible how do I solve the problem of having a the continue button having a different method assigned to it?
    Thanks for any insight into this.
    Edited by: Rhythmicdevil on Aug 4, 2008 7:57 AM

    I agree, reflection should be a last resort. An
    interface would not be useful if you don't know what
    method you want to invoke at compile time. Interfaces
    are useful when you know the method you want to
    invoke, but not the class.That's not true. This is a really lame-ass example but it shows the point.
    public interface RuntimeMethod
       public void method();
    class AClass {
       public static void main(Sting[] args)
          new AClass.handleAtRuntime(
             Factory.getRuntimeMethod(Integer.parse(args[0])));
       public void handleAtRuntime(RuntimeMethod runtime)
          runtime.method();
    class Factory
       public static getRuntimeMethod(int method)
          switch(method)
             case 0: return new RuntimeMethod
                public void method()
                   methodA();
             case 2: return new RuntimeMethod
                public void method()
                   methodB();
             default:
                throw new IllegalArgumentException("bad input");
    }

  • Native - Java Method Call problem - "Wrong Method ID..."

    I am writing a 3d game engine using c++, with all the game logic code in Java, for the purpose of making the thing extendible, easily modifyable, etc...
    I am using J2SE JDK 1.2.2.
    Most things work fine (engine-wise), but i have a few questions about problems i am having getting the JNI to work correctly with calls to Java Methods.
    1. If I use FindClass() to get a jclass reference to a named class, I get one number back. If I then instantiate this class, and then call GetObjectClass() with the instance, I get another number, **which doesnt appear to work for anything**. What is going on here? Can the JVM give different jclass numbers for the same class? Is GetObjectClass() supposed to work?
    2. Is AllocObject() alright for instantiating Java objects? It does seem to allocate memory, and method calls work to the new object. I am aware that it doesn't call a constructor, but I like that, seeing as the initialization is handled through a different [network-synchronized] means.
    3. Using a jclass retrieved using FindClass(), which I store in a global variable, I am able to call methods on an instance that I created in a certain function. I then make sure (?) that the GC can't reclaim the class or object memory by getting a NewGlobalReference to both of them [just to be safe]. However, in a later function, I am unable to call methods using my stored method IDs, ["Wrong Method ID....JVM has been asked to shut down this application in an unusual manner..."]. I am also unable to acquire new methodIDs, as the system returns 0xCCCCCCCC for all method ID queries. Obviously, attempting to use those bogus method IDs results in a JVM crash, in a segment called [2 deep in the untraceable depths of JVM.dll] from the JNI CallVoidMethodV() function. Why is this happening? Is the GC getting in there despite my best efforts? Is it illegal to cache methodIDs, jclass references or jobject references? aaarrggh! :)
    Thanks
    Chris Forbes
    Lead Programmer
    Sprocket Interactive
    [email protected]

    Hi Chris,
    I hit the same sort of problem, when writing a JVMDI ( VM debugger hook ), in C++.
    My question remained unanswered too
    http://forum.java.sun.com/thread.jsp?forum=47&thread=461503&tstart=30&trange=30
    I didn't try a call to NewGlobalRef, as you did... but it sounds like it could be what I was missing.
    I've a couple of ideas, but nothing definite for you.
    1) maybe there's more than one classloader, so that multiple copies of the class are loaded
    2) ensure you're compiling your DLL with "quad-word" ( 8 byte ) alignment.
    Otherwise all your JNI references will be misaligned !
    Since the JNI reference maps to a C++ pointer, it's possible that you can't cache any JNI references.
    That's my vague feeling on the subject.
    As a workaround, you may have to keep requesting any JNI references, eg. jclass & jmethod's, as you need them.
    regards,
    Owen

  • Rmi method call timeout

    i was wondering if there was any way to timeout a rmi method call.
    the situation i had was that a client would envoke an rmi method, and
    the method would deadlock in weblogic. the client making the call will
    hang forever.
    thanks

    Thank you for this enlightening addition. I regret I failed to perceive
    earlier that your comments were to be interpreted as evidence of sincere
    commitment to solving this problem.
    Regarding 7.0, you'll note that I described the timeout attribute solution
    as "improving stability" rather than as a complete cure. It should be borne
    bear in mind that this is an alternative to a completely locked system. When
    stress tested, this change did allow the application to recover and run for
    the rest of the day.
    I'm obliged to you for your concern regarding any liability I might be
    incurring in relation to the BEA licensing agreement. Fortunately I think I
    may be able to put your mind at rest on this matter relatively easily. If I
    may direct your attention to the BEA support site, my experience is that on
    entering the search terms "rmi descriptor timeout", the relevant information
    will be revealed. Also, I suspect that, as a fellow engineer, it has not
    escaped your attention that the RMI descriptor is a valid XML document. As
    such, it has a DTD named "rmi.dtd" which (alas) also fails to conceal this
    attribute.
    While we're pursuing what has now become a gratifyingly productive vein,
    let's offer another possible approach to this issue, namely the use of
    per-VM timeouts for socket calls. These were introduced in the Sun JDK 1.4.1
    and so are available to people running WebLogic 8.1 today. Again these
    suggestions have been tested for basic socket I/O (I haven't tried RMI). To
    my knowledge these are not endorsed by BEA:
    For client connections, timeouts can be set globally by passing the
    following startup parameters to the JVM:
    sun.net.client.defaultConnectTimeout (default: -1)
    sun.net.client.defaultReadTimeout (default: -1)
    sun.net.client.defaultConnectTimeout specifies the timeout (in milliseconds)
    to establish the connection to the host.
    sun.net.client.defaultReadTimeout specifies the timeout (in milliseconds)
    when reading from input stream when a connection is established to a
    resource.
    (reference: Sun's Networking Properties documentation at
    http://java.sun.com/j2se/1.4.1/docs/guide/net/properties.html )
    Supplying non-default values for these properties should allow a server to
    recover from a blocked downstream system if socket I/O is being used.
    Regards
    Alex
    On Fri, 30 Jan 2004 09:02:23 -0800, Andy Piper <[email protected]>
    wrote:
    Alex Thomas <[email protected]> writes:
    Hardly a constructive response to what is clearly a significant problem.
    First, it should be obvious that this issue will be encountered in any
    distributed system using T3 or RMI, not because of any shortcoming in
    WebLogic services but because of blocking behaviour in downstream systems.That's why it is a new feature in 9.0. I'm not arguing that the
    use-case is invalid, simply that your suggestion should not be tried.
    Second, the solution I proposed has been tested (on 7.0SP1) and does improve
    overall stability, as other people here have apparently discovered.Tested by who? Not by us because we know there are significant,
    dangerous, problems with the approach you describe. Support are
    under strict instructions not to offer this as a solution to
    anyone. If anyone in BEA told you, they shouldn't have. If you
    discovered it by decompiling the code then you are in violation of
    your license agreement.
    There is a supported mechanism for timing out connect attempts in 7.0
    and later which you can get through support, but for timing out RMI
    calls you will have to wait until 9.0 (or cook up a business case for
    a backport).
    Hope this clears things up.
    andy

  • Taskflow Method call receiving null parameter.

    Hi all,
    I am using 11.1.1.6. I have created in my application an extra project which is pure Java objects and exposed a master class as a POJO DC. In my application, I have a taskflow where I have dragged and dropped one method from my POJO DC - 2 of the parameters of this methods are coming from an application scope bean. I have debugged the application, and made sure that the object being returned by the getter of my app scope bean is not null. So basically, when the breakpoint is in the return statement of my getter the oject is not null and it has been correctly initialized. Just after that, the next breakpoint is in the class receiving the parameter in my POJO DC class. In there, the object is NULL.
    Does anyone knows wat could be the reason??

    Hi Frank Nimphius-Oracle,
    That is precisely the problem.  The object is being passed as to the taskflow as an input parameter (getting it from my application scope bean). If I access the pageFlowScope inside my taskflow I see it and its there, correctely intialized. However, when I call a method call activity that consumes that object as parameter, all what it gets is null.
    The method that consumes this object is in a separate project, and its exposed in a POJO DC. I don't know if it has to be with the complexity of the object I am passing or what but I don't understand why its not being passed correctly to the DC Method.

Maybe you are looking for