2 Replies Latest reply on Jul 7, 2005 8:54 PM by Steven Peh

    Class Cast Exception-Weblogic to Jboss

    Vinaydath Shivaprasad Newbie

      I have the follwoing piece of code:

      InstanceId =
      (Integer)((TaskInstanceDoc) tiDoc).getTaskInstanceId();

      Here "InstanceId" is declared as an 'Integer', and "((TaskInstanceDoc) tiDoc).getTaskInstanceId()" returns an 'Object'.

      When this piece of code is run on Weblogic it works fine, but when run on Jboss it gives a ClassCastException.

      Can anybody tell me what is the difference in the way weblogic looks at the java code and the how does Jboss sees the same piece of code..

      We are facing a lot of such issues when porting application from Weblogic to Jboss.


        • 1. Re: Class Cast Exception-Weblogic to Jboss
          Daniel Hansen Newbie

          Just a thought but do you have the TaskInstanceDoc class in your JBoss classpath?

          Also, I'm going through a similar migration (WLS to JBoss) and was wondering if you had any documentation or resources that you could share?

          Anything to smooth the migration path would/will be greatly appreciated. Thanks in advance,

          • 2. Re: Class Cast Exception-Weblogic to Jboss
            Steven Peh Newbie

            Heh, just for your info, the class loading architecture is *different* from JBoss and Weblogic. I'd suggest you read the wiki in JBoss regarding their class loader design.

            One cause for ClassCastException is when your app is loading the class from another application (i.e. a jar file from another independantly deployed ear/war). Although the class is the same, it is not from the same class loader as your app, hence Java will not allow you to cast it.

            Good luck in your porting.