Casting vs reflection as flowcontrol

I remember having read somewhere, that casting shouldnt be used to control the flow of statements. I just did some testing, calling a method with code like this:
try {
SomeObject b = (SomeObject)object;
doSomething(b);
} catch (ClassCastException f) {}
vs.
if(SomeObjectClass.isInstance(object)) doSomething(b);
and it turned out the casting was faster even in cases where an exception was thrown. Could someone explain this. Is my use of reflection wrong?
Stig.

Did you try running the test with perhaps 1,000,000
iterations?Testing the successful cast with 100,000,000 iterations yielded the following results:
Successful cast... 5407ms
Successful test... 6540ms
Successful cast... 6920ms
Successful test... 7901ms
Successful cast... 6920ms
Successful test... 7901ms
Successful cast... 6940ms
Successful test... 7902ms
Successful cast... 6920ms
Successful test... 7851ms
For some reason JIT performance degraded, even though the test calls the same method (which performs the test/cast) in each case.
Testing before casting consistently runs 13% slower than only casting. Having said that, the following figures also imply that each instanceof test took approximately 9.6x10^(-6) milliseconds. That's 10 nanoseconds each test, or 100,000 tests each millisecond. I doubt this would form the bottleneck for any system that actually does anything.
Just for completeness, the times for the unsuccessful cast with only 100,000 iterations yielded:
Unsuccessful cast... 4657ms
Unsuccessful test... 10ms
Unsuccessful cast... 4597ms
Unsuccessful test... 0ms
Unsuccessful cast... 4516ms
Unsuccessful test... 0ms
Unsuccessful cast... 4527ms
Unsuccessful test... 10ms
Unsuccessful cast... 4466ms
Unsuccessful test... 10ms
I don't know what the proportion is here, since the time required for the unsuccessful test is obviously not accurate enough, but I didn't think an exact proportion was called for :-)
If there is a reasonable chance that the cast will be unsuccessful, it is no longer an exceptional case... which suggests that using exceptions is no longer appropriate, in terms of design if not in terms of performance.

Similar Messages

  • Problem during dynamic casting (using reflection)

    Hi Guys,
    Need you help
    Situation is like this �.I have a function which accept the Sting parameter
    Which is actually a full name of class �.using reflection I created the class and object
    Now I want to cast this newly created object to their original class type
    Code is somehow like this
    Public void checkThis (String name) throws Exception{
    Class c = Class.forName(name.trim());
    Object o = c.newInstance();     
    System.out.println(" class name = " + c.getName());
    throw ()o; //// here I want to cast this object to their orginal class type
    I tried throw (c.getName())o;
    But it is not working
    }

    You can't cast to an unknown type like that. You're trying to throw the object, which makes me believe you're loading and instantiating some Exception or other, right? Just cast the result to something generic, like Exception, or RuntimeException, or maybe Throwable. As long as the class you load actually is a subclass of whichever you choose, you'll be fine. And if it isn't, you've got problems anyway because you can't throw anything that isn't Throwable

  • Cast Reflection Object

    Hi,
    I'm in the following situation.
    I've a XML file where Java-Class names are defined.
    I parse the file and create new instances of the classes,
    but I need to cast the Reflection Object to the read-in class,
    how can I do this.
            String className = "misc.Test";
            try {
                Class<?> c = Class.forName(className);
                Object o = c.newInstance();
                ((className)o).sayHello();  // <-- That's what I need.
            } catch (Exception e) {
                e.printStackTrace();
    ...Hope s.o. can help
    thx.

    Thank's for you answer.
    Using an Interface or an abstract class, that's the way I would do it myself, but unfortunately, I don't have access to the classes source code, so I can't make them implement an Interface.
    Let's make an example, assume the following mapping in the xml file:
    Abstract Type(non Java)          Java Classes
    Button                      -->           TextButton
    Button1                     -->           ImageButton
    -------------------------------------------------------------------Because of the mapping I know what class to use at runtime, but these
    classes all provide different methods.
    So is there realy no chance to cast the object ?
    regards ...

  • Image reflection only showing when set to wireframe

    Hi
    I have a png. image in my project that I have made 3D using the replicator. I've set up a floor for reflections and turned them on but the image does not cast a reflection. However, when I set the image to wireframe I get a reflection. What's going on? Is there another step that I missing?
    Many Thanks
    Adrian

    Using the Replicator to add "thickness" to text really taxes the CPU, as you're making a ton of new elements it has to render and track. What are your system spece? Mac CPU, RAM, graphics card, hard drive configuration?
    I'll assume that in the Render menu, you do have Reflections checked, and the floor is set to recieve reflections, and the appropriate layers are set to cast reflections.

  • Class.forName() & Singleton

    I have a servlet which has a list item containing a list of all the object Singleton of my application.
    After select one of these, I would like to release this object.
    So, the value of the differents items is the name of the Singleton class.
    I use Class.forName() but this method try to execute the constructor and in a Singleton the constructor is private.
    So I would like to find a method to call the method getInstance() of my Singleton class and after instanciation of this class, I would like to call the method release().
    Have you got a solution for me...
    Thx

    Hi,
    Just a quick thought...
    You could use a Map to "map" the name from your list to the instance of the
    singleton and call your method that way (you would have to cast though, lots of "ifs"), or map it to the Method of the singleton class so you could use reflection to invoke it.
    There (to my knowledge) isn't a way to create an interface with static methods so casting or
    reflection seem the only way to call your release() method "dynamically"
    hope this helps

  • Casting objects with reflection possible?

    I have this code:
    String className = "com.xyz.MeasurementUnit";
    Class provider = Class.forName(className + "Provider");
    Object object = context.getContractProxy(provider);The last line returns an object of type object. I must execute the method getIsoId(...) on that object. But to do that, I think I have to cast it first to the object type MeasurementUnitProvider.
    Is this possible with reflection? Is it somehow possible to solve what I want to do?

    If MeasurementUnitProvider is an interface that is known at compile time, then the cast can be made in the usual way MeasurementUnitProvider unitProvider = (MeasurementUnitProvider)context.getContractProxy(provider);If the interface is not known at compile time, then the object reflecting the method can be obtained from the Class object by name and parameter type. For reflective method invocation, no cast is required.
    Pete

  • How to cast an object to a class known only at runtime

    I have a HashMap with key as a class name and value as the instance of that class. When I do a 'get' on it with the class name as the key, what I get back is a generic java.lang.Object. I want to cast this generic object to the class to which it belongs. But I don't know the class at compile time. It would be available only at runtime. And I need to invoke methods on the instance of this specifc class.
    I'm not aware of the ways to do it. Could anybody suggest/guide me how to do it? I would really appreciate.
    Thanks a lot in advance.

    Thanks all for the prompt replies. I am using
    reflection and so a generic object is fine, I guess.
    But a general question (curiosity) specific to your
    comment - extraordinarily generic...
    I understand there's definitely some overhead of
    reflection. So is it advisable to go for interface
    instead of reflection?
    Thanks.Arguments for interfaces rather than reflection...
    Major benefit at run-time:
    Invoking a method using reflection takes more than 20 times as long without using a JIT compiler (using the -Xint option of Java 1.3.0 on WinNT)... Unable to tell with the JIT compiler, since the method used for testing was simple enough to inline - which resulted in an unrealistic 100x speed difference.
    The above tests do not include the overhead of exception handling, nor for locating the method to be executed - ie, in both the simple method invocation and reflective method invocations, the exact method was known at compile time and so there is no "locative" logic in these timings.
    Major benefit at compile-time:
    Compile-time type safety! If you are looking for a method doSomething, and you typo it to doSoemthing, if you are using direct method invocation this will be identified at compile time. If you are using reflection, it will compile successfully and throw a MethodNotFoundException at run time.
    Similarly, direct method invocation offers compile-time checking of arguments, result types and expected exceptions, which all need to be dealt with at runtime if using reflection.
    Personal and professional recommendation:
    If there is any common theme to the objects you're storing in your hashtable, wrap that into an interface that defines a clear way to access expected functionality. This leaves implementations of the interface (The objects you will store in the hashtable) to map the interface methods to the required functionality implementation, in whatever manner they deem appropriate (Hopefully efficiently :-)
    If this is feasible, you will find it will produce a result that performs better and is more maintainable. If the interface is designed well, it should also be just as extensible as if you used reflection.

  • Dynamic cast at runtime (Here we go again! )

    Hy folks,
    today I read so many entries about dynamic casting. But no one maps to my problem. For a lot of them individual alternatives were found. And so I hope...
    Ok, what's my problem?
    here simplified:
    I have a HashMap with couples of SwingComponents and StringArray[3].
    The SwingComponents are stored as Objects (they are all JComponents).
    The StringArray comprised "the exact ClassName" (like "JButton" or "JPanel"),
    "the method, who would be called" (like "addItemListener")
    and "the ListenerName" (like "MouseMotionListener" or "ActionListener")
    At compiletime I don't know, what JCommponent gets which Listener.
    So a JPanel could add an ItemListener, another JPanel could add
    a MouseListener and an ActionListener.
    I get the description of the GUI not until runtime.
    The 'instanceof'-resolution is not acceptable, because there are above 50 listener. If I write such a class, I would write weeks for it, and it will be enormous.
    Now, my question
    I get the class of the Listenertype by
    Class c=Class.forName(stringArray[2]);
    and the method I'll call
    java.lang.reflect.Method method=component.getClass().getDeclaredMethod(s[1],classArrayOfTheParameter[]); //the parameter is not important here
    And I have a class, who implements all required ListenerInterfaces: EHP
    Now I wish something like this
    method.invoke((JPanel)jcomponent,(c)EHP);
    Is there anybode, who can give me an alternative resolution
    without instanceof or switch-case ?
    Greatings egosum

    I see, your right. Thanks. This problem is been solved.
    But a second problem is, that jcomponent can be every Swing-Object.
    I get the swing-component as Object from the HashMap . And I know
    what it is exactly by a String.
    What I need here is
    method.invoke(("SwingType")swingcomponentObject,Object[] args);
    I know, that this doesn't exist. Here my next question
    Can I take an other structure than HashMap, where the return value
    is a safety type (and not an Object). Or there are some other hints
    about similar problems and there resolutions?
    I don't like to write 50 (or even more than 50) "instanceOf"-instructions or "equal"-queries. And I'm not really interested in the whole set of java swing elements existing.
    I appreciate all the help I can get.
    With regards egosum

  • Dynamic [Runtime] type casting in Java

    Hello,
    This is my requirement.
    I have a method that takes class name as a parameter.
    Ex:
    Object myMethod(String classname){
    Object xyz = getObject(); //userdefine method which returns some object
    /*<b>I need to typecast above object with the class name passed as the method parameter</b>*/
    /*<b>How can i type cast this object</b>*/
    Object obj = (classname) xyz;
    return obj;
    In the above example, how can i dynamically typecast the object with class whose name is passed as the method parameter?

    Hello,
    This is my requirement.
    I have a method that takes class name as a parameter.
    Ex:
    Object myMethod(String classname){
    Object xyz = getObject(); //userdefine method which
    returns some object
    /*<b>I need to typecast above object with the class
    name passed as the method parameter</b>*/
    /*<b>How can i type cast this object</b>*/
    Object obj = (classname) xyz;
    return obj;
    In the above example, how can i dynamically typecast
    the object with class whose name is passed as the
    method parameter?Perhaps a little more background on the project (what you are trying to do) will help the experts here answer?
    /*with a class that takes a noarg constructor*/
    public Object getObject(String classname) throws Exception
      //might want to get a bit more specific with which exceptions it will throw
      return Class.forName(classname).newInstance();
    }Do I think this sometimes is indicative (perhaps even more often than not), of a possible design flaw? Yes..
    It gets a little trickier if you have constructors (you have to create a Class object representing the string with the .forName(..) ..and then use some reflection to determine constructors and then a bit of logic to determine which of those to use...)
    ~Dave

  • View Criteria in ADF Query Panel with Table-Class Cast Exception

    Hi,
    I am getting Class Cast Exception when using view criteria for ADF Query Panel with Table. The version I am using is 11g Release 1(11.1.1.2.0)
    Here is what I did:
    1. created a view criteria on a view object
    2. all are optional
    3. all are Strings
    3. Dragged the view criteria as a query component (ADF Query panel with Query table) on to the design layout
    and the error when I clicked the Search button is:
    javax.el.ELException: java.lang.ClassCastException: oracle.jbo.common.ViewCriteriaImpl cannot be cast to oracle.jbo.ViewCriteriaRow
    at com.sun.el.parser.AstValue.invoke(AstValue.java:161)
    at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodExpression(UIXComponentBase.java:1289)
    at oracle.adf.view.rich.component.UIXQuery.broadcast(UIXQuery.java:115)
    at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:148)
    at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:148)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:812)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:292)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:177)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:191)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at sni.foundation.facesextensions.filters.FoundationFilter.doFilter(FoundationFilter.java:92)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:97)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
    at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:94)
    at java.security.AccessController.doPrivileged(Native Method)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:138)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:70)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:326)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3592)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2202)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2108)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1432)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Caused by: java.lang.ClassCastException: oracle.jbo.common.ViewCriteriaImpl cannot be cast to oracle.jbo.ViewCriteriaRow
    at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding._clearFilterCriteriaRows(FacesCtrlSearchBinding.java:4549)
    at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding._addFilterCriteria(FacesCtrlSearchBinding.java:4603)
    at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding.processQuery(FacesCtrlSearchBinding.java:423)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.el.parser.AstValue.invoke(AstValue.java:157)
    Thanks
    Venkatesh

    Hi Frank.
    I'm using JDev 11.1.1.3.0 as you suggest the error is no longer present in the latest version.
    I can pick my query from the "Saved Search" pick list on the QueryPanel list of queries just fine, and it sets up the filter properly, but when I press the "Search" button, I get the same reported error...
    <RegistrationConfigurator><handleError> Server Exception during PPR, #1
    javax.el.ELException: java.lang.ClassCastException: oracle.jbo.common.ViewCriteriaImpl cannot be cast to oracle.jbo.ViewCriteriaRow
         at com.sun.el.parser.AstValue.invoke(AstValue.java:161)
         at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodExpression(UIXComponentBase.java:1303)
         at oracle.adf.view.rich.component.UIXQuery.broadcast(UIXQuery.java:115)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:812)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:292)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:177)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:191)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:97)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
         at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:94)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:414)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:138)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:330)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3684)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Caused by: java.lang.ClassCastException: oracle.jbo.common.ViewCriteriaImpl cannot be cast to oracle.jbo.ViewCriteriaRow
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding._clearFilterCriteriaRows(FacesCtrlSearchBinding.java:4588)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding._addFilterCriteria(FacesCtrlSearchBinding.java:4642)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding.processQuery(FacesCtrlSearchBinding.java:424)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.sun.el.parser.AstValue.invoke(AstValue.java:157)
         ... 42 more

  • Mapping Error: Cannot cast to float

    Hello Everyone,
    Has anyone seen this error in Message Mapping in XI?  What did you do to resolve it?
    13:59:10 Start of test
    Compilation of JobPositionPublication2PositionOpening_M successful Runtime exception during processing target field mapping /ns1:PositionOpening/ns1:PositionProfile/ns1:PositionDetail. The message is: Exception:[java.lang.IllegalArgumentException: Cannot cast to float. ] in class com.sap.aii.mappingtool.flib3.Arithm method greater[, 0, com.sap.aii.mappingtool.tf3.rt.Context@8e6076] com.sap.aii.mappingtool.tf3.MessageMappingException: Runtime exception during processing target field mapping /ns1:PositionOpening/ns1:PositionProfile/ns1:PositionDetail. The message is: Exception:[java.lang.IllegalArgumentException: Cannot cast to float. ] in class com.sap.aii.mappingtool.flib3.Arithm method greater[, 0, com.sap.aii.mappingtool.tf3.rt.Context@8e6076] at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:284) at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:238) at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:238) at com.sap.aii.mappingtool.tf3.AMappingProgram.start(AMappingProgram.java:352) at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:60) at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:105) at com.sap.aii.ibrep.server.mapping.ServerMapService.transformInternal(ServerMapService.java:431) at com.sap.aii.ibrep.server.mapping.ServerMapService.execute(ServerMapService.java:169) at com.sap.aii.ibrep.sbeans.mapping.MapServiceBean.execute(MapServiceBean.java:52) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0.execute(MapServiceRemoteObjectImpl0.java:301) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0p4_Skel.dispatch(MapServiceRemoteObjectImpl0p4_Skel.java:146) at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:309) at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:194) at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:122) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170) Root Cause: com.sap.aii.utilxi.misc.api.BaseRuntimeException: Exception:[java.lang.IllegalArgumentException: Cannot cast to float. ] in class com.sap.aii.mappingtool.flib3.Arithm method greater[, 0, com.sap.aii.mappingtool.tf3.rt.Context@8e6076] at com.sap.aii.mappingtool.tf3.rt.FunctionWrapper.getValue(FunctionWrapper.java:56) at com.sap.aii.mappingtool.tf3.rt.FunctionWrapper.getValue(FunctionWrapper.java:41) at com.sap.aii.mappingtool.tf3.rt.FunctionWrapper.getValue(FunctionWrapper.java:41) at com.sap.aii.mappingtool.tf3.rt.FunctionWrapper.getValue(FunctionWrapper.java:41) at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:220) at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:238) at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:238) at com.sap.aii.mappingtool.tf3.AMappingProgram.start(AMappingProgram.java:352) at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:60) at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:105) at com.sap.aii.ibrep.server.mapping.ServerMapService.transformInternal(ServerMapService.java:431) at com.sap.aii.ibrep.server.mapping.ServerMapService.execute(ServerMapService.java:169) at com.sap.aii.ibrep.sbeans.mapping.MapServiceBean.execute(MapServiceBean.java:52) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0.execute(MapServiceRemoteObjectImpl0.java:301) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0p4_Skel.dispatch(MapServiceRemoteObjectImpl0p4_Skel.java:146) at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:309) at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:194) at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:122) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170) Root Cause: java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor248.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.aii.mappingtool.tf3.rt.FunctionWrapper.getValue(FunctionWrapper.java:47) at com.sap.aii.mappingtool.tf3.rt.FunctionWrapper.getValue(FunctionWrapper.java:41) at com.sap.aii.mappingtool.tf3.rt.FunctionWrapper.getValue(FunctionWrapper.java:41) at com.sap.aii.mappingtool.tf3.rt.FunctionWrapper.getValue(FunctionWrapper.java:41) at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:220) at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:238) at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:238) at com.sap.aii.mappingtool.tf3.AMappingProgram.start(AMappingProgram.java:352) at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:60) at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:105) at com.sap.aii.ibrep.server.mapping.ServerMapService.transformInternal(ServerMapService.java:431) at com.sap.aii.ibrep.server.mapping.ServerMapService.execute(ServerMapService.java:169) at com.sap.aii.ibrep.sbeans.mapping.MapServiceBean.execute(MapServiceBean.java:52) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0.execute(MapServiceRemoteObjectImpl0.java:301) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0p4_Skel.dispatch(MapServiceRemoteObjectImpl0p4_Skel.java:146) at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:309) at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:194) at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:122) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170) Caused by: java.lang.IllegalArgumentException: Cannot cast to float. at com.sap.aii.mappingtool.flib3.Arithm.toFloat(Arithm.java:19) at com.sap.aii.mappingtool.flib3.Arithm.greater(Arithm.java:72) ... 27 more RuntimeException in Message-Mapping transformation: Runtime exception during processing target field mapping /ns1:PositionOpening/ns1:PositionProfile/ns1:PositionDetail. The message is: Exception:[java.lang.IllegalArgumentException: Cannot cast to float. ] in class com.sap.aii.mappingtool.flib3.Arithm method greater[, 0, com.sap.aii.mappingtool.tf3.rt.Context@8e6076]
    13:59:12 End of test

    If you are using a UDF, then the input and the output from the UDF is in the form of a string.If a float value is passed to the UDF,and if there are some arithmetic operations done on that float value then you need to convert the string to float - something like the below.
    String s = "100.00";
          try {
             float f = Float.valueOf(s.trim()).floatValue();
             System.out.println("float f = " + f);
          } catch (NumberFormatException nfe) {
             System.out.println("NumberFormatException: " + nfe.getMessage());
    Then before returning the value to the target field,convert the value back to string  like this -
    Float.toString(float f)
    In case you are using some other standard functions,do let us know of that as well so that we can suggest resolutions to this error.
    thanks\
    Priyanka

  • Class Cast Exception when launching ACC against the CSC module

    Hi All,
    Hoping that someone can shed some light on the issue I am facing. many thanks.
    I am enabling the CSC as a deployment agent using the switchable datasources. I have configured the DeploymentAgent as well as the ConfigFileSystem nucleus components to enable switchable deployments. The deployments to the CSC module is function correctly. However when I launch the ACC against the CSC module I am receiving a Class Cast Exception against the atg.vfs.switchable.SwitchableLocalFileSystem class.
    java.lang.ClassCastException: atg.vfs.switchable.SwitchableLocalFileSystem
         at atg.versionmanager.VersionManager.setUpSets(VersionManager.java:1475)
         at atg.versionmanager.VersionManager.getVersionedVirtualFileSystemsSet(VersionManager.java:1173)
         at atg.ui.common.model.VersionAgentImpl.containsVersionedVirtualFileSystem(VersionAgentImpl.java:91)
         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:592)
         at atg.security.proxy.UserSessionProxy$SessionSkeletonHandler.invoke(UserSessionProxy.java:251)
         at atg.rmi.context.ContextualSkeletonImpl.invoke(ContextualSkeletonImpl.java:103)
         at sun.reflect.GeneratedMethodAccessor355.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:592)
         at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
         at sun.rmi.transport.Transport$1.run(Transport.java:153)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
         at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
         at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
         at java.lang.Thread.run(Thread.java:595)
    java.lang.NullPointerException
         at atg.ui.common.menu.Item.setPrivilege(Item.java:105)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at atg.beans.BeanPropertyMapper.setPropertyValue(BeanPropertyMapper.java:162)
         at atg.beans.DynamicBeans.setPropertyValue(DynamicBeans.java:500)
         at atg.xcl.DefaultPropertyBuilder.assignProperty(DefaultPropertyBuilder.java:71)
         at atg.xcl.XclContextBuilder.assignPropertyElement(XclContextBuilder.java:550)
         at atg.xcl.XclContextBuilder.assignProperties(XclContextBuilder.java:519)
         at atg.xcl.XclContextBuilder.buildObjectElement(XclContextBuilder.java:231)
         at atg.xcl.XclContextBuilder.buildObject(XclContextBuilder.java:308)
         at atg.xcl.XclContextBuilder.buildObjectElement(XclContextBuilder.java:260)
         at atg.xcl.XclContextBuilder.buildObject(XclContextBuilder.java:308)
         at atg.xcl.XclContextBuilder.buildObjectElement(XclContextBuilder.java:260)
         at atg.xcl.XclContextBuilder.buildObject(XclContextBuilder.java:308)
         at atg.xcl.XclContextBuilder.buildObjectElement(XclContextBuilder.java:260)
         at atg.xcl.XclContextBuilder.buildObject(XclContextBuilder.java:308)
         at atg.xcl.XclContextBuilder.buildContext(XclContextBuilder.java:186)
         at atg.xcl.SerializableTemplate.buildContext(SerializableTemplate.java:141)
         at atg.ui.common.menu.XuillDevActionSet.mergeHierarchy(XuillDevActionSet.java:93)
         at atg.ui.common.menu.XuillDevActionSet.mergeHierarchy(XuillDevActionSet.java:84)
         at atg.ui.common.MenuFactory.mergeHierarchies(MenuFactory.java:452)
         at atg.ui.common.MenuFactory.mergeActionSets(MenuFactory.java:325)
         at atg.ui.hub.Hub.constructHubMenu(Hub.java:1367)
         at atg.ui.hub.Hub.moduleInit(Hub.java:1283)
         at atg.ui.hub.Hub.initializeClient(Hub.java:669)
         at atg.ui.common.DevApp.connectToServer(DevApp.java:269)
         at atg.ui.hub.Hub$5.run(Hub.java:1937)
         at java.awt.event.InvocationEvent.dispatch(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    java.lang.NullPointerException
         at atg.ui.common.menu.Item.getKey(Item.java:69)
         at atg.ui.common.menu.ActionItem.toString(ActionItem.java:85)
         at java.lang.String.valueOf(Unknown Source)
         at java.lang.StringBuilder.append(Unknown Source)
         at atg.xcl.DefaultPropertyBuilder.assignProperty(DefaultPropertyBuilder.java:87)
         at atg.xcl.XclContextBuilder.assignPropertyElement(XclContextBuilder.java:550)
         at atg.xcl.XclContextBuilder.assignProperties(XclContextBuilder.java:519)
         at atg.xcl.XclContextBuilder.buildObjectElement(XclContextBuilder.java:231)
         at atg.xcl.XclContextBuilder.buildObject(XclContextBuilder.java:308)
         at atg.xcl.XclContextBuilder.buildObjectElement(XclContextBuilder.java:260)
         at atg.xcl.XclContextBuilder.buildObject(XclContextBuilder.java:308)
         at atg.xcl.XclContextBuilder.buildObjectElement(XclContextBuilder.java:260)
         at atg.xcl.XclContextBuilder.buildObject(XclContextBuilder.java:308)
         at atg.xcl.XclContextBuilder.buildObjectElement(XclContextBuilder.java:260)
         at atg.xcl.XclContextBuilder.buildObject(XclContextBuilder.java:308)
         at atg.xcl.XclContextBuilder.buildContext(XclContextBuilder.java:186)
         at atg.xcl.SerializableTemplate.buildContext(SerializableTemplate.java:141)
         at atg.ui.common.menu.XuillDevActionSet.mergeHierarchy(XuillDevActionSet.java:93)
         at atg.ui.common.menu.XuillDevActionSet.mergeHierarchy(XuillDevActionSet.java:84)
         at atg.ui.common.MenuFactory.mergeHierarchies(MenuFactory.java:452)
         at atg.ui.common.MenuFactory.mergeActionSets(MenuFactory.java:325)
         at atg.ui.hub.Hub.constructHubMenu(Hub.java:1367)
         at atg.ui.hub.Hub.moduleInit(Hub.java:1283)
         at atg.ui.hub.Hub.initializeClient(Hub.java:669)
         at atg.ui.common.DevApp.connectToServer(DevApp.java:269)
         at atg.ui.hub.Hub$5.run(Hub.java:1937)
         at java.awt.event.InvocationEvent.dispatch(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
         at atg.ui.common.menu.Item.getKey(Item.java:69)
         at atg.ui.common.menu.ActionItem.toString(ActionItem.java:85)
         at java.lang.String.valueOf(Unknown Source)
         at java.lang.StringBuilder.append(Unknown Source)
         at atg.xcl.DefaultPropertyBuilder.assignProperty(DefaultPropertyBuilder.java:87)
         at atg.xcl.XclContextBuilder.assignPropertyElement(XclContextBuilder.java:550)
         at atg.xcl.XclContextBuilder.assignProperties(XclContextBuilder.java:519)
         at atg.xcl.XclContextBuilder.buildObjectElement(XclContextBuilder.java:231)
         at atg.xcl.XclContextBuilder.buildObject(XclContextBuilder.java:308)
         at atg.xcl.XclContextBuilder.buildObjectElement(XclContextBuilder.java:260)
         at atg.xcl.XclContextBuilder.buildObject(XclContextBuilder.java:308)
         at atg.xcl.XclContextBuilder.buildObjectElement(XclContextBuilder.java:260)
         at atg.xcl.XclContextBuilder.buildObject(XclContextBuilder.java:308)
         at atg.xcl.XclContextBuilder.buildObjectElement(XclContextBuilder.java:260)
         at atg.xcl.XclContextBuilder.buildObject(XclContextBuilder.java:308)
         at atg.xcl.XclContextBuilder.buildContext(XclContextBuilder.java:186)
         at atg.xcl.SerializableTemplate.buildContext(SerializableTemplate.java:141)
         at atg.ui.common.menu.XuillDevActionSet.mergeHierarchy(XuillDevActionSet.java:93)
         at atg.ui.common.menu.XuillDevActionSet.mergeHierarchy(XuillDevActionSet.java:84)
         at atg.ui.common.MenuFactory.mergeHierarchies(MenuFactory.java:452)
         at atg.ui.common.MenuFactory.mergeActionSets(MenuFactory.java:325)
         at atg.ui.hub.Hub.constructHubMenu(Hub.java:1367)
         at atg.ui.hub.Hub.moduleInit(Hub.java:1283)
         at atg.ui.hub.Hub.initializeClient(Hub.java:669)
         at atg.ui.common.DevApp.connectToServer(DevApp.java:269)
         at atg.ui.hub.Hub$5.run(Hub.java:1937)
         at java.awt.event.InvocationEvent.dispatch(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

    Change the configuration of config file system to oot......and check it out.

  • Class Cast exception when clicking Search Button in Query component

    Hi
    We have to implement the Query component in ADF programmatically.. We are using Toplink as the Model layer for ADF.
    We followed the Web User Interface Guide for ADF development, Chapter 12 (Using Query Components) for the same.
    We already have implemented the following classes:
    1) QueryModel
    2) QueryDescriptor
    3) AttributeDescriptor
    4) ConjuctionCriterion
    5) AttributeCriterion etc.
    We are able to see the Search panel in UI with selected fields in Basic as well as Advanced mode.
    When we click on Search button, we are getting Class Cast exception.
    The stacktrace of the exception is below:
    <LifecycleImpl> <_handleException> ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase INVOKE_APPLICATION 5
    javax.el.ELException: java.lang.ClassCastException: view.QueryDescriptorImpl cannot be cast to oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding$QueryDescriptorImpl
         at com.sun.el.parser.AstValue.invoke(Unknown Source)
         at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodExpression(UIXComponentBase.java:1300)
         at oracle.adf.view.rich.component.UIXQuery.broadcast(UIXQuery.java:116)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:902)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:313)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:186)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         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 weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
         at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    Caused by: java.lang.ClassCastException: view.QueryDescriptorImpl cannot be cast to oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding$QueryDescriptorImpl
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding.processQuery(FacesCtrlSearchBinding.java:374)
         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)
         ... 44 more
    <RegistrationConfigurator> <handleError> ADF_FACES-60096:Server Exception during PPR, #1
    javax.el.ELException: java.lang.ClassCastException: view.QueryDescriptorImpl cannot be cast to oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding$QueryDescriptorImpl
         at com.sun.el.parser.AstValue.invoke(Unknown Source)
         at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodExpression(UIXComponentBase.java:1300)
         at oracle.adf.view.rich.component.UIXQuery.broadcast(UIXQuery.java:116)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:902)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:313)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:186)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         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 weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
         at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    Caused by: java.lang.ClassCastException: view.QueryDescriptorImpl cannot be cast to oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding$QueryDescriptorImpl
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding.processQuery(FacesCtrlSearchBinding.java:374)
         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)
         ... 44 more
    Any help will be highly appreciated.
    Thanks in advance.
    Anup

    Gary Tam wrote:
    I am working on a project that utilize Oracle Ultra Search that will crawl and tag documents in the database.
    The initial code that uses pure JDBC was working fine, but when we switch to get database connection from dataSource, we are getting classCast exception inside Oracle's ultra search. The problems is that the class we get from dataSource.getConnection() returns
    "weblogic.jdbc.wrapper.JTSConnection_oracle_jdbc_driver_T4CConnection". But Oracle UltraSearch is not expecting that.
    Is there anyway to unwrap the connection that we get from dataSource ? I tried casting to OracleConnection,
    assign the connection to "oracle.jdbc.driver.T4CConnection" without any success.
    Any help would be appricated.
    ThanksHi Gary. If the code you want to run is running inside WebLogic, such as in a JSP,
    then look for our documentation on our JDBC extension 'getVendorConnection()". It
    will get you a direct Oracle connection for their mis-declared UltraSearch
    classes (they declare they take java.sql.Connection, but they really demand a
    concrete thin driver connection. No other Oracle driver will be given a chance).
    Joe

  • Class Cast Exception in Portable Remote Object

    Hai guys,
    I am new to jsp.I have made a simple j2ee application in which i am getting class cast exception in PortableRemoteObject.narrow function.
    The exception is:
    org.apache.jasper.JasperException
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:297)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:247)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:585)
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
    java.security.AccessController.doPrivileged(Native Method)
    javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
    The root cause is :
    java.lang.ClassCastException
         com.sun.corba.ee.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)
    javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
    org.apache.jsp.registration_jsp._jspService(registration_jsp.java:59)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:105)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:336)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:297)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:247)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:585)
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
    java.security.AccessController.doPrivileged(Native Method)
    javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
    The code of the file is :
    <%@ page language="java" import="java.sql.*,pkg.*,javax.ejb.*,javax.naming.*,javax.rmi.PortableRemoteObject,java.rmi.RemoteException" %>
    <html>
    <head>
    <title></title>
    </head>
    <body bgcolor="CCCCFF">
    <h1><center>Welcome to MyBank</center></h1>
    <%
    InitialContext initial = new InitialContext();
    Object objref = initial.lookup("bankDSN");
    pkg.mybankHome vi = (pkg.mybankHome)PortableRemoteObject.narrow(objref,pkg.mybankHome.class);
    %>
    </body>
    </html>
    I have many threads but i was not able to solve this problem.
    It has been 2 to 3 weeks that i am struck in this error.
    Plz help me with this.
    Thanks in advance.
    Edited by: vishal29 on Jul 13, 2008 10:04 PM

    Hai DigitalDreamer,
    Thanks for giving your valuable time to my question.
    I have tried the code you gave me.
    The answer for :
    out.println(objref.getClass().getName());
    that i got is :
    javax.naming.Reference
    And the answer for :
    out.println(objref.getClass().getInterfaces());
    that i got is :
    [Ljava.lang.Class;@213b6e
    Could you please tell me how this can help.
    Actually i am new to jsp.
    Thanks in advance                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • For all the reflection gurus out there

    I need to be able to access protected classes/interfaces and protected methods from another package. I know this completely undermines the entire idea of java�s protection keywords, but I don�t have any other choice. I also understand that this will possibly lock me into a specific VM version and implementation that I can use for my application because it is not part of the java API spec. Having said that I still need it to work. My real goal here is to create my own modal window behavior because Sun�s is not robust enough for our needs.
    I need the following code to work:
    FILE1
    package protect;
    public class Helper {
        public static Object getEventDispatchThreadInstance() {
            return new EventDispatchThread();
    interface Conditional {
        public void evaluate();
    class EventDispatchThread extends Thread {
        void pumpEvents(Conditional condition) {
            condition.evaluate();
    }FILE2
    package my;
    import protect.Helper;
    import java.lang.reflect.*;
    public class MyClass {
        public MyClass() {
            try {
                Class evDispatchThread = Class.forName("protect.EventDispatchThread");
                Class conditional = Class.forName("protect.Conditional");
                Object[] conditionalInstance = {new Object() {
                    public boolean evaluate() {
                        System.out.println("Please work");
                        return false;
                Method method = evDispatchThread.getDeclaredMethod("pumpEvents", new Class[] { conditional });
                method.setAccessible(true);
                method.invoke(Helper.getEventDispatchThreadInstance(),
                    conditionalInstance);  // This throws an IllegalArgumentException :(    
            } catch (Exception ex) {System.out.println(ex);}
        public static void main(String[] args) {
            MyClass instance = new MyClass();
    }The method.invoke call doesn�t work. I think the problem is because the conditionalInstance is not an instance of protect.Conditional. If protect.Conditional was not protected I would be able to do a cast, but I can�t because the compiler complains about it. How can I create an interface that is protected by using reflection? I also need to have my implementation of the evaluate method be executed when it is called in the pumpEvents call of the EventDispatchThread object.
    If you want a better idea of what I am trying to do in my application you can check out these threads:
    Project Swing->Help with the event dispatch thread
    Project Swing->Modality..what is it good for (absolutely nooothing)
    Thanks
    Lance

    I didn�t say it was the smartest thing to do, but it is either this or rewrite swing or our application to use a different GUI interface. I would rather be able to get this to work. Hey if it isn�t possible it isn�t possible.
    By the way DrClap you might want to find a different language then. You can access several methods that are protected by using reflection. The problems with my code are that it seems like you can�t use reflection to make protected interfaces, you can�t extend protected classes/interfaces, and you can�t cast correctly with these protected objects. The method.setAccessible(true); actually works. Check out the java.lange.reflect.AccessibleObject in the api.
    Lance

Maybe you are looking for

  • Client got not connection to wlan over wlc 2504 on 802.11b/g

    Hi everybody, We are using a wlc 2504 with 7.6.100.0 and AP 1532e. I have the strange observacion that only clients with 802.11n (2.4GHz) can connect to the WLAN. Clients thats works only with 802.11b/g, they can't connect to the WLAN. Affected are a

  • Why is Adobe 11.0.10 suddenly saying, "Cannot save to this file name"?

    I've had no issues saving fillable PDFs that I've edited up until this week. I don't know what caused the change and I've tried researching the issue. Has anybody else experienced this and found a solution?

  • Applicatio​n Updates when updating Desktop Mgr

    Hi All, In updating DM from 4.6 to 4.7 on a new 8310, the software asks if I want to update the phone's applications.  It provides a list of what will be updated and says it will delete a number of installed apps.  There doesn't seem to be an option

  • Says [Receiving Text] but they are blank

    I just downgraded my phone from OS 6 and all my text bubbles are blank but the date and time are there and in the front of every thread it says [Receiving Text] but have yet to show up. Has this happened to anyone else?

  • Strange issues after 10.6.4 update

    Hi there I've noticed a few weird things after upgrading to 10.6.4: 1) All my fonts in Microsoft Office applications have been set to default. After changing then, they still revert back. 2) When browsing the web, TinyMCE boxes display weird characte