Search code examples
jax-wscxfclassloader

classloaders with cxf and jax-ws


in Difference between JAX-WS, Axis2 and CXF Daniel wrote

And for the most part, if you start with the in-jdk JAX-WS impl, you can drop in CXF at any time and it would still work.

  1. Can this behave differently with different application/web servers eg jboss vs tomcat?
  2. Does it depends on classloaders, how ?
  3. Classloader will load first encountered implementation ?
  4. Won't it lead to conflicts - some classes taken from in-jdk, some from cxf ?

Solution

  • I suppose that, deducting from your questions, you want to use Apache CXF. In reply to your questions:

    1. For some particular application server, you need to specify some additional configuration. See Application Server Specific Configuration Guide.

    2. Of course. The default behavior is most application server is load classes of the server first, then the classes in the module. Therefore Apache CXF may not work.

    3. Yes. e.g. By default, Glassfish will use Metro for JAX-WS services so the classloader needs to be configured to allow CXF libraries to provide JAX-WS services.

    4. If the classloader is configured properly, there will be no problems.

    See also: