Wide casting problem

Hi All,
Can u explain Wide casting in detail ? already i gone through sdn links but still i didnt get clear .  please go through the follwing code snippet and explain where i made mistake in order to getting wide casting.. my problem is as wide casting i want to access the base class methods with reference of sub class when the base class methods are redefined in sub class(actually sub class reference access the  subclass methods only if we have same methods in base and as well as sub class) in my program after performing wide cast also it is accessing sub class methods only please send the answer.
REPORT  ZNARROW_WIDE.
CLASS C1 DEFINITION.
PUBLIC SECTION.
METHODS:M1,M2.
ENDCLASS.
CLASS C1 IMPLEMENTATION.
METHOD M1.
WRITE:/ ' THIS IS SUPER CLASS METHOD M1'.
ENDMETHOD.
METHOD M2.
WRITE:/ ' THIS IS SUPER CLASS METHOD M2'.
ENDMETHOD.
ENDCLASS.
CLASS C2 DEFINITION INHERITING FROM C1.
PUBLIC SECTION.
METHODS:M1 REDEFINITION.
METHODS:M2 REDEFINITION,
                  M3.
ENDCLASS.
CLASS C2 IMPLEMENTATION.
METHOD M1.
WRITE:/ ' THIS IS SUB CLASS METHOD M1'.
ENDMETHOD.
METHOD M2.
WRITE:/ ' THIS IS SUBCLASS METHOD M2'.
ENDMETHOD.
METHOD M3.
WRITE:/ ' THIS IS SUB CLASS METHOD M3'.
ENDMETHOD.
ENDCLASS.
DATA:O_SUPER TYPE REF TO C1,
     O_SUB TYPE REF TO C2.
START-OF-SELECTION.
CREATE OBJECT O_SUPER.
CREATE OBJECT O_SUB.
CALL METHOD O_SUPER->M1.
CALL METHOD O_SUPER->M2.
CLEAR O_SUPER.
O_SUPER = O_SUB.
CALL METHOD O_SUPER->('M3').
SKIP 5.
ULINE 1(80).
CLEAR O_SUB.
O_SUB ?= O_SUPER.
CALL METHOD O_SUB->M1.
CALL METHOD O_SUB->M2.
CALL METHOD O_SUB->M3.
Thanks in advance.
sreenivas P

Hi,
consider the following sample code:
REPORT  ZA_TEST93.
class class_super definition.
  public section.
    data: var_area type i.
    methods:
    area importing length type i breadth type i.
endclass.
class class_super implementation.
  method area.
    var_area = length * breadth.
    write:/ 'Area of rectangle = '.
    write: var_area.
  endmethod.
endclass.
class class_sub definition inheriting from class_super.
  public section.
  data:height type i.
  methods:
  area redefinition.
endclass.
class class_sub implementation.
  method area.
    var_area = 6 * length * breadth * height.
    write:/ 'Area of the cube ='.
    write: var_area.
  endmethod.
endclass.
start-of-selection.
data: object_superclass type ref to class_super,
      object_subclass type ref to class_sub,
      object2_superclass type ref to class_super.
create object object_superclass.
create object object2_superclass.
create object object_subclass.
call method object_superclass->area exporting length = 10 breadth = 5.
"Narrow casting
object_subclass->height = 10.
object_superclass = object_subclass.
call method object_superclass->area exporting length = 10 breadth = 10.
"Wide casting
object_superclass ?= object2_superclass.
call method object_superclass->area exporting length = 10 breadth = 5.
Explanation:
In the above code, consider the super class named 'class_super'.
This class has a method called 'area' which is used to calculate the area of a rectangle.
Consider the subclass 'class_sub', which inherits all the attributes and methods of super class 'class_super'.
Now we want to use the same method of super class 'class_super', 'area', but this time we want it to calculate the area of a cube.
For this purpose we use the 'redefinition' keyword in the definition part of 'class_sub' and enter the code for cube area calculation in the 'area' method body in the implementation part of 'class_sub'.
From the above code, consider the following code snippet:
create object object_superclass.
create object object2_superclass.
create object object_subclass.
call method object_superclass->area exporting length = 10 breadth = 5.
Explanation: Two objects of the superclass and one object of the subclass are created and the 'area' method of the superclass is called to compute the area of a rectangle.
Now consider what comes next:
"Narrow casting
object_subclass->height = 10.
object_superclass = object_subclass.
call method object_superclass->area exporting length = 10 breadth = 10.
Explanation:
We assign a value of 10 to the 'height' instance variable of the subclass object.
Then we perform narrow casting in the next line(object_superclass = object_subclass.).
Now the instance of the superclass(object_superclass) now points or refers to the object of the subclass, thus the modified method 'area' of the subclass is now accessible.
Then we call this method 'area' of the subclass to compute the area of the cube.
Moving on to the final piece of code:
"Wide casting
object_superclass ?= object2_superclass.
call method object_superclass->area exporting length = 10 breadth = 5.
Explanation:
The object 'object_superclass' now refers to the object of the subclass 'object_subclass'.
Thus the 'area' method of the superclass cannot be called by this object.
In order to enable it to call the 'area' method of the superclass, wide casting has to be perfomed.
For this purpose, the RHS of the wide casting must always be an object of a superclass, and the LHS of the wide casting must always be an object reference declared as 'type ref to' the superclass(objectsuperclass ?= object2_superclass.)._
Otherwise a runtime error will occur.
Finally the 'area' method of the superclass can now be called once again to compute the area of the rectangle.
The output of the above example program is as follows:
Area of rectangle =          50
Area of the cube =      6,000
Area of rectangle =          50
Also note that wide casting cannot be performed on subclass objects, wide casting can only be performed on superclass objects that have been narrow cast.
Hope my explanation was useful,
Regards,
Adithya.
Edited by: Adithya K Ramesh on Dec 21, 2011 11:49 AM
Edited by: Adithya K Ramesh on Dec 21, 2011 11:51 AM

Similar Messages

  • How important it is to understand Concept of Narrow & Wide casting in ABAP Objects

    Hi Friends,
    I Understood that, it is very important to understand the concept of "Casting ( Narrow Casting & Wide Casting )" properly.
    Let us see the following cases where the concept of "Casting ( Narrow Casting & Wide Casting )" comes into the picture in various practices of Abap, Webdynpro abap and FPM.
    1. ABAP:-
    When we are working with RTTS in abap it is very much important we must know the Casting Techniques. Without knowledge of the Casting of objects, there will be a lot of trouble we may faces.
    Mainly RTTS offers Runtime Type Services, means RTTS Programming enables us to find the type of the particular data obejct or data type or data reference in the run time.
    RTTS also enables us to create the data in the run time very dynamically.
    So, in the run time when we finding the type of the data objects or creation of data objects in the run time, We must do the Wide casting and Narrow casting also some times on the references provided by SAP Dynamically.
    So, here we go to have knowledge on Casting is mandatory.
    2. WEBDYNPRO ABAP:-
    The another point where the concept of casting comes into picture is , When we working with the ALV Reports and Dynamic programming of WEBDYNPRO. Here also we should posses good casting skills.
    3. FPM:-
    The major use of casting comes in hand is none other than FPM. When we working with certain Floor Plans or when we woking with Feeder Class concept of FPM, Casting comes into picture again.
    Along with Casting ( Narrow casting & Wide casting ), We must have the knowledge of 'Field Symbols' and 'Data References (known & Unknown)' to work with our all complex scenarios of Webdynpro and FPM and all.
    So guys, please have Knowledge on the following, befor you master on advanced techniques of WEBDYNPRO and FPM etc.
         1. Field Symbols
         2. Data References (known & unknown)
         3. Casting (Narrow casting & Wide casting)
         4. Brief Idea about RTTS
    All the above 4 concepts will definitely make our life easy when dig more into WEBDYNPRO ABAP and FPM.
    Thank You.
    Please share your comments on the same.

    Hi Shankar,
    It's really good to know.
    It could be great if you can share few technicalities for the concepts explained.
    Regards,
    Rafi

  • Runtime casting problems

    The following code gives me runtime casting problems:
    package edu.columbia.law.markup.test;
    import java.util.*;
    public class A {
       protected static Hashtable hash = null;
       static {
          hash = new Hashtable ();
          hash.put ("one", "value 1");
          hash.put ("two", "value 2");
       public static void main (String args []) {
           A a = new A ();
           String keys [] = a.keys ();
           for (int i = 0; i < keys.length; i++) {
               System.out.println (keys );
    public String [] keys () {
    return (String []) hash.keySet ().toArray ();
    The output on my console is:
    java.lang.ClassCastException: [Ljava.lang.Object;
            at edu.columbia.law.markup.test.A.keys(A.java:37)
            at edu.columbia.law.markup.test.A.main(A.java:29)I can not understand why is it a problem for JVM to cast?
    Any ideas?
    Thanks,
    Alex.

    return (String []) hash.keySet ().toArray ();This form of toArray returns an Object[] reference to an Object[] object. You cannot cast a reference to an Object[] object to a String[] reference for the same reason that you cannot cast a reference to a Object object to a String reference.
    You must use the alternate form of toArray instead:
    return (String []) hash.keySet ().toArray (new String[0]);This will return an Object[] reference to a String[] object, and this reference can be cast to a String[] reference.

  • Why narrow casting is must before doing wide casting

    Hi everyone,
    I know the concept of wide casting ( assign/pass super class instances to subclass instances). So then why we need to do narrow casting before doing wide casting in our logic. I am just struggling into this concept from last 3 days. I have read many thread and blog but did not get satisfactory answer.
    Regards,
    Seth

    Hello Seth
    You do not need to do narrow casting. But, if you assign an instance of a super class to variable of subclass and try to run a subclass' method on that instance (of superclass) you will get an exception. Because super class does not have a mentioned method.
    Example:
    CLASS lcl_vehicle DEFINITION.
    ENDCLASS.
    CLASS lcl_car DEFINITION INHERITING FROM lcl_vehicle.
      DATA engine TYPE string VALUE 'has_engine'.
    ENDCLASS.
    DATA:
      lo_vehicle TYPE lcl_vehicle,
      lo_car TYPE lcl_car.
    CREATE OBJECT lo_vehicle.
    CREATE OBJECT lo_car.
    WRITE lo_car->engine.
    lo_car ?= lo_vehicle.
    WRITE lo_car->engine.
    regards

  • Narrow casting vs wide casting

    Hello All,
    I have small requriemn..
    I have a super class A and a sub class B.
    In both the classes I have a method XYZ.
    So, A has the following methods
    ABC
    XYZ
    B has the following methods
    XYZ
    Now I have want to access the sub class methods from super class...i.e., in my example...Method XYZ of B class needs to be accessed from method ABC or XYZ or A.
    How do I do?
    And more over..what is the difference between Narrow Casting and Wide casting?
    Kalyan

    Hi Priya,
    Consider the below Example for accessing the subclass method from Superclass:
    CLASS LCL_SUPERCLASS DEFINITION.
       PUBLIC SECTION.
           METHODS: ABC, XYZ.
    ENDCLASS.
    CLASS LCL_SUPERCLASS IMPLEMENTATION.
      METHOD ABC.
       CALL METHOD ME->XYZ.
      ENDMETHOD.
      METHOD XYZ.
      ENDMETHOD.
    ENDCLASS.
    CLASS LCL_SUBCLASS DEFINITION
           INHERITING FROM LCL_SUPERCLASS.
       PUBLIC SECTION.
          METHODS XYZ REDEFINITION.
    ENDCLASS.
    CLASS LCL_SUBCLASS IMPLEMENTATION.
      METHOD XYZ.
      ENDMETHOD.
    ENDCLASS.
    START-OF-SELECTION.
    DATA: O_SUPER TYPE REF TO LCL_SUPERCLASS,
               O_SUB     TYPE REF TO LCL_SUBCLASS.
    CREATE OBJECT: O_SUPER, O_SUB.
    CALL METHOD O_SUPER->ABC.
    CALL METHOD O_SUB->ABC.
    In the above example, When you call the superclass method ABC using CALL METHOD O_SUPER->ABC, as you see in the implementation part of the Method it will inturn call the Superclass method XYZ.
    Here ME will point to the instance of the Superclass.
    But the CALL METHOD O_SUB->ABC will call the method ABC ( this is inherited from Superclass to Subclass )and inturn it calls the method XYZ of the SUbclass since ME now points to the object O_SUB of the Subclass.
    Hope this is clear.
    Regards,
    Nirupamaa.

  • System Wide Permissions Problem

    I have a MacBook Pro, OS 10.5.8, which I've been using since 2009, and this is the first time I've encountered the problem described below.
    I'm suddenly having what seems to be a system wide permissions problem. Tonight I found I couldn't add a new folder (the option was grayed out), and I noticed a pencil icon with a line through it at the bottom of the window. When I chose Get Info for that window, my name was missing from Sharing & Permissions. There was also a new name, "wheel", which I've never seen before. (3 names in all: system, wheel, eveyone.) This affects a lot of folders stemming off the HD (Applications, Library, etc.), but my user folder folder is unaffected.
    I've rebuilt the permissions several times in Disk Utility, and also repaired the disk after getting an error message when verifying. But the permissions problem is still there.
    So I'm wondering what in the heck could have caused this, and how can I fix it?
    I found I could add my name back to the permissions list in one of the affected folders, using Get Info, and this solved the issue for that folder, but there are a LOT of folders with the same issue. Perhaps if I did this with the HD folder, and selected the "Apply to enclosed items" option at the bottom?
    FWIW, we just bought & set up a new iMac, OS 10.8.2, last week. I looked at a number of folders on it using Get Info, and it seems to be configured pretty much the same way with regard to permissions, which is a little spooky. Don't know if it makes any difference, but I used the same user name, login password, apple ID & password when I set up the new computer as I have on my Macbook. Could that have caused this somehow?
    Thanks for any help or thoughts.

    Thank you, BDAqua for the link.
    I use my MacBook Pro mainly for creating music (DAW program & plug-ins). I've occasionally had to change permissions on individual plug-ins, but never to a group of folders on this scale.
    I'm wondering if there's a way to get my old permissions back, or if I should leave it as is at this point, and add my user name to the permissions on individual folders as the need arises? Don't want to screw everything up, as this is getting a little over my head.
    Any recommendations?

  • I have a MAC, Ive just installed OS10.10.3 operating system in it and I can't open Photoshop.  This is a wide spread problem that involves Java and Photoshop software.  Since you produce both these products , I turn toward you to direct me to the best "Fi

    I have a MAC, Ive just installed OS10.10.3 operating system in it and I can't open Photoshop.  This is a wide spread problem that involves Java and Photoshop software.  Since you produce both these products , I turn toward you to direct me to the best "Fix"?

    Go here Mac OS X Yosemite (10.10) compatibility FAQs | CC

  • Why ?= used in wide casting

    in wide casting , if we are assigning super class object2 to super class object1 using '?='. having the same effect as '='. so y we need to add '?' in wide casting.
    class lcl_super DEFINITION.
       PUBLIC SECTION.
       METHODS method1.
      ENDCLASS.
      CLASS lcl_super IMPLEMENTATION.
        method method1.
          write : 'super class method'.
          ENDMETHOD.
          ENDCLASS.
      class lcl_sub DEFINITION INHERITING FROM lcl_super.
        PUBLIC SECTION.
        methods : method1 REDEFINITION,
                  method2.
        ENDCLASS.
        CLASS lcl_sub IMPLEMENTATION.
          method method1.
            write ' subclass method1'.
            ENDMETHOD.
            method method2.
              write 'subclass method2'.
              ENDMETHOD.
          ENDCLASS.
    data: obj1 type REF TO lcl_super,
           obj2 type REF TO lcl_sub.
    START-OF-SELECTION.
    create OBJECT obj1.
    CREATE OBJECT obj2.
    obj1 = obj2.                                     "Narrrowing casting
    CALL METHOD obj1->method1.
    data obj3 type REF TO lcl_super.
    create OBJECT obj3.
    obj1 ?= obj3.   or obj1 = obj3             "   is having same effect  in Widecasting,  so why need '?'
    obj1->method1( ).

    Hi vijay,
    in addition to what Rudiger said, to know what ?= means, refer to this link: http://help.sap.com/abapdocu_70/en/ABAPMOVE.htm
    In the next example, ?= is needed:
    DATA:  obj_struct  TYPE REF TO cl_abap_structdescr.
    obj_struct ?= cl_abap_structdescr=>describe_by_name( 'DDTAB_NAME' ).
    Regards,
    Angelo.

  • Wide casting

    Hi all,
    Can anybody please tell the usuage of wide casting.
    preferable with simple code.
    Anirban Bhattacharjee

    Hi,
    1. Wider/up casting :
    This means a ref object used is of a parent. Now here technically speaking you can only call the methods of the parent class and not of the child class. Even if the parent object is referencing to a child object at runtime, the compiler does not allow you to call the child method.
    Wide casting does not have run-time errors as the compiler is able to identify the error at compile time only.
    Wide casting is helpful when you want to have a generic parameter as the importing parameter in OOPs.
    For eg.
    Class p1
    method x.
    Class c1 parent p1
    method y.
    Class c2 parent p1
    method z.
    In the above example both class c1 and c2 are subclasses of p1 and therefore has method x.
    Now let us say the user at runtime can pass object of c1,c2 or p1 and method x has to be capable of receiving all these, then in such case you can assign reference object of parent to method x.
    So method x can be defined as follows
    Class p1
    method x importing p  -
    > where p is type ref to p1.
    I hope this explains your query.
    Regards,
    Saurabh

  • Casting problems getting a home I/F of an EJB in another app when debuging a servlet

    (Jdeveloper version = 9.0.2.798, OC4J Application Server version = Oracle9iAS (9.0.2.0.0))
    I am trying to debug a multi-tier application using the embedded application server. Servlets and EJBs within that application need to call EJBs contained within a second application (Horus).
    I have set up the embedded application server to run this second application automatically by adding the following entry into its server.xml
    <application auto-start="true" name="Horus" path="M:\Studio\build\production\java\Server\Obfuscate\J2EE_HOME\Horus\Horus.xml"/>
    I then start the embedded application server by debugging my servlet project, 'intermediateServlet'. I know the second application is running correctly in the embedded application server because I can access it from a separate client.
    In the 'intermediateServlet', I want to obtain a reference to a Dispatcher EJB held in the Horus application. This EJB has the following properties
         ejb-name     = com.internal.server.Dispatcher
         home interface     = com.internal.server.DispatcherHome
         bean class     = com.internal.server.DispatcherEJB
         remote interface= com.internal.server.Dispatcher
    The following code is executed during the container's call to my servlet init( context ) method to try and get the appropriate home interface.
    Context context = null;
    Object tempRemoteIF1 = null;
    Object tempRemoteIF2 = null;
    Properties h = null;
    h = new Properties();
    h.put( Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory" );
    h.put( Context.PROVIDER_URL, "ormi://127.0.0.1:23891/Horus");
    h.put( Context.SECURITY_PRINCIPAL, "user0" );
    h.put( Context.SECURITY_CREDENTIALS, "password" );
    context = new InitialContext (h);
    tempRemoteIF1 = context.lookup( "com.internal.server.Dispatcher" );
    tempRemoteIF2 = javax.rmi.PortableRemoteObject.narrow
    tempRemoteIF1,
    Class.forName( "com.internal.server.DispatcherHome" )
    The context.lookup call seems to work fine, returning an object of the class
         DispatcherHome_StatelessSessionHomeWrapper5
    Which I presume is a containter generated class implementing the home interface. To help confirm this,
    the object has a property beanName that has the value "com.internal.server.Dispatcher".
    The problem occurs on the next line, when I check whether I can cast the object to the home interface using ProtableRemoteObject.narrow(). This gives the following exception.
    java.lang.ClassCastException
         java.lang.Object com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(java.lang.Object, java.lang.Class)
              PortableRemoteObject.java:296
         java.lang.Object javax.rmi.PortableRemoteObject.narrow(java.lang.Object, java.lang.Class)
              PortableRemoteObject.java:137
         com.internal.server.Dispatcher com.Studio.servlet.intermediateServlet.getDispatcherRef(java.lang.String, java.lang.String, java.lang.String)
              intermediateServlet.java:601
         void com.Studio.servlet.intermediateServlet.init(javax.servlet.ServletConfig)
              intermediateServlet.java:150
         com.evermind.server.http.ServletInstanceInfo com.evermind.server.http.HttpApplication.loadServlet(com.evermind.util.ByteString)
              HttpApplication.java:1669
         com.evermind.server.http.ServletInstanceInfo com.evermind.server.http.HttpApplication.findServlet(com.evermind.util.ByteString)
              HttpApplication.java:4001
         javax.servlet.RequestDispatcher com.evermind.server.http.HttpApplication.getRequestDispatcher(com.evermind.util.ByteString, com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse)
              HttpApplication.java:2200
         boolean com.evermind.server.http.HttpRequestHandler.processRequest(com.evermind.server.ApplicationServerThread, com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse, java.io.InputStream, java.io.OutputStream, boolean)
              HttpRequestHandler.java:580
         void com.evermind.server.http.HttpRequestHandler.run(java.lang.Thread)
              HttpRequestHandler.java:243
         void com.evermind.util.ThreadPoolThread.run()
              ThreadPoolThread.java:62
    Interestingly, if I use practically the same code, to obtain the home interface of an EJB that is defined in the application that I am debugging, the cast works perfectly. The returned object looks identical, apart from the name to the DispatcherHome_StatelessSessionHomeWrapper5 mentioned above.
    Could the error possibly be because I need to declare 'Horus' as a parent application of the application I am debugging? If it is how do I do this?
    Many thanks in advance for any help with this one.
    Mark.

    (Jdeveloper version = 9.0.2.798, OC4J Application Server version = Oracle9iAS (9.0.2.0.0))
    I am trying to debug a multi-tier application using the embedded application server. Servlets and EJBs within that application need to call EJBs contained within a second application (Horus).
    I have set up the embedded application server to run this second application automatically by adding the following entry into its server.xml
    <application auto-start="true" name="Horus" path="M:\Studio\build\production\java\Server\Obfuscate\J2EE_HOME\Horus\Horus.xml"/>
    I then start the embedded application server by debugging my servlet project, 'intermediateServlet'. I know the second application is running correctly in the embedded application server because I can access it from a separate client.
    In the 'intermediateServlet', I want to obtain a reference to a Dispatcher EJB held in the Horus application. This EJB has the following properties
         ejb-name     = com.internal.server.Dispatcher
         home interface     = com.internal.server.DispatcherHome
         bean class     = com.internal.server.DispatcherEJB
         remote interface= com.internal.server.Dispatcher
    The following code is executed during the container's call to my servlet init( context ) method to try and get the appropriate home interface.
    Context context = null;
    Object tempRemoteIF1 = null;
    Object tempRemoteIF2 = null;
    Properties h = null;
    h = new Properties();
    h.put( Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory" );
    h.put( Context.PROVIDER_URL, "ormi://127.0.0.1:23891/Horus");
    h.put( Context.SECURITY_PRINCIPAL, "user0" );
    h.put( Context.SECURITY_CREDENTIALS, "password" );
    context = new InitialContext (h);
    tempRemoteIF1 = context.lookup( "com.internal.server.Dispatcher" );
    tempRemoteIF2 = javax.rmi.PortableRemoteObject.narrow
    tempRemoteIF1,
    Class.forName( "com.internal.server.DispatcherHome" )
    The context.lookup call seems to work fine, returning an object of the class
         DispatcherHome_StatelessSessionHomeWrapper5
    Which I presume is a containter generated class implementing the home interface. To help confirm this,
    the object has a property beanName that has the value "com.internal.server.Dispatcher".
    The problem occurs on the next line, when I check whether I can cast the object to the home interface using ProtableRemoteObject.narrow(). This gives the following exception.
    java.lang.ClassCastException
         java.lang.Object com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(java.lang.Object, java.lang.Class)
              PortableRemoteObject.java:296
         java.lang.Object javax.rmi.PortableRemoteObject.narrow(java.lang.Object, java.lang.Class)
              PortableRemoteObject.java:137
         com.internal.server.Dispatcher com.Studio.servlet.intermediateServlet.getDispatcherRef(java.lang.String, java.lang.String, java.lang.String)
              intermediateServlet.java:601
         void com.Studio.servlet.intermediateServlet.init(javax.servlet.ServletConfig)
              intermediateServlet.java:150
         com.evermind.server.http.ServletInstanceInfo com.evermind.server.http.HttpApplication.loadServlet(com.evermind.util.ByteString)
              HttpApplication.java:1669
         com.evermind.server.http.ServletInstanceInfo com.evermind.server.http.HttpApplication.findServlet(com.evermind.util.ByteString)
              HttpApplication.java:4001
         javax.servlet.RequestDispatcher com.evermind.server.http.HttpApplication.getRequestDispatcher(com.evermind.util.ByteString, com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse)
              HttpApplication.java:2200
         boolean com.evermind.server.http.HttpRequestHandler.processRequest(com.evermind.server.ApplicationServerThread, com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse, java.io.InputStream, java.io.OutputStream, boolean)
              HttpRequestHandler.java:580
         void com.evermind.server.http.HttpRequestHandler.run(java.lang.Thread)
              HttpRequestHandler.java:243
         void com.evermind.util.ThreadPoolThread.run()
              ThreadPoolThread.java:62
    Interestingly, if I use practically the same code, to obtain the home interface of an EJB that is defined in the application that I am debugging, the cast works perfectly. The returned object looks identical, apart from the name to the DispatcherHome_StatelessSessionHomeWrapper5 mentioned above.
    Could the error possibly be because I need to declare 'Horus' as a parent application of the application I am debugging? If it is how do I do this?
    Many thanks in advance for any help with this one.
    Mark. Try loading the home interface from the same classloader used to load the the returned home object.
    tempRemoteIF2 = javax.rmi.PortableRemoteObject.narrow
    ( tempRemoteIF1,
    tempRemoteIF1.getClass().getClassLoader().loadClass("com.internal.server.DispatcherHome" )
    Dhiraj

  • Class casting problems in JSP's

    Folks,
              Several people, including myself, have written about the problems they
              ran into when trying to cast a class in JSP's. The following link might
              provide the answer:
              http://www.weblogic.com/docs51/classdocs/API_jsp.html#sessions
              I believe this is a major limitation Weblogic put on web app
              development, and hope BEA would eventually find a way to allow non-user
              defined types being stored in servlet sessions.
              Jeff
              

    Folks,
              Several people, including myself, have written about the problems they
              ran into when trying to cast a class in JSP's. The following link might
              provide the answer:
              http://www.weblogic.com/docs51/classdocs/API_jsp.html#sessions
              I believe this is a major limitation Weblogic put on web app
              development, and hope BEA would eventually find a way to allow non-user
              defined types being stored in servlet sessions.
              Jeff
              

  • 10gr2 TABLE(CAST( problem

    We have an existing report that uses existing function to table cast back data in the from clause. A very simplified example:
    FROM grant g, grantparticipant gt, table(cast(getSchedule(g.grant_pk, gt.grantparticipant_pk) as r_sched)) sched
    where g.grant_pk = gt.grant_fk
    and sched.grantparticipant_pk = gt.grantparticipant_pk
    The grantparticipant_pk is NULL when captured in the function. There are no null values in the table (it's a primary key). When the where clause is changed to reference a specific pk it works fine and the value is filled in.
    The works in our production db where the Oracle version is 10g. It works in development which is also 10g. The problem only appears to be with our 10gr2 DB.
    Any ideas....

    The problem was solved with ANSI JOINs. Would still like to know why that problem occurred?

  • Shareable object interface cast problem

    Hi,
    I'm a student working on building a shareable object interface between two applets namely "EWallet" and "EPhone".
    I currently use the javacard 2.2.X version and I mean to solve the shareable object interface in this version.
    Thus not with servlets in 3.X.X.
    The current problem I'm facing is the casting from the base type of shareable interface objects (Shareable) to the EWalletInterface which I need to do operations on the SIO of EWallet.
    The code snippet of the EWallet applet (server)
    public void verify(byte[] pincode) {
    if ( pin.check(pincode, (short)0,(byte)(short)pincode.length) == false )
    ISOException.throwIt(SW_VERIFICATION_FAILED);
    public void debit(byte debitAmount) {
    if (!pin.isValidated())
    ISOException.throwIt(SW_PIN_VERIFICATION_REQUIRED);
    // check debit amount
    if ((debitAmount > MAX_TRANSACTION_AMOUNT) || (debitAmount < 0))
    ISOException.throwIt(SW_INVALID_TRANSACTION_AMOUNT);
    // check the new balance
    if ((short)(balance - debitAmount) < (short)0)
    ISOException.throwIt(SW_NEGATIVE_BALANCE);
    balance = (short)(balance - debitAmount);
    public Shareable getShareableInterfaceObject(AID client_aid, byte parameter){
    byte[] ephone_aid_bytes = {(byte)0X15, (byte)0XEF, (byte)0X4D, (byte)0X55, (byte)0X86, (byte)0X60};
    if(client_aid.equals(ephone_aid_bytes,(short)0,(byte)ephone_aid_bytes.length) == false)
    return null;
    if(parameter != (byte)0x01)
    return null;
    return this;
    The code snippet of the EPhone applet (client)
    //Helper method
    private void makeBankcardDebit(short amount){
    AID ewallet_aid = JCSystem.lookupAID(ewallet_aid_bytes,(short)0,(byte)ewallet_aid_bytes.length);
    if(ewallet_aid == null)
    ISOException.throwIt(SW_EWALLET_AID_NOT_EXIST);
    //Error with casting from Shareable to EWalletInterface
    EWalletInterface sio = (EWalletInterface)(JCSystem.getAppletShareableInterfaceObject(ewallet_aid, (byte)0x01));
    if(sio == null)
    ISOException.throwIt(SW_FAILED_TO_OBTAIN_SIO);
    byte[] pin = new byte[4];
    sio.verify(pin);
    sio.debit((byte)amount);
    this.balance = (short)(this.balance + amount);
    The EWalletInterface code snippet
    public interface EWalletInterface extends Shareable {
    public void verify(byte[] pincode);
    public void debit(byte amount);
    The interface is currently both in the EWallet and EPhone packages.
    The problem i'm facing is that in the code snippet of EPhone.
    The "lookupAID"- and "getAppletShareableInterfaceObject"-methods work
    The casting from Shareable to EWalletInterface gives me status word 0x6F00 which presents me with a google explanation of "No precise diagnosis".
    Does anyone have an idea why the cast from Shareable to EWalletInterface doesn't work?
    Thanks in advance,
    Jeroen

    Hi,
    What happens if you get the SOI reference and store in a Shareable and see if it is null? Just to confirm, the two applets are in different packages and the server applet has be installed and is selectable?
    If you get 0x6F00, you should start adding try/catch blocks to find the root cause.
    Cheers,
    Shane
    =================================
    Reposting with &#123;code} tags
    =================================
    Hi,
    I'm a student working on building a shareable object interface between two applets namely "EWallet" and "EPhone".
    I currently use the javacard 2.2.X version and I mean to solve the shareable object interface in this version.
    Thus not with servlets in 3.X.X.
    The current problem I'm facing is the casting from the base type of shareable interface objects (Shareable) to the EWalletInterface which I need to do operations on the SIO of EWallet.
    The code snippet of the EWallet applet (server)
        public void verify(byte[] pincode) {
            if ( pin.check(pincode, (short)0,(byte)(short)pincode.length) == false )
                ISOException.throwIt(SW_VERIFICATION_FAILED);
        public void debit(byte debitAmount) {
            if (!pin.isValidated())
                ISOException.throwIt(SW_PIN_VERIFICATION_REQUIRED);
            // check debit amount
            if ((debitAmount > MAX_TRANSACTION_AMOUNT) || (debitAmount < 0))
               ISOException.throwIt(SW_INVALID_TRANSACTION_AMOUNT);
            // check the new balance
            if ((short)(balance - debitAmount) < (short)0)
                 ISOException.throwIt(SW_NEGATIVE_BALANCE);
            balance = (short)(balance - debitAmount);
        public Shareable getShareableInterfaceObject(AID client_aid, byte parameter){
            byte[] ephone_aid_bytes = {(byte)0X15, (byte)0XEF, (byte)0X4D, (byte)0X55, (byte)0X86, (byte)0X60};
            if(client_aid.equals(ephone_aid_bytes,(short)0,(byte)ephone_aid_bytes.length) == false)
                return null;
            if(parameter != (byte)0x01)
                return null;
            return this;
    The code snippet of the EPhone applet (client)
       //Helper method
        private void makeBankcardDebit(short amount){
            AID ewallet_aid = JCSystem.lookupAID(ewallet_aid_bytes,(short)0,(byte)ewallet_aid_bytes.length);
            if(ewallet_aid == null)
               ISOException.throwIt(SW_EWALLET_AID_NOT_EXIST);
            //Error with casting from Shareable to EWalletInterface
            EWalletInterface sio = (EWalletInterface)(JCSystem.getAppletShareableInterfaceObject(ewallet_aid, (byte)0x01));
            if(sio == null)
              ISOException.throwIt(SW_FAILED_TO_OBTAIN_SIO);
            byte[] pin = new byte[4];
            sio.verify(pin);
            sio.debit((byte)amount);
            this.balance = (short)(this.balance + amount);
    The EWalletInterface code snippet
        public interface EWalletInterface extends Shareable {
            public void verify(byte[] pincode);
            public void debit(byte amount);
        }The interface is currently both in the EWallet and EPhone packages.
    The problem i'm facing is that in the code snippet of EPhone.
    The "lookupAID"- and "getAppletShareableInterfaceObject"-methods work
    The casting from Shareable to EWalletInterface gives me status word 0x6F00 which presents me with a google explanation of "No precise diagnosis".
    Does anyone have an idea why the cast from Shareable to EWalletInterface doesn't work?
    Thanks in advance,
    Jeroen

  • Magenta color cast problem on canon 7d raw files

    when i import canon raw files (cr2) into lightroom 3, i get a magenta color cast over the whole image. the thumbnail image looks fine, but when lightroom opens up the image, it get's a magenta color cast over the whole thing. i shot raw+jpeg mode too, and there's a huge differnce in color between the two. the jpeg looks like how i shot it in camera but the raw image has the ugly magenta color. not only do i get this ugly color, but it seems like there's added noise compared to jpeg image.
    i tried converting the cr2 into a dng. but when i open that in lightroom, i get the same problem.
    i use aperture 2.1 (i only use the lr3 trial so far), but i have the same problem there.
    i use cs3 but i downloaded cs5 trial.
    acr i have is 6.1
    help.
    thanks.

    Go to develop and the callibration tab and change it in the pull down menu to a canon default like 'Neutral' and not the adobe one which is made by somebody totally colour blind or obviously a Nikon fan.
    Although this is weird as the problem for me has always been canon JPG's with the cast and not the RAW.
    Also check your white balance cause Lightroom seems to change it whatever..  'AS SHOT' is a big fat Adobe lie so use a preset from your camera in the drop down box.. Why?  I shoot with Canon's flash WB setting which i know to be 5500k with the tint at zero.  On import, Lightroom changes it to 6150 and adds an amazing +7 on the magenta tint, if i chose 'FLASH' things suddenly turn to what i see on the camera LCD..  I'm sure that is where the big fat tint has come from since day one.

  • Generic Observer - Casting problems..

    I'm trying to make a generic observer pattern, modeled after Wadler's book.
    But I get type errors at the lines marked with ?? below, and although I fixed them, don't understand why the original code is wrong - any help please!
    interface Observer<S extends Observable<S,O,A>,
                           O extends Observer  <S,O,A>,
                           A > {
         public void update ( S subject, A arg);
         // public void update ( Observable<S,O,A> subject, A arg);
    abstract class Observable<S extends Observable<S,O,A>,
                                 O extends Observer  <S,O,A>,
                                 A > {
         List<Observer<S,O,A>> obs = new ArrayList<Observer<S,O,A>>();
         boolean changed = false;
        public void          notifyObservers(A a){
             // for ( O o : obs )            // ??
             //    o.update(this,a);          // ??
             for ( Observer<S,O,A> o : obs )
                  o.update((S)this,a );     // Cast??
    }

    Stephan,
    To illustrate the problem with your version and a client;
    The type TestObsGen must implement the inherited abstract method Observer<Thing,TestObsGen,Integer>.update(Observable<Thing,TestObsGen,Integer>, Integer)
    Any insights welcome!
    public interface Observer<
         S extends Observable<S, O, A>,
         O extends Observer<S, O, A>,
         A> {
        public void update(Observable<S, O, A> subject, A arg);
    abstract class Observable<
                   S extends Observable<S, O, A>,
                   O extends Observer<S, O, A>,
                   A> {
        List<Observer<S, O, A>> obs = new ArrayList<Observer<S, O, A>>();
        boolean changed = false;
        public void notifyObservers(A a) {
            for (Observer<S, O, A> o : obs)
                o.update(this, a);
    public class TestObsGen
         implements Observer< Thing, TestObsGen, Integer >
         Thing thing;
         TestObsGen ( Thing t ) {
              thing = t;
              // t.addObserver(this);
         void update(Thing t, Integer count) {
              System.out.println("Count:" + count);
         public static void main(String[] args) {
              Thing t = new Thing();
              TestObsGen test = new TestObsGen(t);
              t.bump();
              // Event received?!
    class Thing
         extends Observable< Thing, TestObsGen, Integer >
         int count;
         void bump() {
              count++;
              // setChanged();
              // notifyObservers();
    }

Maybe you are looking for

  • Error in Layout

    Hi all, I have a problem with my application. The layout of the page is incorrect displayed. For example I have a report in column 2 of a page but this report is strange to say shown five times on the page. Also a before working SELECT-Statement fail

  • Vf01 issue

    Dear experts,      When I try to create billing doc. in  T_code VF01(Create Billing Document) by giving the document no, i am getting the error message "No billing document were generated.see log".   In log file two error message is displayed. 1.The

  • Error rep-1352

    Problem : REP-1352: The fonts specified for this report cannot be found for the character set specified by NLS_LANG. Secene : I am getting this runtime error after 3 years of usage only in a particular client. (This report works fine with other clien

  • Ios 5.1.1 has camera problems?

    I just updated my iphone 3gs to ios 5.1.1 and it seems that my camera is not working now... what would be the problem.. pls help me on this. I really need my camera back!

  • What else in logical backups

    Hi, DBA Professionals, If i take logical backup of full database, what else in the database to take backup. is this logical backup will take only logical data or physical data? if it takes logical only then what about row=y and what is difference bet