2011-02-23 22 views
5

Estoy tratando de crear un nuevo servicio web en Eclipse (de abajo hacia arriba, apache axis 1, tomcat 6), pero recibo advertencias antes del intento y luego un error.Java ClassCastException al generar WSDL en Eclipse?

error:

IWAB0398E Error in generating WSDL from Java: java.lang.ClassCastException: org.apache.axis.encoding.ser.BeanSerializer cannot be cast to org.apache.axis.encoding.Serializer 

Aquí es donde utilizar Serializable:

public class IntegrationUtils extends Utilities implements java.io.Serializable { 
    private static final long serialVersionUID = 7515033201857603982L; 

resumen de las advertencias: Muchas de las advertencias tienen que ver con las clases utilizadas por mi web clase de servicio que no tiene constructores predeterminados.

Estas son las advertencias:

The service class "net.abc.Indy.WebService.IntegrationUtils" does not comply to one or more requirements of the JAX-RPC 1.1 specification, and may not deploy or function correctly. 
The service class "net.abc.Indy.WebService.IntegrationUtils" does not comply to one or more requirements of the JAX-RPC 1.1 specification, and may not deploy or function correctly. 
    The field or property "headers" on the value type "org.apache.axis.AxisFault" used via the service class "net.abc.Indy.WebService.IntegrationUtils" has a data type, "java.util.ArrayList", that is not supported by the JAX-RPC 1.1 specification. Instances of the type may not serialize or deserialize correctly. Loss of data or complete failure of the Web service may result. 
    The field or property "cause" on the value type "java.rmi.RemoteException" used via the service class "net.abc.Indy.WebService.IntegrationUtils" has a data type, "java.lang.Throwable", that is not supported by the JAX-RPC 1.1 specification. Instances of the type may not serialize or deserialize correctly. Loss of data or complete failure of the Web service may result. 
    The field or property "noClasses" on the value type "org.apache.axis.description.TypeDesc" used via the service class "net.abc.Indy.WebService.IntegrationUtils" has a data type, "java.lang.Class", that is not supported by the JAX-RPC 1.1 specification. Instances of the type may not serialize or deserialize correctly. Loss of data or complete failure of the Web service may result. 
    The field or property "noObjects" on the value type "org.apache.axis.description.TypeDesc" used via the service class "net.abc.Indy.WebService.IntegrationUtils" has a data type, "java.lang.Object", that is not supported by the JAX-RPC 1.1 specification. Instances of the type may not serialize or deserialize correctly. Loss of data or complete failure of the Web service may result. 
    The field or property "propertyDescriptorMap" on the value type "org.apache.axis.description.TypeDesc" used via the service class "net.abc.Indy.WebService.IntegrationUtils" has a data type, "java.util.Map", that is not supported by the JAX-RPC 1.1 specification. Instances of the type may not serialize or deserialize correctly. Loss of data or complete failure of the Web service may result. 
    The field or property "type" on the value type "org.apache.axis.utils.BeanPropertyDescriptor" used via the service class "net.abc.Indy.WebService.IntegrationUtils" has a data type, "java.lang.Class", that is not supported by the JAX-RPC 1.1 specification. Instances of the type may not serialize or deserialize correctly. Loss of data or complete failure of the Web service may result. 
    The field or property "actualType" on the value type "org.apache.axis.utils.BeanPropertyDescriptor" used via the service class "net.abc.Indy.WebService.IntegrationUtils" has a data type, "java.lang.Class", that is not supported by the JAX-RPC 1.1 specification. Instances of the type may not serialize or deserialize correctly. Loss of data or complete failure of the Web service may result. 
    The field or property "javaType" on the value type "org.apache.axis.description.FieldDesc" used via the service class "net.abc.Indy.WebService.IntegrationUtils" has a data type, "java.lang.Class", that is not supported by the JAX-RPC 1.1 specification. Instances of the type may not serialize or deserialize correctly. Loss of data or complete failure of the Web service may result. 
    The field or property "headers" on the value type "org.apache.axis.AxisFault" used via the service class "net.abc.Indy.WebService.IntegrationUtils" has a data type, "java.util.ArrayList", that is not supported by the JAX-RPC 1.1 specification. Instances of the type may not serialize or deserialize correctly. Loss of data or complete failure of the Web service may result. 
    The field or property "cause" on the value type "java.rmi.RemoteException" used via the service class "net.abc.Indy.WebService.IntegrationUtils" has a data type, "java.lang.Throwable", that is not supported by the JAX-RPC 1.1 specification. Instances of the type may not serialize or deserialize correctly. Loss of data or complete failure of the Web service may result. 
    The value type "org.w3c.dom.Element" used via the service class "net.abc.Indy.WebService.IntegrationUtils" does not have a public default constructor. Chapter 5.4 of the JAX-RPC 1.1 specification requires a value type to have a public default constructor, otherwise a JAX-RPC 1.1 compliant Web service engine may be unable to construct an instance of the value type during deserialization. 
    The value type "org.w3c.dom.TypeInfo" used via the service class "net.abc.Indy.WebService.IntegrationUtils" does not have a public default constructor. Chapter 5.4 of the JAX-RPC 1.1 specification requires a value type to have a public default constructor, otherwise a JAX-RPC 1.1 compliant Web service engine may be unable to construct an instance of the value type during deserialization. 
    The value type "org.apache.axis.description.TypeDesc" used via the service class "net.abc.Indy.WebService.IntegrationUtils" does not have a public default constructor. Chapter 5.4 of the JAX-RPC 1.1 specification requires a value type to have a public default constructor, otherwise a JAX-RPC 1.1 compliant Web service engine may be unable to construct an instance of the value type during deserialization. 
    The value type "org.apache.axis.utils.BeanPropertyDescriptor" used via the service class "net.abc.Indy.WebService.IntegrationUtils" does not have a public default constructor. Chapter 5.4 of the JAX-RPC 1.1 specification requires a value type to have a public default constructor, otherwise a JAX-RPC 1.1 compliant Web service engine may be unable to construct an instance of the value type during deserialization. 
    The value type "org.apache.axis.description.FieldDesc" used via the service class "net.abc.Indy.WebService.IntegrationUtils" does not have a public default constructor. Chapter 5.4 of the JAX-RPC 1.1 specification requires a value type to have a public default constructor, otherwise a JAX-RPC 1.1 compliant Web service engine may be unable to construct an instance of the value type during deserialization. 

Gracias por cualquier ayuda!

+0

No puedo ayudarlo pero puede ayudar a otros si especifica qué versión de Axis está utilizando. –

+0

¿Hay alguna razón para usar la versión anterior del eje? El servidor –

+0

está desactualizado y el proyecto es demasiado grande para actualizarlo solo por esto :( – Garrett

Respuesta

0

Obtiene una excepción ClassCastException, siempre que tenga JAR duplicados o archivos JAR con los mismos archivos de clase. En tu caso, también podría ser una versión diferente de Axis. El problema generalmente ocurre cuando tu tomcat crea una instancia de una clase de eje y envía esta instancia a tu aplicación. Su aplicación en el otro lado puede usar sus propios frascos (empaquetados en su WAR o EAR). Y debido a la posibilidad de una jerarquía multi-cargador en un contenedor Web o Java EE, puede ejecutar diferentes aplicaciones web con sus propias versiones de archivos jar en el mismo servidor al mismo tiempo.

¿Pero cómo solucionarlo? Bueno, busca estas clases (que se muestran en el StackTrace) en todos los jar de tu tomcat y tu aplicación web y verifica, cuál se usa para crear instancias de Axis-Requests/-responses. La solución más fácil es eliminar el contenedor relevante de su aplicación web y compilar su código con el entorno de tiempo de ejecución de su jar (su tomcat). Si las versiones de tomcat-jar no son utilizables para su caso, intente parchear las jarras del servidor. Una solución alternativa puede ser una configuración diferente de su aplicación web/servidor para controlar los cargadores de clases.

Cuestiones relacionadas