Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Axis ClassCast exception Siby Mathew March 14, 2012 8:14 AM
RE: Axis ClassCast exception David H Nebinger March 9, 2012 6:43 AM
RE: Axis ClassCast exception Siby Mathew March 9, 2012 7:25 AM
RE: Axis ClassCast exception David H Nebinger March 9, 2012 11:00 AM
RE: Axis ClassCast exception Mahdi Tilab November 13, 2012 3:34 AM
RE: Axis ClassCast exception Vaibhav Patil August 13, 2013 5:23 AM
RE: Axis ClassCast exception Vaibhav Patil August 13, 2013 6:14 AM
RE: Axis ClassCast exception Vaibhav Patil August 13, 2013 6:15 AM
RE: Axis ClassCast exception Hitoshi Ozawa March 10, 2012 2:58 AM
RE: Axis ClassCast exception Siby Mathew March 12, 2012 6:19 AM
RE: Axis ClassCast exception David H Nebinger March 12, 2012 5:12 AM
RE: Axis ClassCast exception Siby Mathew March 12, 2012 5:55 AM
RE: Axis ClassCast exception David H Nebinger March 12, 2012 6:03 AM
RE: Axis ClassCast exception Siby Mathew March 12, 2012 6:09 AM
RE: Axis ClassCast exception Hitoshi Ozawa March 12, 2012 2:38 PM
RE: Axis ClassCast exception Siby Mathew March 13, 2012 2:48 AM
RE: Axis ClassCast exception David H Nebinger March 13, 2012 6:47 AM
RE: Axis ClassCast exception Siby Mathew March 14, 2012 7:48 AM
RE: Axis ClassCast exception David H Nebinger March 14, 2012 7:57 AM
RE: Axis ClassCast exception Siby Mathew March 14, 2012 8:28 AM
RE: Axis ClassCast exception David H Nebinger March 14, 2012 8:38 AM
RE: Axis ClassCast exception Siby Mathew March 14, 2012 10:47 AM
RE: Axis ClassCast exception David H Nebinger March 14, 2012 12:00 PM
RE: Axis ClassCast exception Jatin Panchal October 9, 2012 4:26 AM
Siby Mathew
Axis ClassCast exception
March 14, 2012 8:14 AM
Answer

Siby Mathew

Rank: Expert

Posts: 261

Join Date: March 4, 2011

Recent Posts

Hi all,
I am facing a strange problem with axis. Whenever my portlet is deployed I get the following error in CONSOLE :

1org.apache.axis.deployment.wsdd.WSDDException: java.lang.ClassCastException: org.apache.axis.encoding.ser.BeanSerializerFactory cannot be cast to org.apache.axis.encoding.SerializerFactory


Althought this doesn't affect my functionality, I need to remove this exception

After some trial and error, I was able to remove this error by removing axis.jar from ROOT/WEB-INF/lib and keeping it only in
the portlet/WEB-INF/lib .

Obviously I cant go ahead and delete jars from ROOT/WEB-INF.
Can somebody explain this behaviour and give a workaround?
David H Nebinger
RE: Axis ClassCast exception
March 9, 2012 6:43 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 8603

Join Date: September 1, 2006

Recent Posts

Axis is used by portions of the portal so removing it from ROOT/WEB-INF/lib is not recommended.

The class cast exception is actually due to a class loader issue. In liferay-plugin-package.properties, you should have the portal dependency jars include the axis.jar (ensures the same version used by the portal is the same version of for the portlet).

Try this and see if the exception is resolved.
Siby Mathew
RE: Axis ClassCast exception
March 9, 2012 7:25 AM
Answer

Siby Mathew

Rank: Expert

Posts: 261

Join Date: March 4, 2011

Recent Posts

Hi David,
Thanks for your reply.
I dont have a separate axis.jar . I am already using the liferay-plugin-package.properties to add it during deployment.
Thats what makes the whole thing so strange !

Thanks,
Siby
David H Nebinger
RE: Axis ClassCast exception
March 9, 2012 11:00 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 8603

Join Date: September 1, 2006

Recent Posts

Then you're trying to pass an instance created in another class loader (i.e. the portal's class loader) to your portlet...
Hitoshi Ozawa
RE: Axis ClassCast exception
March 10, 2012 2:58 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7952

Join Date: March 23, 2010

Recent Posts

Yes, just move the jar file to Tomcat's \lib\ext folder.
Siby Mathew
RE: Axis ClassCast exception
March 12, 2012 6:19 AM
Answer

Siby Mathew

Rank: Expert

Posts: 261

Join Date: March 4, 2011

Recent Posts

Hi Hitoshi,
I am not getting any exception if I do the following :
keep axis.jar inside : tomcat/lib/ext folder and myPortlet/WEB-INF/lib

Remove axis.jar from : ROOT/WEB-INF/lib

If I dont keep axis.jar in myPortlet/WEB-INF/lib, I am getting classNotFoundException for AxisServlet.

Do you mean the same ?

Thanks,
Siby Mathew.
David H Nebinger
RE: Axis ClassCast exception
March 12, 2012 5:12 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 8603

Join Date: September 1, 2006

Recent Posts

If you move axis.jar to <tomcat>/lib/ext and then remove it from all portlet WEB-INF/lib folders and ROOT/WEB-INF/lib, the class cast exception will go away.

This is basically moving Axis to be a global jar, so the classes do not suffer from the war classloader issue.
Siby Mathew
RE: Axis ClassCast exception
March 12, 2012 5:55 AM
Answer

Siby Mathew

Rank: Expert

Posts: 261

Join Date: March 4, 2011

Recent Posts

Hi David,
Thanks for your reply. But as I mentioned before, if I remove the axis.jar from portlet WEB-INF/lib folder, I get the following error :
1java.lang.NoClassDefFoundError: Could not initialize class org.apache.axis.transport.http.AxisServlet


Does this have something to do with AxisServlet.java present inside util-java.jar

Thanks,
Siby
David H Nebinger
RE: Axis ClassCast exception
March 12, 2012 6:03 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 8603

Join Date: September 1, 2006

Recent Posts

You're missing the other part - move axis.jar to <tomcat>/lib/ext and restart the server.
Siby Mathew
RE: Axis ClassCast exception
March 12, 2012 6:09 AM
Answer

Siby Mathew

Rank: Expert

Posts: 261

Join Date: March 4, 2011

Recent Posts

Yes David... I had already moved the axis.jar to <tomcat>/lib/ext folder...but somehow it doesn't help !
Hitoshi Ozawa
RE: Axis ClassCast exception
March 12, 2012 2:38 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7952

Join Date: March 23, 2010

Recent Posts

am not getting any exception if I do the following :
keep axis.jar inside : tomcat/lib/ext folder and myPortlet/WEB-INF/lib

Remove axis.jar from : ROOT/WEB-INF/lib


So, can I assume that you've resolved the issue?
Siby Mathew
RE: Axis ClassCast exception
March 13, 2012 2:48 AM
Answer

Siby Mathew

Rank: Expert

Posts: 261

Join Date: March 4, 2011

Recent Posts

am not getting any exception if I do the following :
keep axis.jar inside : tomcat/lib/ext folder and myPortlet/WEB-INF/lib

Remove axis.jar from : ROOT/WEB-INF/lib

Hi Hitoshi,
The issue is resolved by the above method.
But my question is, is this the correct way ? Will it affect any other liferay in-built methods ?
David H Nebinger
RE: Axis ClassCast exception
March 13, 2012 6:47 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 8603

Join Date: September 1, 2006

Recent Posts

The only thing this does is move a jar from a web-app specific lib (in this case ROOT/WEB-INF/lib) to a global classpath (tomcat's lib/ext directory). The jar becomes globally accessible to all web apps, including Liferay and your portlet(s). It does not break anything, but forces each web app to use the same version of the jar (unless you include a special version in your portlet's WEB-INF/lib directory, and you'll probably face other issues doing that).
Siby Mathew
RE: Axis ClassCast exception
March 14, 2012 7:48 AM
Answer

Siby Mathew

Rank: Expert

Posts: 261

Join Date: March 4, 2011

Recent Posts

Hi all,
I just figured out the real problem :
The AxisServlet.java in util-java.jar was conflicting with the one in axis.jar.
I just removed this class from util-java and all errors have disappeared !

Thanks,
Siby
David H Nebinger
RE: Axis ClassCast exception
March 14, 2012 7:57 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 8603

Join Date: September 1, 2006

Recent Posts

How can they conflict? Specifying the axis servlet in the web.xml requires the full classpath of the servlet. Whether you're using the one from axis.jar or the one from util-java.jar, in either case you must have been specifying the version to use. And just because you're not using the one from util-java, doesn't mean that the rest of the liferay system isn't relying on that class to be available...

I wouldn't call this a solution by any means, as I suspect you've introduced other as yet undiscovered failures.
Siby Mathew
RE: Axis ClassCast exception
March 14, 2012 8:28 AM
Answer

Siby Mathew

Rank: Expert

Posts: 261

Join Date: March 4, 2011

Recent Posts

Hi David,
Thanks for your reply.
I got the relation with util-java.jar from the following post :
Axis based web services do not like client-config.wsdd in the util-java.jar

It talks about removing the wsdd file... but I could not make it work that way. However it worked when I removed AxisServlet.class. So I thought it might be a conflict.
Do you feel that it can be a bug related to util-java.jar

Note: I have removed the RESOLVED status.

Thanks,
Siby
David H Nebinger
RE: Axis ClassCast exception
March 14, 2012 8:38 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 8603

Join Date: September 1, 2006

Recent Posts

Sounds like the crux of your problem is that you don't have a client-config.wsdd in your project. I have a client-config.wsdd in mine and have no problems using another web service and the util-java one does not conflict in any way...
Siby Mathew
RE: Axis ClassCast exception
March 14, 2012 10:47 AM
Answer

Siby Mathew

Rank: Expert

Posts: 261

Join Date: March 4, 2011

Recent Posts

Hi David,
You are right. I dont have a client-config.wsdd.
Can you please tell me how to create the same ? How will it help ?
I do have a server-config.wsdd in my docroot/WEB-INF.

Thanks,
Siby
David H Nebinger
RE: Axis ClassCast exception
March 14, 2012 12:00 PM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 8603

Join Date: September 1, 2006

Recent Posts

http://www.oio.de/axis-wsdd/

The client-config.wsdd is used by Axis when you are creating a web service client. I know you're doing a service, but it could be that the values from the client-config.wsdd are somehow interfering w/ your service.

Oh, and your server-config.wsdd might need to be in the classes folder rather than just WEB-INF, but I don't know for sure.
Jatin Panchal
RE: Axis ClassCast exception
October 9, 2012 4:26 AM
Answer

Jatin Panchal

Rank: New Member

Posts: 15

Join Date: July 26, 2010

Recent Posts

Hi David,

I have same kind of functionality like you. I have exposed one service in my portlet and that portlet consumes other web-service which is separate plugin portlet.

During deployment of my portlet I got same error stack as mentioned earlier in this thread.

Can you provide me right solution.

Thanks,
Jatin Panchal
Mahdi Tilab
RE: Axis ClassCast exception
November 13, 2012 3:34 AM
Answer

Mahdi Tilab

Rank: New Member

Posts: 12

Join Date: March 2, 2008

Recent Posts

David H Nebinger:
Axis is used by portions of the portal so removing it from ROOT/WEB-INF/lib is not recommended.

The class cast exception is actually due to a class loader issue. In liferay-plugin-package.properties, you should have the portal dependency jars include the axis.jar (ensures the same version used by the portal is the same version of for the portlet).

Try this and see if the exception is resolved.



Thank you for your answer:

I added my dependecy in liferay-plugin-package.properties with portal-dependency-jars=axis.jar,jaxrpc.jar property.

and remove this jar from my portlet/WEB_INF/lib/ and deploy again.

and my issue resolved.
Vaibhav Patil
RE: Axis ClassCast exception
August 13, 2013 5:23 AM
Answer

Vaibhav Patil

Rank: Junior Member

Posts: 30

Join Date: July 7, 2013

Recent Posts

Mahdi Tilab:
David H Nebinger:
Axis is used by portions of the portal so removing it from ROOT/WEB-INF/lib is not recommended.

The class cast exception is actually due to a class loader issue. In liferay-plugin-package.properties, you should have the portal dependency jars include the axis.jar (ensures the same version used by the portal is the same version of for the portlet).

Try this and see if the exception is resolved.



Thank you for your answer:

I added my dependecy in liferay-plugin-package.properties with portal-dependency-jars=axis.jar,jaxrpc.jar property.

and remove this jar from my portlet/WEB_INF/lib/ and deploy again.

and my issue resolved.



We are facing same issue let us know steps of action to resolve this issue?
Vaibhav Patil
RE: Axis ClassCast exception
August 13, 2013 6:14 AM
Answer

Vaibhav Patil

Rank: Junior Member

Posts: 30

Join Date: July 7, 2013

Recent Posts

Vaibhav Patil:
Mahdi Tilab:
David H Nebinger:
Axis is used by portions of the portal so removing it from ROOT/WEB-INF/lib is not recommended.

The class cast exception is actually due to a class loader issue. In liferay-plugin-package.properties, you should have the portal dependency jars include the axis.jar (ensures the same version used by the portal is the same version of for the portlet).

Try this and see if the exception is resolved.



Thank you for your answer:

I added my dependecy in liferay-plugin-package.properties with portal-dependency-jars=axis.jar,jaxrpc.jar property.

and remove this jar from my portlet/WEB_INF/lib/ and deploy again.

and my issue resolved.



We are facing same issue let us know steps of action to resolve this issue?


hELLO,
pLEASE LET US KNOW HOW YOU RESOLVE THIS ISSUE?
Vaibhav Patil
RE: Axis ClassCast exception
August 13, 2013 6:15 AM
Answer

Vaibhav Patil

Rank: Junior Member

Posts: 30

Join Date: July 7, 2013

Recent Posts

Mahdi Tilab:
David H Nebinger:
Axis is used by portions of the portal so removing it from ROOT/WEB-INF/lib is not recommended.

The class cast exception is actually due to a class loader issue. In liferay-plugin-package.properties, you should have the portal dependency jars include the axis.jar (ensures the same version used by the portal is the same version of for the portlet).

Try this and see if the exception is resolved.



Thank you for your answer:

I added my dependecy in liferay-plugin-package.properties with portal-dependency-jars=axis.jar,jaxrpc.jar property.

and remove this jar from my portlet/WEB_INF/lib/ and deploy again.

and my issue resolved.



we are facing same issue we try same steps but not worked.