Search code examples
tomcatweblogiccxfcode-firstjaxb2

CXF tomcat 8 weblogic java.util.Map is an interface, and JAXB can't handle interfaces


I am actuallay work on a projet based on spring 3.2.8 and cxf 2.7.11 and run on weblogic 12.1 (JDK 1.7.0_21) and tomcat 8. Webservices are code in code first with CXF annotations.

When I try to run my web app on weblogic or on Tomcat, I get this exception :

Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions java.util.Map is an interface, and JAXB can't handle interfaces. this problem is related to the following location: at java.util.Map at private java.util.Map fr.grdf.distribution.ws.interfaces.metier.approvisionnement.jaxws_asm.GetEotpCodeArticleByZddResponse._return at fr.grdf.distribution.ws.interfaces.metier.approvisionnement.jaxws_asm.GetEotpCodeArticleByZddResponse

On weblogic, I just have to configure the classpath with thoses lines in weblogic.xml configuration file and everything works fine :

<prefer-application-packages> <package-name>org.apache.cxf.*</package-name> </prefer-application-packages>

But on tomcat, I am stuck on this error. The only difference in classpath between tomcat webapp and weblogic webapp is the add of asm-3.3.1.jar for tomcat (I get a "java.lang.NoClassDefFoundError": org/objectweb/asm/ClassWriter execption)

Is anybody have an idea?

Thanks in advance

Webservice end point :

@WebService
@GZIP
public interface IApproLogWebService {
@WebMethod
Map<Long, String> getEotpCodeArticleByZdd(@WebParam(name = "articles") List<ArticleFicheApproLog> articles,
    @WebParam(name = "zdd") Zdd zdd)

Solution

  • I solve the problem by upgrading jabx-xjc from 2.2.1.1 version to 2.2.10-b140310.1920 version.

    Regards.