How to choose CXF over Metro on Glassfish

I have the following problem (reported there by someone else) when starting my corporate application under Glassfish. Jetty is working fine.

javax / xml / ws / spi / Provider mentions the creation of the META-INF / services / javax.xml.ws.spi.Provider resource, but it is already supplied with CXF and creating an additional resource file does not solve this problem in Glassfish.

Does anyone know how to ensure that CXF is selected under GlassFish?
(I am using the Maven Multi-modules project with CXF 2.2.5 dependency)

Thank!
Tim




EDIT NO. 1

Skip the problem for now and just work with Metro, but I would really like to know how to use CXF if anyone has pointers. If nothing works, I may need to switch the web application container (or look at Metro to fill in my requirements)




EDIT No. 2

Some solutions provide details on how to fix the war by adding <class-loader delegate="false"/> to the sun-web.xml file. However, this does not work for non-military ee applications.

+6
classpath jax-ws glassfish java-metro-framework cxf
Jan 14
source share
3 answers

Add sun-web.xml and set delegate = false for the loader class:

 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE sun-web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN' 'http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd'> <sun-web-app> <class-loader delegate="false"/> </sun-web-app> 
+5
Dec 09 '10 at 15:33
source share

Metro (JAX-WS Glassfish implementation) is probably included in Glassfish, can you exclude them from the class? Since you are using maven, you should analyze the dependencies in the glass phase and use the exception for metro cans.




It seems that you need to have CXF banks in the class of application classes in front of Metro banks. You probably can't change the system classloader / classpath, but you can change Thread.currentThread().getContextClassLoader() so that it loads CXF first. In addition, classpath parameters can be set in Glassfish, which you can change

Check the source javax.xml.ws.spi.FactoryFinder#find () to see how the provider is actually loaded

+1
Jan 14 '10 at 14:12
source share

The solution I came across (and not satisfied) is to use JaxWsProxyFactoryBean . There is an example [here]. 1 .

This is the essence of what you need to do:

 public static void main(String args[]) throws Exception { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); // I didn't need these next 2 calls, but I doubt they hurt factory.getInInterceptors().add(new LoggingInInterceptor()); factory.getOutInterceptors().add(new LoggingOutInterceptor()); factory.setServiceClass(AuthService.class); factory.setAddress("http://localhost:7001/authManager/services/cxfAuth"); // 'AuthService' is whatever your interface type is AuthService client = (AuthService) factory.create(); Employee employee = client.getEmployee("0223938"); System.out.println("Server said: " + employee.getLastName() + ", " + employee.getFirstName()); System.exit(0); } 
0
Aug 15 '11 at 10:21
source share



All Articles