-
15. Re: Axis ClassCastException
flp05 Nov 27, 2012 5:47 AM (in response to nickarls)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 Nov 27, 2012 5:55 AM (in response to flp05)Does MyClass as ha no-args constructor? Can you do a Class.forName("MyClass").newInstance(); ?
-
17. Re: Axis ClassCastException
flp05 Nov 27, 2012 6:17 AM (in response to nickarls)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 Nov 27, 2012 6:20 AM (in response to flp05)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 Nov 27, 2012 6:29 AM (in response to sfcoy)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 Nov 27, 2012 6:52 AM (in response to flp05)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 Nov 27, 2012 6:58 AM (in response to sfcoy)And just in case, show a "jar tf" again and show which libs remain after your cleanup.
-
22. Re: Axis ClassCastException
flp05 Nov 27, 2012 7:03 AM (in response to sfcoy)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 Nov 27, 2012 7:06 AM (in response to flp05)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
-
axis-module.zip 1.8 MB
-
-
24. Re: Axis ClassCastException
sfcoy Nov 27, 2012 7:11 AM (in response to flp05)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 Nov 27, 2012 9:10 AM (in response to ctomc)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 Nov 27, 2012 10:06 AM (in response to sfcoy)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 Nov 28, 2012 1:51 AM (in response to flp05)Tried taking it out and using a dep to the module Stephen provided?
-
28. Re: Axis ClassCastException
sfcoy Nov 28, 2012 2:44 AM (in response to flp05)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 Nov 28, 2012 2:55 AM (in response to sfcoy)Stephen Coy wrote:
And Tomaz deserves the credit for the Axis module implementation BTW.
Oh yes, wrong d00d in sunglasses referenced ;-)