1 2 3 Previous Next 31 Replies Latest reply on Nov 28, 2012 8:49 AM by ctomc Go to original post
      • 15. Re: Axis ClassCastException
        flp05

        I attached it to the orginal post.

         

        That is the class. The error occurs when I instantiate the class:

         

        MyClass = new MyClass();

         

        Then, I found out the error ocurring in line 62

        • 16. Re: Axis ClassCastException
          nickarls

          Does MyClass as ha no-args constructor? Can you do a Class.forName("MyClass").newInstance(); ?

          • 17. Re: Axis ClassCastException
            flp05

            Yes, same error when trying:

             

            Nicklas Karlsson wrote:

             

            Does MyClass as ha no-args constructor? Can you do a Class.forName("MyClass").newInstance(); ?

             

            This problably means that I have to change the way MyClass is deployed to the server, right?

            MyClass is part of a sub-project deployed as a jar to the lib folder.

             

             


            • 18. Re: Axis ClassCastException
              sfcoy

              If this:

               

              {code:java}

                  private static org.apache.axis.description.TypeDesc typeDesc =

                      new org.apache.axis.description.TypeDesc(MYCLASS.class, true);

              {code}

               

              is in your source base then it is most likely some old code generated from the WSDL using Axis tools.

               

              You should consider regenerating code from the WSDL using the JBoss toolset (wsconsume), or even the standard Java 6 JDK tools (wsimport).

              • 19. Re: Axis ClassCastException
                flp05

                You are right., and I know that. The code is old and was generated from "Apache Axis 1.3" in 2005.

                 

                Unfortunetely, an update is not an option (not my decision, but I have to fix it anyway).

                • 20. Re: Axis ClassCastException
                  sfcoy

                  OK,

                   

                  Then you must try and live with Axis.

                   

                  Is your app deployed as an EAR or a WAR?

                   

                  The exception shown in your original post smells of multiple copies of Axis being present. AFAIK, there are no Axis jars in a stock JBoss AS 7.x release.

                  • 21. Re: Axis ClassCastException
                    nickarls

                    And just in case, show a "jar tf" again and show which libs remain after your cleanup.

                    • 22. Re: Axis ClassCastException
                      flp05

                      Is deployed as an EAR.

                       

                      So, here what's I know so far:

                       

                      With the axis.jar deployed with the project I receive the following error:

                                          "java.lang.ClassCastException: org.apache.axis.attachments.AttachmentsImpl cannot be cast to org.apache.axis.attachments.Attachments"

                       

                      For all I collect, this error occurs because there is a conflict, which indicates duplicate libraries.

                       

                       

                      But, when I remove the axis jar, I get this error

                                           "ERROR - The method @ doesn't exists in the class @ or its execution is not allowed by reflect."

                       

                      which indicates that the class doesn't exists.

                       

                       

                      So, can i conclude that i can NOT remove axis jar, and there is another cause for the first error?

                      • 23. Re: Axis ClassCastException
                        ctomc

                        Hi,

                         

                        in attached zip you can find how axis packed as jboss module must look like.

                         

                        this is for version 1.4 which is compatibile with 1.3 but with less bugs

                         

                        if you open directory org/apache/axis/main you will find how it is defined.

                         

                        copy that module into jboss_home/modules

                         

                        then all you need to do is to add dependancy to global module "org.apache.axis" in your application, you can do that by using MANIFEST.MF or jboss-deployment-descriptor.xml

                         

                        more about this on Class Loading in AS7 - JBoss AS 7.1 - Project Documentation Editor

                         

                         

                        hope this  helps

                         

                         

                        --

                        tomaz

                        • 24. Re: Axis ClassCastException
                          sfcoy

                          Luís Oliveira wrote:

                           

                          Is deployed as an EAR.

                           

                          ...

                           

                          So, can i conclude that i can NOT remove axis jar, and there is another cause for the first error?

                          You have a second copy of Axis in your application, such as in the WAR module perhaps?

                          • 25. Re: Axis ClassCastException
                            flp05

                            Tomaz, I read the documentation you recomended, and I really thing that this is the correct answer to my original question, but the fact is, is not working. I still got the error:

                             

                               "ERROR - The method @ doesn't exists in the class @ or its execution is not allowed by reflect."

                             


                            Can I ask, why this library is defined as a second resource-root?

                                 <resource-root path="commons-discovery.jar" />

                            It's giving me a parse error

                            • 26. Re: Axis ClassCastException
                              flp05

                              No Stephen, I don't.

                               

                              I have axis jar in the build path of multiple projects, but it is deployed only once, in the EAR project.

                               

                              Also, I check with "jar tf ear.EAR" and the axis.jar is not anywhere, besides the lib folder of course.

                              • 27. Re: Axis ClassCastException
                                nickarls

                                Tried taking it out and using a dep to the module Stephen provided?

                                • 28. Re: Axis ClassCastException
                                  sfcoy

                                  If this code

                                   

                                  {code:java}

                                      private static org.apache.axis.description.TypeDesc typeDesc =

                                          new org.apache.axis.description.TypeDesc(MYCLASS.class, true);

                                  {code}

                                   

                                  is in your EAR and MYCLASS.class is in your WAR then you will get a CNFE.

                                   

                                  The EAR/lib classloader is a parent to the WAR classloader, so it cannot see classes in web modules.

                                   

                                  And Tomaz deserves the credit for the Axis module implementation BTW.

                                  • 29. Re: Axis ClassCastException
                                    nickarls

                                    Stephen Coy wrote:

                                     

                                    And Tomaz deserves the credit for the Axis module implementation BTW.

                                     

                                    Oh yes, wrong d00d in sunglasses referenced ;-)