How to deploy Apache CXF webservice to Glassfish
Asked Answered
P

1

6

I have a web service client generated and built with Apache CXF. Next I have JAX-RS Jersey application in which I want to call methods from that webservice. When I try to deploy this simple project to Glassfish 4.0 server I get this exception:

Exception while deploying the app [pelijee] :
The lifecycle method [finalizeConfig] must not throw a checked exception.
Related annotation information: annotation [@javax.annotation.PostConstruct()] on annotated element [public void org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.finalizeConfig() throws java.security.GeneralSecurityException,java.io.IOException] of type [METHOD]. Please see server.log for more details.

Command deploy failed.

The only one CXF dependency I have in this project is:

    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-bundle-jaxrs</artifactId>
        <version>2.7.6</version>
        <type>jar</type>
        <scope>runtime</scope>
    </dependency>

Is there any other CXF library compatible with JSR 250? Thank you

Putput answered 27/9, 2013 at 7:58 Comment(1)
issues.apache.org/jira/browse/CXF-5483 does this help?Exaggeration
F
0

One of the challenges of Glassfish is that the full server profile comes packaged with Metro for JAX-WS web services and Jersey for JAX-RS rest services. It is recommended to configure the classloader through a sun-web.xml file included in the WEB-INF folder of your WAR. It should include the following contents:

<?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>

In the past, I have found that occasionally I still have problems with deployment; therefore, I have actually removed the Metro and Jersey features altogether from the Glassfish server profile. Here is some more information about deployment.

http://cxf.apache.org/docs/application-server-specific-configuration-guide.html

One additional thing I noticed is that you posted a log message which included the Jetty transport. This means you are running the Jetty HTTP server and running the Glassfish HTTP server. I would suggest just using Glassfish as the web server and using the CXF servlet transport instead.

Florencio answered 16/11, 2014 at 14:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.