Forums de discussion

Axis ClassCast exception

Siby Mathew, modifié il y a 12 années.

Axis ClassCast exception

Expert Publications: 268 Date d'inscription: 04/03/11 Publications récentes
Hi all,
I am facing a strange problem with axis. Whenever my portlet is deployed I get the following error in CONSOLE :

org.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?
thumbnail
David H Nebinger, modifié il y a 12 années.

RE: Axis ClassCast exception

Liferay Legend Publications: 14915 Date d'inscription: 02/09/06 Publications récentes
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, modifié il y a 12 années.

RE: Axis ClassCast exception

Expert Publications: 268 Date d'inscription: 04/03/11 Publications récentes
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
thumbnail
David H Nebinger, modifié il y a 12 années.

RE: Axis ClassCast exception

Liferay Legend Publications: 14915 Date d'inscription: 02/09/06 Publications récentes
Then you're trying to pass an instance created in another class loader (i.e. the portal's class loader) to your portlet...
thumbnail
Mahdi Tilab, modifié il y a 11 années.

RE: Axis ClassCast exception

New Member Publications: 12 Date d'inscription: 02/03/08 Publications récentes
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.
thumbnail
Vaibhav Patil, modifié il y a 10 années.

RE: Axis ClassCast exception

Junior Member Publications: 30 Date d'inscription: 07/07/13 Publications récentes
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?
thumbnail
Vaibhav Patil, modifié il y a 10 années.

RE: Axis ClassCast exception

Junior Member Publications: 30 Date d'inscription: 07/07/13 Publications récentes
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?
thumbnail
manish kumar, modifié il y a 6 années.

RE: Axis ClassCast exception org.apache.axis.deployment.wsdd.WSDDException

Junior Member Publications: 31 Date d'inscription: 06/06/17 Publications récentes
org.apache.axis.deployment.wsdd.WSDDException: java.lang.ClassCastException: org.apache.axis.encoding.ser.BeanSerializerFactory cannot be cast to org.apache.axis.encoding.SerializerFactory
java.lang.ClassCastException: org.apache.axis.encoding.ser.BeanSerializerFactory cannot be cast to org.apache.axis.encoding.SerializerFactory
at org.apache.axis.encoding.ser.BaseSerializerFactory.createFactory(BaseSerializerFactory.java:277)
at org.apache.axis.deployment.wsdd.WSDDService.deployTypeMapping(WSDDService.java:542)
at org.apache.axis.deployment.wsdd.WSDDService.initTMR(WSDDService.java:253)
at org.apache.axis.deployment.wsdd.WSDDService.<init>(WSDDService.java:233)
at org.apache.axis.deployment.wsdd.WSDDDeployment.<init>(WSDDDeployment.java:192)
at org.apache.axis.deployment.wsdd.WSDDDocument.setDocument(WSDDDocument.java:139)
at org.apache.axis.deployment.wsdd.WSDDDocument.<init>(WSDDDocument.java:65)
at org.apache.axis.configuration.FileProvider.configureEngine(FileProvider.java:179)
at org.apache.axis.AxisEngine.init(AxisEngine.java:172)
at org.apache.axis.AxisEngine.<init>(AxisEngine.java:156)
at org.apache.axis.server.AxisServer.<init>(AxisServer.java:88)
at org.apache.axis.server.DefaultAxisServerFactory.createServer(DefaultAxisServerFactory.java:109)
at org.apache.axis.server.DefaultAxisServerFactory.getServer(DefaultAxisServerFactory.java:73)
at org.apache.axis.server.AxisServer.getServer(AxisServer.java:73)
at org.apache.axis.transport.http.AxisServletBase.getEngine(AxisServletBase.java:185)
at org.apache.axis.transport.http.AxisServletBase.getOption(AxisServletBase.java:396)
at org.apache.axis.transport.http.AxisServletBase.init(AxisServletBase.java:112)
at org.apache.axis.transport.http.AxisServlet.init(AxisServlet.java:156)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
at com.liferay.util.axis.AxisServlet.doInit(AxisServlet.java:230)
at com.liferay.util.axis.AxisServlet$InitThread.run(AxisServlet.java:315)




I tried your solution but did not get rid off my issue. Actually when ever i m deleting axis.jar from root/web-inf of tomcat , getting child failed during stop the server, i m not getting exact clarification however this url is working for me http://localhost:8080/api/jsonws?contextPath=/addMe-portlet
but when i tried to run this http://localhost:8080/addMe-portlet/api/axis/Plugin_addMe_DeviceService?wsdl url , will not work at all only blank page will come.This is regarding making public url for a service method.
kindly please help me out, i m fade up with this recurring error.
thumbnail
Vaibhav Patil, modifié il y a 10 années.

RE: Axis ClassCast exception

Junior Member Publications: 30 Date d'inscription: 07/07/13 Publications récentes
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.
thumbnail
Hitoshi Ozawa, modifié il y a 12 années.

RE: Axis ClassCast exception

Liferay Legend Publications: 7942 Date d'inscription: 24/03/10 Publications récentes
Yes, just move the jar file to Tomcat's \lib\ext folder.
Siby Mathew, modifié il y a 12 années.

RE: Axis ClassCast exception

Expert Publications: 268 Date d'inscription: 04/03/11 Publications récentes
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.
thumbnail
David H Nebinger, modifié il y a 12 années.

RE: Axis ClassCast exception

Liferay Legend Publications: 14915 Date d'inscription: 02/09/06 Publications récentes
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, modifié il y a 12 années.

RE: Axis ClassCast exception

Expert Publications: 268 Date d'inscription: 04/03/11 Publications récentes
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 :
java.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
thumbnail
David H Nebinger, modifié il y a 12 années.

RE: Axis ClassCast exception

Liferay Legend Publications: 14915 Date d'inscription: 02/09/06 Publications récentes
You're missing the other part - move axis.jar to <tomcat>/lib/ext and restart the server.
Siby Mathew, modifié il y a 12 années.

RE: Axis ClassCast exception

Expert Publications: 268 Date d'inscription: 04/03/11 Publications récentes
Yes David... I had already moved the axis.jar to <tomcat>/lib/ext folder...but somehow it doesn't help !
thumbnail
Hitoshi Ozawa, modifié il y a 12 années.

RE: Axis ClassCast exception

Liferay Legend Publications: 7942 Date d'inscription: 24/03/10 Publications récentes
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, modifié il y a 12 années.

RE: Axis ClassCast exception

Expert Publications: 268 Date d'inscription: 04/03/11 Publications récentes
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 ?
thumbnail
David H Nebinger, modifié il y a 12 années.

RE: Axis ClassCast exception

Liferay Legend Publications: 14915 Date d'inscription: 02/09/06 Publications récentes
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, modifié il y a 12 années.

RE: Axis ClassCast exception

Expert Publications: 268 Date d'inscription: 04/03/11 Publications récentes
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
thumbnail
David H Nebinger, modifié il y a 12 années.

RE: Axis ClassCast exception

Liferay Legend Publications: 14915 Date d'inscription: 02/09/06 Publications récentes
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, modifié il y a 12 années.

RE: Axis ClassCast exception

Expert Publications: 268 Date d'inscription: 04/03/11 Publications récentes
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
thumbnail
David H Nebinger, modifié il y a 12 années.

RE: Axis ClassCast exception

Liferay Legend Publications: 14915 Date d'inscription: 02/09/06 Publications récentes
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, modifié il y a 12 années.

RE: Axis ClassCast exception

Expert Publications: 268 Date d'inscription: 04/03/11 Publications récentes
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
thumbnail
David H Nebinger, modifié il y a 12 années.

RE: Axis ClassCast exception

Liferay Legend Publications: 14915 Date d'inscription: 02/09/06 Publications récentes
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.
thumbnail
Jatin Panchal, modifié il y a 11 années.

RE: Axis ClassCast exception

New Member Publications: 15 Date d'inscription: 26/07/10 Publications récentes
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
Wellington Carvalho, modifié il y a 5 années.

RE: Axis ClassCast exception

New Member Envoyer: 1 Date d'inscription: 10/04/19 Publications récentes
Really old thread, but I was with this problem right now, and if anyone else is, I solved it by removing axis.jar from tomcat/lib/ext.

The curious part is that it wasn't there initially, so maybe the full steps are:
- add axis.jar to tomcat/lib/ext, as well as to the deploy folder
- (re)start Liferay
- remove axis.jar from tomcat/lib/ext
- restart Liferay

​​​​​​​