BAS 4.5
  1. BAS 4.5 (2 messages)

    Hmmm this seems difficult to solve, Any Help!!!!

    The following code as part of a ojbect passed with a EJB remote interface.

    public class CardTypeUnion implements {
    private java.lang.object _object;
    private com.ejb.service.CartType _disc;

    public com.ejb.service.DS3DataType DS3DataType()
      if (_disc.equals(com.ejb.service.CardType.DS3_)) {
        return (com.ejb.service.DS3DataType) _object;
      throw new org.omg.CORBA.BAD_OPERATION("DS3DataType");


    When I invoke the DS3DataType() method it goes into a spiral the stack trace.

    java.lang.ClassCastException: com.ejb.service.DS3DataType
    at com.ejb.service.CardTypeUnion.DS3DataType(

    However I can return the _object without casting.

    Any help!!!


    Threaded Messages (2)

  2. BAS 4.5[ Go to top ]

    There might be a number of reasons, but I'll try running through a few so we can narrow down the problem:

    (1) The most common problem could be that the code you are using is in one archive (jar) while the EJB remote interface you are casting to is in another deployed archive. The solution here is to package them in one archive. You can use iastool.exe to merge the archives into one.
    (2) Your _object is the result of a lookup which you are attempting to cast to the required home interface type. The solution here is to use the PRO.narrow()

    What does the _object.getClass() return? And how are you initializing this variable?

    Your other recourse might be to contact Borland Support.

  3. BAS 4.5[ Go to top ]

    Thanks for the reply,

    I could not get it working, I sort to go with a work around and choose to have attributes for each object and forced the methods to return the specific object without casting.

    public class CardType {
    // java.lang.object _object;
    com.ejb.service.DS3 DS3=null;
    com.ejb.service.OC3 OC3=null;