Calling interface's methods

How is it possible that we can call a method on an Interface declared by the Java API???
Eg. How can I call "Enumeration.hasMoreElements()" when I know that it's an interface and doesnt have a concrete implementation???
fun_one

By this, do you mean to say that every interface
defined in the Java API has some default
implementation done by them???
If YES, where are the implementations generally
done???And why are we not told about the concrete
implementations done by default, in the docs andother
technically-related stuff???
Thx for your response and time.
fun_onehi, I have lost some question marks, you don't happen
to have any spare
ones do youHey silky, I do hava lot of question marks for me, and you tooo ;-). In fact, you can have a couple of 'em for yourself just beside your right SHIFT key on the keyboard. ;-)
Anyway guys, thx for that really good stuff !!!!!!( now dont ask me for xclamation marks...hahaha...)
fun_one

Similar Messages

  • Unable to call exported client methods of EJB session bean remote interface

    I am unable to call client methods of a BC4J application module deployed as a Session EJB to Oracle 8i at the client side of my multi-tier application. There is no documentation, and I am unable to understand how I should do it.
    A business components project has been created. For instance, its application module is called BestdataModule. A few custom methods have been added to BestdataModuleImpl.java file, for instance:
    public void doNothingNoArgs() {
    public void doNothingOneArg(String astr) {
    public void setCertificate(String userName, String userPassword) {
    theCertificate = new Certificate(userName, userPassword);
    public String getPermission() {
    if (theCertificate != null)
    {if (theCertificate.getPermission())
    {return("Yes");
    else return("No, expired");
    else return("No, absent");
    theCertificate being a protected class variable and Certificate being a class, etc.
    The application module has been tested in the local mode, made remotable to be deployed as EJB session bean, methods to appear at the client side have been selected. The application module has been successfully deployed to Oracle 8.1.7 and tested in the remote mode. A custom library containing BestdataModuleEJBClient.jar and BestDataCommonEJB.jar has been created.
    Then I try to create a client basing on Example Oracle8i/EJB Client snippet:
    package bestclients;
    import java.lang.*;
    import java.sql.*;
    import java.util.*;
    import javax.naming.*;
    import oracle.aurora.jndi.sess_iiop.*;
    import oracle.jbo.*;
    import oracle.jbo.client.remote.ejb.*;
    import oracle.jbo.common.remote.*;
    import oracle.jbo.common.remote.ejb.*;
    import oracle.jdeveloper.html.*;
    import bestdata.client.ejb.*;
    import bestdata.common.ejb.*;
    import bestdata.common.*;
    import bestdata.client.ejb.BestdataModuleEJBClient;
    public class BestClients extends Object {
    static Hashtable env = new Hashtable(10);
    public static void main(String[] args) {
    String ejbUrl = "sess_iiop://localhost:2481:ORCL/test/TESTER/ejb/bestdata.BestdataModule";
    String username = "TESTER";
    String password = "TESTER";
    Hashtable environment = new Hashtable();
    environment.put(javax.naming.Context.URL_PKG_PREFIXES, "oracle.aurora.jndi");
    environment.put(Context.SECURITY_PRINCIPAL, username);
    environment.put(Context.SECURITY_CREDENTIALS, password);
    environment.put(Context.SECURITY_AUTHENTICATION, ServiceCtx.NON_SSL_LOGIN);
    BestdataModuleHome homeInterface = null;
    try {
    Context ic = new InitialContext(environment);
    homeInterface = (BestdataModuleHome)ic.lookup(ejbUrl);
    catch (ActivationException e) {
    System.out.println(e.getMessage());
    e.printStackTrace();
    System.exit(1);
    catch (CommunicationException e) {
    System.out.println(e.getMessage());
    e.printStackTrace();
    System.exit(1);
    catch (NamingException e) {
    System.out.println(e.getMessage());
    e.printStackTrace();
    System.exit(1);
    try {
    System.out.println("Creating a new EJB instance");
    RemoteBestdataModule remoteInterface = homeInterface.create();
    // Method calls go here!
    // e.g.
    // System.out.println(remoteInterface.foo());
    catch (Exception e) {
    System.out.println(e.getMessage());
    e.printStackTrace();
    It doesnt cause any errors. However, how must I call methods? The public interface RemoteBestdataModule has no such methods:
    void doNothingNoArgs();
    void doNothingOneArg(java.lang.String astr);
    void setCertificate(java.lang.String userName, java.lang.String userPassword);
    java.lang.String getPermission();
    Instead of that it has the following methods:
    oracle.jbo.common.remote.PiggybackReturn doNothingNoArgs(byte[] _pb) throws oracle.jbo.common.remote.ejb.RemoteJboException, java.rmi.RemoteException;
    oracle.jbo.common.remote.PiggybackReturn doNothingOneArg(byte[] _pb, java.lang.String astr) throws oracle.jbo.common.remote.ejb.RemoteJboException, java.rmi.RemoteException;
    oracle.jbo.common.remote.PiggybackReturn customQueryExec(byte[] _pb, java.lang.String aQuery) throws oracle.jbo.common.remote.ejb.RemoteJboException, java.rmi.RemoteException;
    oracle.jbo.common.remote.PiggybackReturn setCertificate(byte[] _pb, java.lang.String userName, java.lang.String userPassword) throws oracle.jbo.common.remote.ejb.RemoteJboException, java.rmi.RemoteException;
    oracle.jbo.common.remote.PiggybackReturn getPermission(byte[] _pb) throws oracle.jbo.common.remote.ejb.RemoteJboException, java.rmi.RemoteException;
    I cannot call those methods. I can see how they are called in BestdataModuleEJBClient.java file:
    public void doNothingNoArgs() throws oracle.jbo.JboException {
    try {
    oracle.jbo.common.remote.PiggybackReturn _pbRet = mRemoteAM.doNothingNoArgs(getPiggyback());
    processPiggyback(_pbRet.mPiggyback);
    if (_pbRet.isReturnStreamValid()) {
    return;
    catch (oracle.jbo.common.remote.ejb.RemoteJboException ex) {
    processRemoteJboException(ex);
    catch (java.rmi.RemoteException ex) {
    processRemoteJboException(ex);
    throw new oracle.jbo.JboException("Marshall error");
    However, I cannot call getPiggyback() function! It is a protected method, it is available to the class BestdataModuleEJBClient which extends EJBApplicationModuleImpl, but it is unavailable to my class BestClients which extends Object and is intended to extend oracle.jdeveloper.html.WebBeanImpl!
    It seems to me that I mustnt use RemoteBestdataModule interface directly. Instead of that I must use the public class BestdataModuleEJBClient that extends EJBApplicationModuleImpl and implements BestdataModule interface. It contains all methods required without additional arguments (see just above). However, how must I create an object of BestdataModuleEJBClient class? That is a puzzle. Besides my custom methods the class has only two methods:
    protected bestdata.common.ejb.RemoteBestdataModule mRemoteAM;
    /*This is the default constructor (do not remove)*/
    public BestdataModuleEJBClient(RemoteApplicationModule remoteAM) {
    super(remoteAM);
    mRemoteAM = (bestdata.common.ejb.RemoteBestdataModule)remoteAM;
    public bestdata.common.ejb.RemoteBestdataModule getRemoteBestdataModule() {
    return mRemoteAM;
    It looks like the remote application module must already exist! In despair I tried to put down something of the kind at the client side:
    RemoteBestdataModule remoteInterface = homeInterface.create();
    BestdataModuleEJBClient dm = new BestdataModuleEJBClient(remoteInterface);
    dm.doNothingNoArgs();
    Of course, it results in an error.
    System Output: null
    System Error: java.lang.NullPointerException
    System Error: oracle.jbo.common.PiggybackOutput oracle.jbo.client.remote.ApplicationModuleImpl.getPiggyForRemovedObjects(oracle.jbo.common.PiggybackOutput) (ApplicationModuleImpl.java:3017)
    System Error: byte[] oracle.jbo.client.remote.ApplicationModuleImpl.getPiggyfront(boolea
    System Error: n) (ApplicationModuleImpl.java:3059)
    System Error: byte[] oracle.jbo.client.remote.ApplicationModuleImpl.getPiggyback() (ApplicationModuleImpl.java:3195)
    System Error: void bestdata.client.ejb.BestdataModuleEJBClient.doNothingNoArgs() (BestdataModuleEJBClient.java:33)
    System Error: void bes
    System Error: tclients.BestClients.main(java.lang.String[]) (BestClients.java:76)
    I have studied a lot of documents in vain. I have found only various senseless discourses:
    "Use the Application Module Wizard to make the Application Module remotable and export the method. This will generate an interface for HrAppmodule (HrAppmodule.java in the Common package) which contains the signature for the exported method promoteAllEmps(). Then, deploy the Application Module. Once the Application Module has been deployed, you can use the promoteAllEmps() method in your client-side programs. Calls to the promoteAllEmps() method in client-side programs will result in calls to the promote() method in the application tier."
    However, I have failed to find a single line of code explaining how it should be called.
    Can anybody help me?
    Best regards,
    Svyatoslav Konovaltsev,
    [email protected]
    null

    Dear Steven,
    1. Thank you very much. It seems to me that the problem is solved.
    2. "I logged into Metalink but it wants me to put in both a tar number and a country name to see your issue." It was the United Kingdom, neither the US nor Russia if you mean my issue.
    I reproduce the text to be written by everyone who encounters the same problem:
    package bestclients;
    import java.util.Hashtable;
    import javax.naming.*;
    import oracle.jbo.*;
    public class BestdataHelper {
    public static ApplicationModule createEJB()
    throws ApplicationModuleCreateException {
    ApplicationModule applicationModule = null;
    try {
    Hashtable environment = new Hashtable(8);
    environment.put(Context.INITIAL_CONTEXT_FACTORY, JboContext.JBO_CONTEXT_FACTORY);
    environment.put(JboContext.DEPLOY_PLATFORM, JboContext.PLATFORM_EJB);
    environment.put(Context.SECURITY_PRINCIPAL, "TESTER");
    environment.put(Context.SECURITY_CREDENTIALS, "TESTER");
    environment.put(JboContext.HOST_NAME, "localhost");
    environment.put(JboContext.CONNECTION_PORT, new Integer("2481"));
    environment.put(JboContext.ORACLE_SID, "ORCL");
    environment.put(JboContext.APPLICATION_PATH, "/test/TESTER/ejb");
    Context ic = new InitialContext(environment);
    ApplicationModuleHome home = (ApplicationModuleHome)ic.lookup("bestdata.BestdataModule");
    applicationModule = home.create();
    applicationModule.getTransaction().connect("jdbc:oracle:kprb:@");
    applicationModule.setSyncMode(ApplicationModule.SYNC_IMMEDIATE);
    catch (NamingException namingException) {
    throw new ApplicationModuleCreateException(namingException);
    return applicationModule;
    package bestclients;
    import bestdata.common.*;
    import certificate.*;
    public class BestClients extends Object {
    public static void main(String[] args) {
    BestdataModule bestdataModule = (BestdataModule)BestdataHelper.createEJB();
    Certificate aCertificate = new Certificate("TESTER", "TESTER");
    //calling a custom method!!
    bestdataModule.passCertificate(aCertificate);
    Thank you very much,
    Best regards,
    Svyatoslav Konovaltsev.
    [email protected]
    null

  • How to call a AM method with parameters from Managed Bean?

    Hi Everyone,
    I have a situation where I need to call AM method (setDefaultSubInv) from Managed bean, under Value change Listner method. Here is what I am doing, I have added AM method on to the page bindings, then in bean calling this
    Class[] paramTypes = { };
    Object[] params = { } ;
    invokeEL("#{bindings.setDefaultSubInv.execute}", paramTypes, params);
    This works and able to call this method if there are no parameters. Say I have to pass a parameter to AM method setDefaultSubInv(String a), i tried calling this from the bean but throws an error
    String aVal = "test";
    Class[] paramTypes = {String.class };
    Object[] params = {aVal } ;
    invokeEL("#{bindings.setDefaultSubInv.execute}", paramTypes, params);
    I am not sure this is the right way to call the method with parameters. Can anyone tell how to call a AM method with parameters from Manage bean
    Thanks,
    San.

    Simply do the following
    1- Make your Method in Client Interface.
    2- Add it to Page Def.
    3- Customize your Script Like the below one to Achieve your goal.
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding("GetUserRoles");
    operationBinding.getParamsMap().put("username", "oracle");
    operationBinding.getParamsMap().put("role", "F1211");
    operationBinding.getParamsMap().put("Connection", "JDBC");
    Object result = operationBinding.execute();
    if (!operationBinding.getErrors().isEmpty()) {
    return null;
    return null;
    i hope it help you
    thanks

  • Calling A Super Method Externally

    Hi,
    I would like to call an overridden method, a super method, of an object externally. I thought all I needed to do was:
    1. get the java.lang.Class object of the super class where the original method was declared and implemented.
    2. get the appropriate java.lang.reflect.Method object from the Class object.
    3. override the java language protections on the Method object.
    4. Call Method.invoke() with the instance of the subclass which I wanted to call the method on.
    Unfortunately, when I got to step 4, I saw this in the documentation for Method.invoke:
    "If the underlying method is an instance method, it is invoked using dynamic method lookup as documented in The Java Language Specification, Second Edition, section 15.12.4.4; in particular, overriding based on the runtime type of the target object will occur."
    Is there any way to externally access the functionality of a super method implementation on a subclass that overrides it? It seems like there should be...
    In case you are wondering, the reason I am doing this is I am trying to implement a deep clone method. However, I would like any class to be able to call the deep clone method by passing themselves as an argument to a static method -- that way you don't have to worry about subclasses inheritting clone or anything like that. The code would look something like this (however it seems that according to the docs, this would result in an infinite recursion because when the Object.clone() method is invoked, it would actually resolve to the MyDeepCloneableObject.clone() method (which would call the utility function, which would invoke the Object.clone() again etc. etc.)):
    public class MyDeepCloneableObject implements Cloneable {
    public Object clone() {
    return ObjectUtil.deepClone(this);
    public class ObjectUtil {
    private static final Method OBJECT_CLONE_METHOD;
    private static final Class[] EMPTY_CLASS_ARRAY = new Class[0];
    private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
    static {
    //Set the OBJECT_CLONE_METHOD
    try {
    OBJECT_CLONE_METHOD =
    Object.class.getDeclaredMethod("clone", EMPTY_CLASS_ARRAY);
    OBJECT_CLONE_METHOD.setAccessible(true);
    } catch (NoSuchMethodException e) {
    System.out.println(e.toString());
    e.printStackTrace();
    } catch (RuntimeException e) {
    System.out.println(e.toString());
    e.printStackTrace();
    public static Object deepClone(Cloneable object, int levels) {
    Object clone;
    try {
    clone = OBJECT_CLONE_METHOD.invoke(object, EMPTY_OBJECT_ARRAY);
    } catch (IllegalAccessException e) {
    System.out.println(e.toString());
    e.printStackTrace();
    return null;
    } catch (InvocationTargetException e) {
    System.out.println(e.toString());
    e.printStackTrace();
    return null;
    } catch (RuntimeException e) {
    System.out.println(e.toString());
    e.printStackTrace();
    return null;
    // Use more reflection on fields of clone to implement deep clone
    }

    In your example the clone method is not creating a clone, just returning a new instance of an object of the same type. In both cases the default shallow clone method should be implemented as follows:
    public Object clone() {
    //Call Object.clone()
    return super.clone;
    By doing so, any subclasses will also have their fields copied when clone() is called.
    From the javadocs for Object.clone():
    "The method clone for class Object performs a specific cloning operation. First, if the class of this object does not implement the interface Cloneable, then a CloneNotSupportedException is thrown. Note that all arrays are considered to implement the interface Cloneable. Otherwise, this method creates a new instance of the class of this object and initializes all its fields with exactly the contents of the corresponding fields of this object, as if by assignment; the contents of the fields are not themselves cloned. Thus, this method performs a "shallow copy" of this object, not a "deep copy" operation."
    Now as to how the parent is supposed to know about fields in subclasses, the implementation of clone is implemented in a native method in Object, so the JVM can pretty much know anything about the subobject as long as it has a reference to it. Further, if I wanted to make my own implementation, I could using reflection:
    public Object clone() {
    // Get the runtime class of this object, note that the runtime class
    // may be a subclass of the class in which this clone method is defined
    Class objectClass = this.getClass();
    //Get all of the fields in this class and it's super classes
    List fieldsList = new ArrayList();
    while (objectClass != null) {
    Field[] fields = objectClass.getDeclaredFields();
    for (int j =0; j < fields.length; j++) {
    fieldsList.add(fields[j]);
    objectClass = objectClass.getSuperClass();
    //Now I can create a new instance of the runtime class and set
    //all of its fields appropriately
    However, I'm sure the JVM's implementation is far more efficient.
    I have not benchmarked serialization. However, all the steps in my procedure would have to be done for serialization anyway (i.e. get list of all fields, instantiate equivalent field values and set them in the new object), but serialization also needs to convert everything to a byte representation and then parse it out again. Furthermore, serialization will perform a fully deep clone, where as I only want a one level deep clone (or two depending on how you think of it -- i.e. not a shallow copy of references (as Object.clone(0 does), but a copy of direct fields and containers (i.e. Maps and Collections in fields should be cloned, but not objects in the Maps and Collections). So if an object has a field which is a List and the List field contains 1 entry, and the object is cloned, then subsequent modifications to the List field in the cloned object are not reflected in the original object's List field and vice versa (i.e. the 1 entry is removed in the original , but remains in the clone's version of the List field).

  • Best practice for calling application module methods and plsql code

    In my application I am experiencing problems with connection pooling, I seem to be using a lot of connections in my application when only a few users are using the system. As part of our application we need to call database procedures for business logic.
    Our backing beans, call methods on the application module which in turn call a database procedure. For instance in the backing bean we have code like this to call the application module method.
    // Calling Module to generate new examination/test.
    CIGAppModuleImpl appMod = (CIGAppModuleImpl)Configuration.createRootApplicationModule("ky.gov.exam.model.CIGAppModule", "CIGAppModuleLocal");
    String testId = appMod.createTest( userId, examId, centerId).toString();
    AdfFacesContext.getCurrentInstance().getPageFlowScope().put("tid",testId);
    // Close the call
    System.out.println("Calling releaseRootApplicationModule remove");
    Configuration.releaseRootApplicationModule(appMod, true);
    System.out.println("Completed releaseRootApplicationModule remove");
    return returnResult;
    In the application module method we have the following code.
    System.out.println("CIGAppModuleImpl: Call the database and use the value from the iterator");
    CallableStatement cs = null;
    try{
    cs = getDBTransaction().createCallableStatement("begin ? := macilap.user_admin.new_test_init(?,?,?); end;", 0);
    cs.registerOutParameter(1, Types.NUMERIC);
    cs.setString(2, p_userId);
    cs.setString(3, p_examId);
    cs.setString(4, p_centerId);
    cs.executeUpdate();
    returnResult=cs.getInt(1);
    System.out.println("CIGAppModuleImpl.createTest: Return Result is " + returnResult);
    }catch (SQLException se){
    throw new JboException(se);
    finally {
    if (cs != null) {
    try {
    cs.close();
    catch (SQLException s) {
    throw new JboException(s);
    I have read in one of Steve Muench presentations (Oracle Fusion Applications Team' Best Practises) that calling the createRootApplicationModule method is a bad idea, and to call the method via the binding interface.
    I am assuming calling the createRootApplicationModule uses much more resources and database connections that calling the method through the binding interface such as
    BindingContainer bindings = getBindings();
    OperationBinding ob = bindings.getOperationBinding("customMethod");
    Object result = ob.execute()
    Is this the case? Also is using getDBTransaction().createCallableStatement the best way of calling database procedures. Would it be better to expose plsql packages as webservices and then call them from the applicationModule. Is this more efficient?
    Regards
    Orlando

    Thanks Shay, this is now working.
    I successfully got the binding to the application method in the pagedef.
    I used the following code in my backing bean.
    package view.backing;
    import oracle.binding.BindingContainer;
    import oracle.binding.OperationBinding;
    public class Testdatabase {
    private DCBindingContainer bindingContainer;
    public void setBindingContainer (DCBindingContainer bc) {this.bindingContainer = bc;}
    public DCBindingContainer getBindingContainer() {return bindingContainer;}
    public static String validateUser()
    // Calling Module to validate user and return user role details.
    System.out.println("Getting Binding Container from Home Backing Bean");
    BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
    System.out.println("Obtain binding");
    OperationBinding operationBinding = bindings.getOperationBinding("calldatabase");
    System.out.println("Set username parameter");
    operationBinding.getParamsMap().put("p_userId",userId);
    System.out.println("Set password parameter");
    operationBinding.getParamsMap().put("p_testId",examId);
    Object result = operationBinding.execute();
    System.out.println("Obtain result");
    String userRole = result.toString();
    System.out.println("Result is "+userRole);
    }

  • How to call view-controller method out of componentcontroller

    Hello all,
    my component implements a component-interface with method BACK.
    Thus my componentcontroller has the interface Method BACK.
    When triggering BACK from an foreign component, the implementation within the componentcontroller is called. So far so good.
    Now I want to POPUP_AND_CONFIRM when BACK is hit. But this POPUP_TO_CONFIRM requires me to create an action. But I can't create an action within the componentcontroller.
    I could realize the POPUP_AND_CONFIRM within the components view. But how can I call a view-method out of the componentcontroller?
    Or does anybody have a better solution? (Maybe I could implement BACK within the view, but how to connect the componentcontroller-back-method with the views back-method?)
    Thank you very much in advance...
    Regards
    I. Durmaz

    You should never attempt to call view methods from outside the view.  It is possible to register popop event handlers to methods of the component or custom controllers.  From the online help:
    For a few special cases it is useful to register event handlers for component controllers or custom controllers on the button events of a dialog box. For these cases, a special POPUP_TO_CONFIRM attribute of type IF_WD_POPUP_TO_CONFIRM_N has been implemented in the IF_WD_WINDOW interface. This interface provides precisely the methods with which event handlers for component and custom controllers can be registered on events of the dialog box.
    http://help.sap.com/saphelp_nw70ehp2/helpdata/en/47/b9487e01602fe2e10000000a42189d/frameset.htm

  • How to have the JTA transaction in ServiceEndpoint interface java method

    Hi,
    I have query how to have the JTA transaction in SEI(Service endpoint interface) generated by WSDL.
    I have a MDMListener (using MDM API) which looks for a recordchange in MDM repository which needs to be send to PI7.1 via soap request.
    1) I had imported the WSDL from ESR(PI) and generated outside-in proxy.
    2) Created ejb3.0 stateless session bean using NWDS
    3) Created web service client application by generating the WSDL again (by Generate client)
    4)Added a method callPI()with Service and i set the context with endpointaddress property as the soap location of the sender agreement configured in PI7.1.
    The damean thread listener(EventDispatcher) looks for MDM record change and it calls the method callPI() from ejbsession bean by lookup to transfer the record to PI7.1 system via webservices(web method). I hit the below error.
    Exception com.sap.engine.services.ts.exceptions.BaseIllegalStateException: Status of ( SAP J2EE Engine JTA Transaction : 06223ffffffa20048fffffffe ) should be active, but it is STATUS_COMMITTED = 3.
    at com.sap.engine.services.ts.jta.impl.TransactionImpl.registerSynchronizationWithoutStatusChecks(TransactionImpl.java:672)
    at com.sap.engine.services.ts.jta.impl.TransactionImpl.registerSynchronization(TransactionImpl.java:641)
    at com.sap.engine.services.ts.transaction.TxLevelSynchronizations.addSynchronization(TxLevelSynchronizations.java:118)
    at com.sap.engine.services.ts.transaction.TxManagerImpl.registerSynchronization(TxManagerImpl.java:829)
    at com.sap.transaction.TxManager.registerSynchronization(TxManager.java:303)
    at com.sap.engine.messaging.runtime.j2ee.sapengine.SAPTransactionManager.registerSynchronization(SAPTransactionManager.java:126)
    at com.sap.engine.messaging.impl.util.tx.TxController.<init>(TxController.java:83)
    //Method in the ejb stateless session bean
    @WebServiceRef (name="DistributeMasterDataService") DistributeMasterDataService service;
    @RelMessagingNW05DTOperation(enableWSRM=true)
    public void callPi(DistributeMasterDataRequestType req) {
    port.distributeMasterDataOutA(req);// the distributeMasterDataOutA is the method available in SEI..Here is the issue on JTA
    For the first time the message(req object)transmits to the PI successfully,but for the second call i hit this JTA Transaction :status should be active, but it is STATUS_COMMITTED = 3.
    I tried chanding the transactionmanagement from container to bean.
    @TransactionManagement(value=TransactionManagementType.BEAN)
    @TransactionAttribute(value=TransactionAttributeType.REQUIRES_NEW)
    I wanted to know how can i have the JTA transaction status in SEI(service enpoint interface)java method distributeMasterDataOutA.Since it is an interface i dont know what annotation can be used.
    If its possible i can try this UserTransaction,
    http://help.sap.com/saphelp_nw04/helpdata/de/f6/7a8df922db4ab79342b46c48dac7d0/content.htm
    ut.begin() & ut.commit(),so that everytime this method is called it will treat as a new transaction..
    Let me know if you need more details??,Any idea provided would be great.
    Thanks
    Sabarinathan

    Hello everybody,
    The issue resolved,we need to have the bean management transaction type and not the container.
    and the transactionattribute value as Requires New
    rgds
    Sabarinathan
    Edited by: Sabarinathan Selvaraj on May 12, 2009 2:17 PM

  • Calling a service method from a DataAction

    Hello!
    I'm trying to call a service method from a DataAction, cobbling ideas from the Oracle JDeveloper 10g Handbook and the Oracle ADF Data Binding Primer.
    I have created a service method and exposed it using the client interface node of the application module editor. It is called "process()" and it now appears in the data control palette under MyAppDataControl->Operations (just above the built-in action bindings Commit and Rollback). As part of this procedure, I modified MyAppImpl.java and put the process() method there.
    I don't want to call process() by dragging and dropping it onto a Data Action because depending on the outcome, I want to branch to different pages. process() returns an int that will tell me where to branch. Thus, I am trying to call it from an overridden invokeCustomMethod() method of the lifecycle of a DataAction, where I can get the int, create a new ActionForward, and set it in the DataActionContext. (If I'm barking up the wrong tree, let me know!)
    So, I need to call MyAppImpl.process() from within the invokeCustomMethod() method of my DataAction. Looking at the class declaration, I noticed that it extends ApplicationModuleImpl. I figure that, if I can get the ApplicationModule, I can cast it to MyAppImpl and call the process() method. Unfortunately, that doesn't work. When I got the application module, I checked the class and it's oracle.jbo.common.ws.WSApplicationModuleImpl. I tried casting it and got a class cast exception.
    Here's the code I'm using:
    protected void invokeCustomMethod(DataActionContext actionContext) {
    BindingContext ctx = actionContext.getBindingContext();
    DCDataControl dc = ctx.findDataControl("MyAppDataControl");
    log.debug("invokeCustomMethod(): dc.getClass().getName()=" + dc.getClass().getName()); // result is: oracle.jbo.uicli.binding.JUApplication
    ApplicationModule am = null;
    MyAppImpl myAppImpl = null;
    int processResult = 0;
    if (dc instanceof DCJboDataControl) { // this is true
    am = dc.getApplicationModule();
    log.debug("invokeCustomMethod(): am.getClass().getName()=" + am.getClass().getName()); // result is: oracle.jbo.common.ws.WSApplicaitonModuleImpl
    if (am instanceof ApplicationModuleImpl) { // this is false
    log.debug("invokeCustomMethod(): am is an instanceof ApplicationModuleImpl.");
    if (am instanceof MyAppImpl) { // this is false
    log.debug("invokeCustomMethod(): am is an instanceof MyAppImpl.");
    processResult = ((MyAppImpl)am).process();
    log.debug("invokeCustomMethod(): processResult=" + processResult);
    super.invokeCustomMethod(actionContext);
    What am I doing wrong? Can anyone explain the different class hierarchies and why my application module isn't the class I'm expecting?
    Thanks,
    -Anthony Carlos

    Georg,
    it was in the javadoc of oracle.adf.model.binding.DCBindingContainer
    http://www.oracle.com/webapps/online-help/jdeveloper/10.1.2/state/content/vtTopicFile.bc4jjavadoc36%7Crt%7Coracle%7Cadf%7Cmodel%7Cbinding%7CDCBindingContainer%7Ehtml/navId.4/navSetId._/
    However, I see it's not the case in other sub-classes of JboAbstractMap like DCControlBinding and DCDataControl.
    Weird... I'm keeping you informed if I find more information.
    Regards,
    Didier.

  • Call enhancement class method from Bus. workflow task

    Hi all,
    I recently enhanced a global class from SAP (add a new method). Now I would like to call it from a workflow task (ABAP Class object used in the task). So it seems that only "native" methods from the class itself can be selected for the object method of the task.
    Same issue if I try to call it via secondary methods options...
    Last idea I have before the repair is: retrieve the instance saved into the WF container via a custom class interfacing IF_IFS_SWF_CONTAINER_EXIT (program exit) and call the enhanced method from the method proposed in this interface.
    Maybe someone had the same issue? Anyone could help or propose solution?
    Many thanks in advance for your help,
    KR,
    Olivier

    I think it might qualify for an OSS message.
    There was simmilar note for BADIs which was corrected: https://service.sap.com/sap/support/notes/1156392
    CL_SWF_UTL_DEF_SERVICES which is used in PFTC to determine callable methods doesn't include enhancements when calling  function SEO_CLASS_TYPEINFO_GET (parameter WITH_ENHANCEMENTS is default FALSE)

  • Adf mobile : calling rest post method

    Hi all,
    I am calling a rest post using rest adaptor but i am getting the following error:
    Unable to find operation : unknown
    Please tell me where should i specify the operation name while calling rest post method.
    Regards,
    Deepak

    I would suggest you use the HTTP Analyzer to see what is sent to your service specifically and identify the missing part.
    One common pattern that we see with complex web services, is to create a server side proxy that calls the complex service and exposes a simpler interface that is consumed by the mobile application.
    This will also reduce the network traffic to your mobile application (and will likely reduce the application's size)

  • Deprecated interfaces and methods

    We have a weblogic time service that utilize a lot of
    deprecated interfaces and methods such as
    ScheduledTriggerDef, TimeServicesDef etc. Although the time
    service runs in the WLS 7, it is a big concern to me
    that it uses so many deprecated interfaces or methods.
    I am just wondering how I can replace them with non-deprecated ones

    Mark,
    I have a question about the API.
    From the documentation and the API docs it is not clear how to schedule
    a callback to be called just once ASAP.
    We use the deprecated Timer service to execute long running operations
    on the Weblogic thread pool and want the operation to execute only once
    and start as soon as there is a thread available.
    It is not clear what will happen in case a task is scheduled to be
    executed only once and the time for that execution has passed ( 5 ms ago).
    I'd appreciate the clarification.
    Thanks,
    Dejan
    Mark Griffith wrote:
    It will run because it is only deprecated. You should at some point
    "rewrite", but the rewrite is not that big of a deal. There maybe some
    slight differences in timers, since we moved to jmx interfacs, but the
    scemantics should be very very close.
    Attached is an example that will run in the 8.1 sample environment.
    cd to $WLS_HOME
    (On my box it is /bea/wls81/weblogic81/)
    cd samples/domains/examples/
    setExamplesEnv.sh
    cd ../../server/examples/src/examples
    ../examples/src/examples 201$ pwd
    C:/bea/wls81/weblogic81/samples/server/examples/src/examples
    cp jmxTimerEar.zip .
    jar xvf jmxTimerEar.zip
    cd jmxTimerEar
    ant
    And it should build for you.
    Cheers
    mbg
    "Eric Sundberg" <[email protected]> wrote in message
    news:[email protected]..
    We have a weblogic time service that utilize a lot of
    deprecated interfaces and methods such as
    ScheduledTriggerDef, TimeServicesDef etc. Although the time
    service runs in the WLS 7, it is a big concern to me
    that it uses so many deprecated interfaces or methods.
    I am just wondering how I can replace them with non-deprecated ones

  • How to call BOR object- method in custom program

    hi all,
    I have the following details:
    BOR object : INSTLN
    Method: createdirect
    I need to call the above method in my custom program.
    I need to call it entirely. Means if it contains fn modules I dont want to call those fn modules seperately.

    Hi Sammy,
    Phil Soady from SAP Australia provided me with this little gem a few years back. The actual documentation for this can be found somewhere in the workflow programming area, but I just looked and couldn't find it for you. Anyway, this is a sample program I built to show how to do this. In this example I call the Display method of the Sales Document BO.
    INCLUDE <cntn02>.
    INCLUDE <cntn03>.
    FUNCTION zcallbomethod.
    *"*"Local interface:
    * Data declaration
      DATA: vbak_ref TYPE swc_object.
    * Declare and initialise container
      swc_container container.
      swc_create_container container.
    * Create object reference to sales document
      swc_create_object vbak_ref 'VBAK' '0000000009'. "Sales Document Number
    * Call Display
      swc_call_method vbak_ref 'Display' container.
    * Error handling
      IF sy-subrc NE 0.
      ENDIF.
    ENDFUNCTION.
    Cheers
    Graham Robbo

  • DataServices calling a SOAP method - problem occurs

    Hello,
    I am calling a SOAP method when an ETL problem occurs, to warn a supervision application.
    This is done by a function on which the WSDL url is given. Then it is the WSDL that gives the method parameters and also the url of the method.
    My problem is that I get this error:
    <!-- BusinessObjects Data Services generated XML -->
    <!-- 2010-09-28.10:45:57(422,412)[1] -->
    <test>
    <AL_ERROR_NUM>3</AL_ERROR_NUM>
    <AL_ERROR_MSG>
    <soap:Fault><faultcode>soap:Server</faultcode><faultstring>Could not find route for exchange: InOut[
      id: ID:10.0.10.30-12b43d06903-4:6030
      status: Active
      role: provider
      interface: {http://eventsender.esb.company.com}IEventSender
      servic
    </AL_ERROR_MSG>
    </test>
    And I don't know were the error occurs.
    The WSDL has also a 'localhost' reference, and not the IP address of the SOAP server. It seems the WSDL can't be parameterized with an IP address. Can this be a problem?:
    <wsdl:service name="EventSender">
        <wsdl:port binding="company:EventSenderSOAP" name="EventSenderSOAP">
          <soap:address location="http://localhost:8181/Esb/services/SoapEventSender"></soap:address>
        </wsdl:port>
      </wsdl:service>
    I don't know if focusing on the address or url problem is right. Any hint will be appreciated.
    Regards,
    Frédéric
    Edited by: Frederic PROVOT on Sep 28, 2010 11:14 AM

    Problem was outside of BO

  • Ejbload() on CMP with transaction = supports - why called before every method?

    If an entity bean (CMP v2) has its transaction attrib "supports", why
    when a client (ejb/servlet/jsp) calls its business methods does WLS
    call ejbLoad() before every method call? Note that the calls do not
    occur inside a transaction!
    This is not intuitive to me. I would think that ejbLoad() would be
    called once when the bean is activated and then all business methods would
    access that data.
    Note that if you put the entity bean behind a session bean with a
    transaction attrib "Required", then the ejbLoad() gets called once no
    matter how many business methods are called from the session bean.
    This is (obivously) correct.
    Why is this relevant? The latest java petstore demo essentially calls
    EJBLocal's from jsp (via taglib's) - I guess no different from WLS
    EJB to taglib product - where the fine grained getter methods are
    called. From what I gather, this means that every one of the jsp
    get methods results in a database read! This can't be right!
    What am I missing? As above, if the entity bean has "supports"
    and is called from a jsp, it appears that ejbLoad()/ejbStore()
    would be called for every jsp taglib invocation.
    Glenn

    "Glenn R. Kronschnabl" wrote:
    Rob,
    Thanks for your reply. This implies that even EJBLocals with fine
    grained getter methods should never be used outside a tx scope.Yes, unless you are using Read-Only entity beans which cache data for longer
    periods of time.
    Even
    though you bypass the RMI semantics, you'll be killed by the local tx.
    Which to me says that using EJB's from JSP (even via tags) is a bad
    idea because each getter method will result in a database read/write,
    (unless you go with a readonly EJB as you stated).
    Accessing transactional entity beans via tags is probably a bit off. You
    could start the tx in the JSP or the tag library, but I don't really like
    that pattern much. I prefer making the tags more coarse-grained and having
    the tags talk to a stateless session bean which in turn talks to the entity
    beans.
    >
    Unfortunately, I've been seeing some threads on the net advocating
    using EJBLocals with tx=supports because one of the most common
    patterns has session beans (where you can specify your desired tx)
    in front of entity beans (so you're set methods are protected via
    the session bean tx),RIght, I think Required or Mandatory is a better choice for the entity beans
    here.
    but then you can use the EJBLocal (via tags)
    on a JSP page (no tx) to view the data via fine grained getter
    methods.Other than the performance issues, I dislike this because it exposes the
    entity bean directly to the JSP. If I have to go through an interface (the
    session bean) to access the entity bean, then I shouldn't have another route
    to access the entity bean directly.
    -- Rob
    >
    As you state, this is a disaster because each getter method
    will run in a local tx, requiring a database read/write. Oouch!
    Glenn
    On Thu, 06 Dec 2001 17:08:07 -0600, Rob Woollen wrote:
    First off, I wouldn't recommend that you ever run any EJB with the
    'supports' transaction attribute. If you want transactional behavior
    use Required, RequiresNew, or Mandatory. If you want to run in an
    unspecified tx, use NotSupported or Never.
    WLS runs entity beans with an unspecified tx in their own local tx.
    That's why you see the reads and writes on the method call boundary.
    Your scheme of only reading when the bean is activated could make the
    bean's data out of sync with the underlying database. That's acceptable
    in many cases, and that's why we have the Read-Only entity bean option.
    It gives you exactly what you'd like.
    -- Rob
    "Glenn R. Kronschnabl" wrote:
    If an entity bean (CMP v2) has its transaction attrib "supports", why
    when a client (ejb/servlet/jsp) calls its business methods does WLS
    call ejbLoad() before every method call? Note that the calls do
    not occur inside a transaction!
    This is not intuitive to me. I would think that ejbLoad() would be
    called once when the bean is activated and then all business methods
    would access that data.
    Note that if you put the entity bean behind a session bean with a
    transaction attrib "Required", then the ejbLoad() gets called once no
    matter how many business methods are called from the session bean. This
    is (obivously) correct.
    Why is this relevant? The latest java petstore demo essentially calls
    EJBLocal's from jsp (via taglib's) - I guess no different from WLS EJB
    to taglib product - where the fine grained getter methods are called.
    From what I gather, this means that every one of the jsp get methods
    results in a database read! This can't be right! What am I missing? As
    above, if the entity bean has "supports" and is called from a jsp, it
    appears that ejbLoad()/ejbStore() would be called for every jsp taglib
    invocation.
    Glenn
    AVAILABLE NOW!: Building J2EE Applications & BEA WebLogic Server
    by Michael Girdley, Rob Woollen, and Sandra Emerson
    http://learnWebLogic.com
    [att1.html]

  • Initializer block not called when static method called

    public class Initializer {
         Initializer(){
              System.out.println("Constructor called");
                   System.out.println("CLASS INITIALIZED");
         static void method(){
              System.out.println("Static method called");
         public static void main(String[] args) {
              Initializer.method();
    From the JLS
    A class or interface type T will be initialized immediately before the first occurrence of any one of the following:
    T is a class and an instance of T is created.
    T is a class and a static method declared by T is invoked.
    [b]
    But when i call the static method , if the class is initialized shouldnt the initializer block be called, it is not called, why.

    Perhaps running something like this will add a little more colour?:
    public class Initializer {
        static {
            System.out.println("First static initializer");
            System.out.println("First instance initializer");
        Initializer() {
            System.out.println("Constructor");
        static {
            System.out.println("Second static initializer");
            System.out.println("Second instance initializer");
        static void staticMethod() {
            System.out.println("staticMethod");
        void instanceMethod() {
            System.out.println("instanceMethod");
        public static void main(String[] args) {
            System.out.println("main");
            staticMethod();
            new Initializer().instanceMethod();
    }

Maybe you are looking for