Java callback / Calling object identification

This runs on very similar lines to the topic by rishab, "Knowing the identity of the calling application."
Basically, when an arbitrary method is called on an arbitrary object, I need to be able to get a reference to the calling object, for authorization and callback purposes.
Details...
* All objects that require this will be subclasses of a common class, so this functionality can be implemented in that class.
* These objects should be pluggable - created by anyone, compiled and added on the fly, therefore implementation of this should not be required in subclasses.
* A reference to the calling object is required, without the object being passed, so such authorization cannot be compromised by providing proxy accessors or passing bogus objects.
* Reflection to call a method from a base class and force passing the calling method appears to be infeasible, since exact method-type matching appears to prevent polymorphism in reflection.
SecurityManager.getClassContext() is halfway there, in that is exposes what kind of object called the method, but for complete authorization and callback it is necessary to know which instance called the method.
If anyone has any information that might get me on the right track, I would be most grateful.
Regards,
-Troy

As you mentioned, this is very similar to another topic posted. To obtain an object reference to a caller WITHOUT sending an object reference is "de facto" problematic. Any solution will require a compromise to the design terms you described.
I think there's no pratical way to get around passing an object reference as a parameter. However, you could create an interface implemented by all calling classes that would contain a specific call-back method that would authorize the client before allowing the method to proceed.
This would require some sort of basic shared secret or handshake to be returned by the client's implementation of the interface method. Otherwise, you could implant the correct response into the client's superclass and declare it final. That way, when the shared object invokes the superclass method on the client, it could verify the instance and simply return a boolean.
public class SharedObject {
myMethod(Object O) {
...check if O implements myInterface...
...call ((myInterface)O).checkMyClient()
...if I'm satified, continue to interact with O
...else do nothing
}

Similar Messages

  • Why java is called pure object oriented.

    i know that java is called as pure object oriented language.
    why it is called so even though it has primitive datatypes and also it doesnot support multiple inheritance completely. it only supports in the case of interfaces but not in the case of classes. then why it is called pure object oriented.

    Its because you cannot write an executable java program without creating an object. Well, you can:
    public class a
      public static void main( String a[] )
    }In contrary to C++, there can be no variables or functions in the wild (outside a class).
    You can not create an executable java program without creating a class (but not forcibly its instance, an object.)
    The "pure object oriented" wording in this sense has not really much importance, it is rather a marketing ploy.

  • Why java is called as true object oriented language?

    HI Friends,
    Though few oops concepts is not supported , why java is called as truly object oriented language and C++ as not a purely object oriented language???? Please, if any one know , give me the answer.
    Thanks to all.

    few oops concepts is not supportedwhich concepts?
    as far as i know...to be OO, you must supports
    encapsulation, abstraction, inheritancxe, composition (aggretration, et all) and polymorphism. Java supports all those comcept..now..Java is a hybrid due to what Jverd has pointed out.
    the only pure OO language that i know of is SmallTalk. they have Meta class that can create Class object. and all their primitaives are object.
    C# comes close, but their Class are not object.

  • App crash when using JAVA callbacks from native threads in solaris

    Hi all,
    Sorry for putting the thread here. I did use the native methods forum, I wasnt lucky. I Hope more people would look into this forum, which brings me here.
    I have a solaris application which crashes when I try to callback the JAVA methods and variables from the native code. The description of the problem is below
    Written a native library, the library is multithreaded (i.e) I create a thread using pthread_create() in the native code which performs the operation of calling a JAVA method from the native code. The routine of calling the JAVA method works perfectly elsewhere outside the new thread.
    There are two scenarios I've tested it in
    1. I created a thread (say X) from the main thread (say Y) and made the y to wait until the X is complete using the pthread_join(). The JAVA callbacks works fine when called from Y but the app crashes if done from X.
    2. Did not make the Y to wait until the X is complete, hoping that both will run paralelly and even the the App crashes.
    And to be precise the Y is the thread where the native method is called from JAVA.
    I have tested for any memory leaks or stack corruption by removing the JAVA callbacks and bulding a executable and using purify, the report doesnot hint any such occurances.
    The linker options used for building the shared library is as follows
    ${GPP} ${INC} -G ${LIB} -mt -g -lCstd -lCrun -lpthread ${OBJS} -o <lib-name>
    I wonder if we can create threads in the native code when using JAVA callbacks and even if we can whether it would be appropiate to use the callbacks with in the threads
    Looking forward for any help.
    Regards,
    Vamsi

    Guys... can't any one help me with this problem :(

  • Java Applet call javascript problem

    Hi I have a web page as follow and embedded a applet. The applet call the java script, and instead of showing an alarm, the browser show the javascript code. Is that strange ? Any suggestion for this problem.
    HTML:
    ================================================================
    <HTML>
         <HEAD>
         function ShowEmbd()
              alert("Test Applet call Javascript");
         </SCRIPT>
         </HEAD>
         <BODY>
         <FORM NAME="AppletEmbdStart">
              <OBJECT classid="clsid:48B2DD7B-6B52-4DB0-97C9-ECB940113B47" id="CIVON_DEmbdObj" width="0" height="0"></OBJECT>
              <APPLET code="MyApplet.class" width="0" height="0"></APPLET>
         </FORM>
         </BODY>
    </HTML>MyApplet.java
    =========================================================================
    import netscape.javascript.*;
    public class MyApplet extends javax.swing.JApplet
         private JSObject m_win = null;
         private JSObject m_doc = null;
         public void init()
              getJSWin().call("ShowEmbd", null);
         private getJSDoc()
              if(m_doc == bull)
                   m_doc = (JSObject) getJSWin().getMember("document");
              return m_doc;
         private JSObject getJSWin()
              if (m_win == null)
                   m_win = netscape.javascript.JSObject.getWindow(this);
              return m_win;
    }The page was load and it should call the applet MyApplet. The MyApplet should do the init() method and call the Javascript "ShowEmbd()", BUT, instead of show alert from ShowEmbd(), the browser show the code of ShowEmbd() itself ...... It did not run the javascript and shows the alert ??
    The browser shows a message from status bar "The applet not initial" ???? why ???
    Can anyone help ?!

    On first look:
    I am not sure about the Object Tag, but the Applet Tag requires the MAYSCRIPT attribute before Java can call Javascript.

  • Java is call by value or call by reference

    Hi! friends,
    I want to know,java is call by value and call by reference.
    Please give the the exact explanation with some example code.

    All parameters to methods are passed "by value." In other words, values of parameter variables in a method are copies of the values the invoker specified as arguments. If you pass a double to a method, its parameter is a copy of whatever value was being passed as an argument, and the method can change its parameter's value without affecting values in the code that invoked the method. For example:
    class PassByValue {
        public static void main(String[] args) {
            double one = 1.0;
            System.out.println("before: one = " + one);
            halveIt(one);
            System.out.println("after: one = " + one);
        public static void halveIt(double arg) {
            arg /= 2.0;     // divide arg by two
            System.out.println("halved: arg = " + arg);
    }The following output illustrates that the value of arg inside halveIt is divided by two without affecting the value of the variable one in main:before: one = 1.0
    halved: arg = 0.5
    after: one = 1.0You should note that when the parameter is an object reference, the object reference -- not the object itself -- is what is passed "by value." Thus, you can change which object a parameter refers to inside the method without affecting the reference that was passed. But if you change any fields of the object or invoke methods that change the object's state, the object is changed for every part of the program that holds a reference to it. Here is an example to show the distinction:
    class PassRef {
        public static void main(String[] args) {
            Body sirius = new Body("Sirius", null);
            System.out.println("before: " + sirius);
            commonName(sirius);
            System.out.println("after:  " + sirius);
        public static void commonName(Body bodyRef) {
            bodyRef.name = "Dog Star";
            bodyRef = null;
    }This program produces the following output: before: 0 (Sirius)
    after:  0 (Dog Star)Notice that the contents of the object have been modified with a name change, while the variable sirius still refers to the Body object even though the method commonName changed the value of its bodyRef parameter variable to null. This requires some explanation.
    The following diagram shows the state of the variables just after main invokes commonName:
    main()            |              |
        sirius------->| idNum: 0     |
                      | name --------+------>"Sirius"       
    commonName()----->| orbits: null |
        bodyRef       |______________|At this point, the two variables sirius (in main) and bodyRef (in commonName) both refer to the same underlying object. When commonName changes the field bodyRef.name, the name is changed in the underlying object that the two variables share. When commonName changes the value of bodyRef to null, only the value of the bodyRef variable is changed; the value of sirius remains unchanged because the parameter bodyRef is a pass-by-value copy of sirius. Inside the method commonName, all you are changing is the value in the parameter variable bodyRef, just as all you changed in halveIt was the value in the parameter variable arg. If changing bodyRef affected the value of sirius in main, the "after" line would say "null". However, the variable bodyRef in commonName and the variable sirius in main both refer to the same underlying object, so the change made inside commonName is visible through the reference sirius.
    Some people will say incorrectly that objects are passed "by reference." In programming language design, the term pass by reference properly means that when an argument is passed to a function, the invoked function gets a reference to the original value, not a copy of its value. If the function modifies its parameter, the value in the calling code will be changed because the argument and parameter use the same slot in memory. If the Java programming language actually had pass-by-reference parameters, there would be a way to declare halveIt so that the preceding code would modify the value of one, or so that commonName could change the variable sirius to null. This is not possible. The Java programming language does not pass objects by reference; it passes object references by value. Because two copies of the same reference refer to the same actual object, changes made through one reference variable are visible through the other. There is exactly one parameter passing mode -- pass by value -- and that helps keep things simple.
    -- Arnold, K., Gosling J., Holmes D. (2006). The Java� Programming Language Fourth Edition. Boston: Addison-Wesley.

  • How to get caller object reference from a method

    Hi,
    I am working a already existing Java Swing project, now I got a problem, in a method I need to get the caller object reference otherwise, I can't succeed this operation. So please tell me a way how to get the caller object reference from a method. that method would be static or regular method anything will do for me.
    Edited by: navaneeth.j on Jan 29, 2010 11:20 PM

    navaneeth.j wrote:
    Actually my doubt is, I have a method "addition" method, which is using by many classes so my requirement is in the addition method I want to write a code snippet which will identify and get the the caller object. Actually I tried Reflection.getcallerclass but there I am getting "CLASS" object not the actual object reference, but I want object reference.
    Actually we have a huge project which is writen plain JAVA, so in this project the authors written the Database connection package for single database transaction. so now we are using this project source code for JSF application in this web application the DB package has serve based on the dynamic db connection parameters, so if we want to change this package fully means need to solve the dependency problem in hundreds of classes, so my point is if I can access the caller object in the DB package when ever it gets called by any class from any where of the project. So actually I liked Reflection.getcallerclass, the way of implementation perfectly works for me but it is not giving caller object reference, if something gives the caller object then I can get the DB connection parameters then there is no need to pass the parameters in the hierarchy.You can add a parameter (of type Object) to your addition() method
    and everywhere you call the addition() method also pass this (which from the POW of the addition() method will be a reference to the calling class instance).
    There may be alternative solutions
    but none that require less effort.

  • Java.lang.IllegalArgumentException: object is not an instance of declaring

    Hi,
    I have deployed my web project(Jdev 11g) on JBoss 5GA and successful. My project use JDBC connection to Oracle Database 10g and run OK.
    But I have 1 issue. My issue: While i click pages(all page used databinding get data from DB10g), JBoss log will appearance ERROR message:
    14:49:20,361 ERROR [STDERR] Jun 13, 2011 2:49:20 PM oracle.adf.share.ADFContext getNativeJdbcConnection
    INFO:
    java.lang.IllegalArgumentException: object is not an instance of declaring class
    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 oracle.adf.share.ADFContext.getNativeJdbcConnection(ADFContext.java:1701)
    at oracle.jbo.server.DBTransactionImpl.establishNewConnection(DBTransactionImpl.java:990)
    at oracle.jbo.server.DBTransactionImpl.initTransaction(DBTransactionImpl.java:1165)
    at oracle.jbo.server.DBTransactionImpl.initTxn(DBTransactionImpl.java:6728)
    at oracle.jbo.server.DBTransactionImpl2.connectToDataSource(DBTransactionImpl2.java:300)
    at oracle.jbo.server.DBTransactionImpl2.connectToDataSource(DBTransactionImpl2.java:331)
    at oracle.jbo.common.ampool.DefaultConnectionStrategy.connect(DefaultConnectionStrategy.java:203)
    at oracle.jbo.server.ApplicationPoolMessageHandler.doPoolConnect(ApplicationPoolMessageHandler.java:576)
    at oracle.jbo.server.ApplicationPoolMessageHandler.doPoolMessage(ApplicationPoolMessageHandler.java:419)
    at oracle.jbo.server.ApplicationModuleImpl.doPoolMessage(ApplicationModuleImpl.java:8933)
    at oracle.jbo.common.ampool.ApplicationPoolImpl.sendPoolMessage(ApplicationPoolImpl.java:4496)
    at oracle.jbo.common.ampool.ApplicationPoolImpl.prepareApplicationModule(ApplicationPoolImpl.java:2458)
    at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:2270)
    at oracle.jbo.common.ampool.ApplicationPoolImpl.useApplicationModule(ApplicationPoolImpl.java:3168)
    at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:460)
    at oracle.jbo.http.HttpSessionCookieImpl.useApplicationModule(HttpSessionCookieImpl.java:234)
    at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:431)
    at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:426)
    at oracle.adf.model.bc4j.DCJboDataControl.initializeApplicationModule(DCJboDataControl.java:516)
    at oracle.adf.model.bc4j.DCJboDataControl.getApplicationModule(DCJboDataControl.java:862)
    at oracle.adf.model.binding.DCDataControl.setErrorHandler(DCDataControl.java:483)
    at oracle.jbo.uicli.binding.JUApplication.setErrorHandler(JUApplication.java:261)
    at oracle.adf.model.BindingContext.put(BindingContext.java:1300)
    at oracle.adf.model.binding.DCDataControlReference.getDataControl(DCDataControlReference.java:174)
    at oracle.adf.model.BindingContext.instantiateDataControl(BindingContext.java:1024)
    at oracle.adf.model.dcframe.DataControlFrameImpl.doFindDataControl(DataControlFrameImpl.java:1282)
    at oracle.adf.model.dcframe.DataControlFrameImpl.internalFindDataControl(DataControlFrameImpl.java:1186)
    at oracle.adf.model.dcframe.DataControlFrameImpl.findDataControl(DataControlFrameImpl.java:1146)
    at oracle.adf.model.BindingContext.internalFindDataControl(BindingContext.java:1149)
    at oracle.adf.model.BindingContext.get(BindingContext.java:1102)
    at oracle.adf.model.binding.DCParameter.evaluateValue(DCParameter.java:82)
    at oracle.adf.model.binding.DCParameter.getValue(DCParameter.java:111)
    at oracle.adf.model.binding.DCBindingContainer.getChildByName(DCBindingContainer.java:2708)
    at oracle.adf.model.binding.DCBindingContainer.internalGet(DCBindingContainer.java:2756)
    at oracle.adf.model.binding.DCExecutableBinding.get(DCExecutableBinding.java:115)
    at oracle.adf.model.binding.DCUtil.findSpelObject(DCUtil.java:328)
    at oracle.adf.model.binding.DCBindingContainer.evaluateParameterWithElCheck(DCBindingContainer.java:1460)
    at oracle.adf.model.binding.DCBindingContainer.findDataControl(DCBindingContainer.java:1590)
    at oracle.adf.model.binding.DCIteratorBinding.initDataControl(DCIteratorBinding.java:2470)
    at oracle.adf.model.binding.DCIteratorBinding.getDataControl(DCIteratorBinding.java:2414)
    at oracle.adf.model.binding.DCIteratorBinding.refresh(DCIteratorBinding.java:4313)
    at oracle.adf.model.binding.DCExecutableBinding.refreshIfNeeded(DCExecutableBinding.java:341)
    at oracle.jbo.uicli.binding.JUCtrlValueBinding.isAttributeUpdateable(JUCtrlValueBinding.java:1638)
    at oracle.jbo.uicli.binding.JUCtrlValueBinding.isAttributeUpdateable(JUCtrlValueBinding.java:1745)
    at oracle.jbo.uicli.binding.JUCtrlValueBinding.isUpdateable(JUCtrlValueBinding.java:2600)
    at oracle.adfinternal.view.faces.model.AdfELResolver._isReadOnly(AdfELResolver.java:96)
    at oracle.adfinternal.view.faces.model.AdfELResolver.isReadOnly(AdfELResolver.java:112)
    at javax.el.CompositeELResolver.isReadOnly(CompositeELResolver.java:81)
    at com.sun.faces.el.FacesCompositeELResolver.isReadOnly(FacesCompositeELResolver.java:113)
    at org.apache.el.parser.AstValue.isReadOnly(AstValue.java:128)
    at org.apache.el.ValueExpressionImpl.isReadOnly(ValueExpressionImpl.java:224)
    at org.apache.jasper.el.JspValueExpression.isReadOnly(JspValueExpression.java:71)
    at oracle.adfinternal.view.faces.renderkit.rich.EditableValueRenderer._getUncachedReadOnly(EditableValueRenderer.java:486)
    at oracle.adfinternal.view.faces.renderkit.rich.EditableValueRenderer.cacheReadOnly(EditableValueRenderer.java:416)
    at oracle.adfinternal.view.faces.renderkit.rich.LabeledInputRenderer.beforeEncode(LabeledInputRenderer.java:117)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:334)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:767)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:946)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:399)
    at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2633)
    at oracle.adfinternal.view.faces.renderkit.rich.PanelFormLayoutRenderer._encodeFormItem(PanelFormLayoutRenderer.java:1015)
    at oracle.adfinternal.view.faces.renderkit.rich.PanelFormLayoutRenderer.access$100(PanelFormLayoutRenderer.java:46)
    at oracle.adfinternal.view.faces.renderkit.rich.PanelFormLayoutRenderer$FormColumnEncoder.processComponent(PanelFormLayoutRenderer.java:1491)
    at oracle.adfinternal.view.faces.renderkit.rich.PanelFormLayoutRenderer$FormColumnEncoder.processComponent(PanelFormLayoutRenderer.java:1410)
    at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:170)
    at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:290)
    at org.apache.myfaces.trinidad.component.UIXComponent.encodeFlattenedChildren(UIXComponent.java:255)
    at oracle.adfinternal.view.faces.renderkit.rich.PanelFormLayoutRenderer._encodeChildren(PanelFormLayoutRenderer.java:352)
    at oracle.adfinternal.view.faces.renderkit.rich.PanelFormLayoutRenderer.encodeAll(PanelFormLayoutRenderer.java:187)
    at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1396)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:767)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:946)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:399)
    at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2633)
    at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer._encodeChild(PanelGroupLayoutRenderer.java:405)
    at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer.access$300(PanelGroupLayoutRenderer.java:30)
    at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer$EncoderCallback.processComponent(PanelGroupLayoutRenderer.java:654)
    at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer$EncoderCallback.processComponent(PanelGroupLayoutRenderer.java:573)
    at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:170)
    at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:290)
    at o
    14:49:20,364 ERROR [STDERR] rg.apache.myfaces.trinidad.component.UIXComponent.encodeFlattenedChildren(UIXComponent.java:255)
    at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer.encodeAll(PanelGroupLayoutRenderer.java:330)
    at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1396)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:767)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:946)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:399)
    at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2633)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:415)
    at oracle.adfinternal.view.faces.renderkit.rich.FormRenderer.encodeAll(FormRenderer.java:220)
    at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1396)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:767)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:946)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:399)
    at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2633)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:415)
    at oracle.adfinternal.view.faces.renderkit.rich.DocumentRenderer.encodeAll(DocumentRenderer.java:1181)
    at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1396)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:767)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:946)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:942)
    at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:273)
    at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:204)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:189)
    at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:193)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._renderResponse(LifecycleImpl.java:777)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:293)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:213)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
    at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
    at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:680)
    I don't know why this Error message appearance? Although my project run OK!
    I don't want ERROR message appearance in JBoss log. Please help me?

    You need to pass the Human object on which you intend to call that method on to invoke().
    Trying to call an instance method without an instance won't work even with reflection.

  • ERROR: Inconsistent java and sql object types

    I am getting a nested object table in the form of an oracle.sql.ARRAY. I then call getResultSet() on this array and try to cast each object into a Java implementation of the SQLData interface (also defined in the connections type map).
    This approach works for one nested object table but not for another. I get the error message:
    "Inconsistent java and sql object types"
    Does this mean that my Java to Oracle type mappings are wrong? Any help would be appreciated.
    Regards
    Steve

    i had a similar situation. found out it was occuring because the oracle type had not been granted to the appropriate user.
    todd kegley

  • Using Reflectors To Dynamically Call Objects

    Hi,
    I have a Class that has two methods and each method takes two parameters (1st Method Takes Integers / 2nd Takes Double) and returns and Integer. I want to invoke these methods using Java.Reflectors so I could Do dynamic instantiations and method calling.
    I have generated an experimental test harness class as given below....
    *========================================================*
    public static void main(String[] args) {
            try {
                // Getting a Class available in the Pachage to Class Instance
                Class cls = Class.forName("testreflection.ClassMethods");
                // Instance of Current Class
                Main o_Obj = new Main();
                // Get the declared methods in the Class instand "cls"
                Method[] m_Methods = cls.getDeclaredMethods();
                for(int i=0; i<m_Methods.length; i++){
                    // Obtain the parameter types of each method
                    Type[] typ_MethodParameterTypes = m_Methods.getGenericParameterTypes();
    // Int array for Random Integer inputs as Parameters
    int[] i_Prameter = new int[typ_MethodParameterTypes.length];
    Random r_RandomInt = new Random();
    for(int j=0; j<typ_MethodParameterTypes.length;j++){
    // Just Display the Input Type
    System.out.println(typ_MethodParameterTypes[j].toString());
    i_Prameter[j]=r_RandomInt.nextInt();
    //Display the Input value to the above type
    System.out.println(i_Prameter[j]);
    // Trying to invke the 1st Method in the Mehtod array
    m_Methods[0].invoke(o_Obj, i_Prameter);
    } catch (IllegalArgumentException ex) {
    Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    } catch (InvocationTargetException ex) {
    Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    //} catch (InstantiationException ex) {
    Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
    Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    } catch (ClassNotFoundException ex) {
    Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    *==============================================================*
    THen I am getting the following error.... Can any one help me...
    int
    -1680302169
    int
    -1149051431
    Mar 30, 2011 11:02:53 AM testreflection.Main main
    SEVERE: null
    java.lang.IllegalArgumentException: object is not an instance of declaring class
            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 testreflection.Main.main(Main.java:52)
    Edited by: EJP on 30/03/2011 12:17: added the code tags. Please use them.
    Edited by: JLearner on Mar 29, 2011 6:18 PM
    Edited by: JLearner on Mar 29, 2011 6:20 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    EJP wrote:
    java.lang.IllegalArgumentException: wrong number of argumentsSo you are calling the method with the wrong number of arguments.
    The error messages are quite clear, in both cases.Here is the Method that I am Calling in the Class "ClassMethods"
    public int getAddition(int i_Number1,int i_Number2){
            int i_Total = i_Number1+i_Number2;
            return i_Total;
        }This method Takes two Integer values and returns an Integer.
    I am calling this method using java reflections as below.
    // Get the declared methods in the Class instand "cls"
                Method[] m_Methods = cls.getDeclaredMethods();
                for(int i=0; i<m_Methods.length; i++){
                    // Obtain the parameter types of each method
                    Type[] typ_MethodParameterTypes = m_Methods.getGenericParameterTypes();
    // Int array for Random Integer inputs as Parameters
    int[] i_Prameter = new int[typ_MethodParameterTypes.length];
    Random r_RandomInt = new Random();
    for(int j=0; j<typ_MethodParameterTypes.length;j++){
    // Just Display the Input Type
    System.out.println(typ_MethodParameterTypes[j].toString());
    i_Prameter[j]=r_RandomInt.nextInt();
    //Display the Input value to the above type
    // Currently hold two parameter values
    System.out.println(i_Prameter[j]);
    // Trying to invke the 1st Method in the Mehtod array
    Object obj = cls.newInstance();
    m_Methods[0].setAccessible(true);
    // invoking with instance of Method own class and parameters (two integer parameters in an array )
    m_Methods[0].invoke(obj, i_Prameter);

  • Object Identification Issue with OATS

    please find below the details of the object identification issue, we are seeing with OATS.
    Environment:
    JRE Version     : JRE 7 Update: 65
    OATS Version : 12.4.0.2_129 (Build)
    Application Built on : Oracle EBS/Forms & Applets(11g Forms)
    Operating System: Win 7 32-Bit Professional
    Browser: Internet Explorer 9
    Object Identification Issue:
    1. Launch OATS Open Script
    2. Login to Test application by opening URL using IE9 browser.
    (Login was successful)
    3. Click on the button and check if forms are loading
    (Oracle forms are loading).
    4. Try spying or recording actions on any objects in the forms
    (Issue - Objects are not getting identified by OATS)
    Appreciate any help on this. Thanks in advance.

    Hi,
    I suggest you to select only 1.7.0.65 in Java Runtime Environment Settings and uncheck version 1.7.0.67.
    Try to launch application. If the application opens, then Openscript will identify objects. Else have to wait till next release of Openscript supporting JRE version 1.7.0.67.
    Please let me know if the above suggested method worked.
    Thanks and Regards,
    Vasanth Kumar S M

  • Java project call ep webservice

    hi experts,
    i deployed a java  webservice including a simple function into EP engin,i created a java to call this webservice but can not success,the exception always is "(400)Bad Request"
    my code like
    public String mycal(String a, String b) {
              try {
                   String endpoint =
                        "http://xxx:80/WS_MyEMICalculator1/Config1?wsdl";
                   Service service = new Service();
                   Call call = (Call) service.createCall();
                   call.setTargetEndpointAddress(new java.net.URL(endpoint));
                   call.setOperationName("EMICalculation");
                   call.addParameter("a", XMLType.XSD_STRING, ParameterMode.IN);
                   call.addParameter("b", XMLType.XSD_STRING, ParameterMode.IN);
                   //call.setUseSOAPAction(true);
                   //call.setSOAPActionURI("?");
                   call.setReturnType(XMLType.XSD_STRING);
                   try {
                        String res = (String) call.invoke(new Object[] { a, b });
                   } catch (Exception ex) {
                        System.out.println(ex.toString());
                   } catch (Exception e) {}
              return "";
         public static void main(String[] args) {
              Wsdltest sd = new Wsdltest();
              sd.mycal("a", "b");
    it is possiable to get ep webservice for external java ?this uri should be set and how to get?//call.setSOAPActionURI("?");

    Hi,
    If you want to use the java file in the project then place the java in src folder with mention proper path in java file.
    then you can call in webdynpro methods.
    If you want seperate java application then you can go with interface controller with Development component(DC).
    Best Regards
    Arun Jaiswal

  • Java callback from C

    I'm trying to call Java class method from C code (via JNI), but Java VM dies with
    # An unexpected error has been detected by HotSpot Virtual Machine:
    #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d6c79dd, pid=128, tid=2192
    # Java VM: Java HotSpot(TM) Client VM (1.5.0_11-b03 mixed mode)
    # Problematic frame:
    # V  [jvm.dll+0x879dd]
    # An error report file with more information is saved as hs_err_pid128.log
    # If you would like to submit a bug report, please visit:
    #   http://java.sun.com/webapps/bugreport/crash.jsp
    Hello world!
    Hello world, from Java to C!This is Java code:
    Hello.java
    class Hello
         public native void sayHello();
         public native void sayHello(String hello);
         public native void sayHello(Callback callback);
         static
              try
                   System.loadLibrary("hello");
              catch(Exception e)
                   System.out.println("exception " + e.getMessage());
         public static void main(String[] args)
              Hello h = new Hello();
              h.sayHello ();
              h.sayHello("Hello world, from Java to C!");
              Callback callback = new Callback();
              h.sayHello(callback);
    }Callback.java
    public class Callback
         public void sayHello(int num)
              for(int i=0; i<num; i++)
                   System.out.println("Hello world, from C to Java!");
    }This is C code:
    Hello.c
    #include <mingw/_mingw.h> //because there are some types needed for JNI
    #include <jni.h>
    #include "Hello.h"
    #include <stdio.h>
    JNIEXPORT void JNICALL Java_Hello_sayHello__
      (JNIEnv *env, jobject obj)
         printf("Hello world!\n");
         return;
    JNIEXPORT void JNICALL Java_Hello_sayHello__Ljava_lang_String_2
      (JNIEnv *env, jobject obj, jstring hello)
         const char *str = (*env)->GetStringUTFChars(env, hello, 0);
         printf("%s", str);
         (*env)->ReleaseStringUTFChars(env, hello, str);
         return;
    JNIEXPORT void JNICALL Java_Hello_sayHello__LCallback_2
      (JNIEnv *env, jobject obj, jobject call)
         jclass clazz = (*env)->GetObjectClass(env, call);
         jmethodID id = (*env)->GetMethodID(env, clazz, "sayHello", "(I)V");
         if(id == NULL)
              //(*env)->ExceptionDescribe(env);
              (*env)->ExceptionClear(env);
              printf("Method not found!\n");
    }C if linked with
    gcc -mno-cygwin -Wl,--add-stdcall-alias,--kill-at -shared -Wl,--output-def=Hello.def -o"hello.dll"  ./Hello.oand 'def' file is:
    EXPORTS
    Java_Hello_sayHello__
    Java_Hello_sayHello__Ljava_lang_String_2
    Java_Hello_sayHello__LCallback_2I can't see what am I doing wrong, but I'm sure thats something plain that I'm missing. Code is compiled with latest Cygwin in Eclipse 3.2.2 under WinXP OS. It is runned under jre1.5.0_11.
    Any help is appreciated. Thanks.

    Now I commented two calls for printing on screen in C code, and left just callback call, and same error is still there:
    # An unexpected error has been detected by HotSpot Virtual Machine:
    #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d6c79dd, pid=3656, tid=3660
    # Java VM: Java HotSpot(TM) Client VM (1.5.0_11-b03 mixed mode)
    # Problematic frame:
    # V  [jvm.dll+0x879dd]
    # An error report file with more information is saved as hs_err_pid3656.log
    # If you would like to submit a bug report, please visit:
    #   http://java.sun.com/webapps/bugreport/crash.jsp
    #Can anyone tell me what does this mean (or how to fix my code)?
    Thank you for your reply.

  • Rendering HTML output on Java 2D/3D Objects

    Hi all, I want to read an HTML file and render an HTML output to the objects in Java 2D or Java 3D world.
    For doing this, I am following the steps as
    1> Read HTML file
    2> Capture its output
    3> Write captured output to the buffered image.
    4> Use that buffered image to be shown on Java 2D/3D object as a texture.
    How can I capture the HTML output?
    If you have any other way, please suggest me.
    Regards

    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Image;
    import java.awt.image.BufferedImage;
    import java.io.IOException;
    import java.net.MalformedURLException;
    import java.net.URL;
    import javax.swing.JEditorPane;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    public class captureHTML extends JPanel{
        public BufferedImage bufferedImage ;
        public Image image, capturedImage ;
        public Graphics2D g2d;
        public captureHTML() {
            capturedImage = capture("http://www.google.com");
            bufferedImage = new BufferedImage(1000,700,BufferedImage.TYPE_INT_RGB);
            g2d = bufferedImage.createGraphics();
            g2d.drawImage(capturedImage,0,0,this);
            image = bufferedImage.getScaledInstance
                        ((int)(-1),
                        (int)(-1), 
                        Image.SCALE_SMOOTH) ;
        public Image capture(String str)
            URL url;
            JEditorPane jep = null;
            try {
                url = new URL(str);
                try {
                    jep = new JEditorPane(url);
                    jep.setContentType("text/html");
                    jep.setPage(url);
                } catch (IOException ex) {
                    ex.printStackTrace();
            } catch (MalformedURLException ex) {
                ex.printStackTrace();
            Image jepImage = jep.createImage(500,500);
            return jepImage;
        public void paint(Graphics g)
                System.out.println("paint called");
                if (getSize().width <= 0 || getSize().height <= 0)
                    return;
                Graphics2D g2 = (Graphics2D) g;
                if (image != null && isShowing()) 
                    g2.drawImage(image, 0, 0, this);
        public static void main(String args[])
            JFrame f = new JFrame();
            int w = 1000;
            int h = 700;
            f.setSize(w, h);
            f.getContentPane().setSize(w, h);
            f.getContentPane().add(new captureHTML());
            f.setDefaultCloseOperation(1);
            f.setVisible(true);
    }I Implemented the code as db suggested, I think it will work. But at the moment without any error I am getting only blank black screen. Please have a look at capture( ) method. I think there is a problem in this method but I cant figure out whats going wrong.
    Regards

  • How can i get caller object by MethodEntryEvent

    Hi ,
    I have problem that I want to get the caller object when the program call any method. I use com.sun.jdi.MethodEntryEvent to catch the calling event but I don't know how to get the caller.
    thanks for any answers.

    I use
    com.sun.jdi.MethodEntryEvent to catch the calling
    event but I don't know how to get the caller. You have to go from the MethodEntryEvent to the Thread
    and from the Thread to the active stack frame on that
    thread. Then you can query the stack frame for 'this',
    or for other information.
    Given:
    com.sun.jdi.event.MethodEntryEvent mee;
    then the following will return the ObjectReference
    of 'this' for the current frame:
    mee.thread().frame(0).thisObject();
    References:
    MethodEntryEvent:
    http://java.sun.com/j2se/1.4.2/docs/guide/jpda/jdi/com/sun/jdi/event/MethodEntryEvent.html
    LocatableEvent
    http://java.sun.com/j2se/1.4.2/docs/guide/jpda/jdi/com/sun/jdi/event/LocatableEvent.html
    ThreadReference:
    http://java.sun.com/j2se/1.4.2/docs/guide/jpda/jdi/com/sun/jdi/ThreadReference.html
    StackFrame:
    http://java.sun.com/j2se/1.4.2/docs/guide/jpda/jdi/com/sun/jdi/StackFrame.html

Maybe you are looking for