如何将Apache CXF Web服务部署到Glassfish [英] How to deploy Apache CXF webservice to Glassfish

查看:222
本文介绍了如何将Apache CXF Web服务部署到Glassfish的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Apache CXF生成和构建的Web服务客户端。接下来我有JAX-RS Jersey应用程序,我想从该webservice调用方法。当我尝试将这个简单的项目部署到Glassfish 4.0服务器时,我得到了以下异常:

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.

命令部署失败。

唯一我在这个项目中的一个CXF依赖是:

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>

是否还有其他与JSR 250兼容的CXF库?
谢谢

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

推荐答案

Glassfish面临的挑战之一是整个服务器配置文件与Metro for JAX一起打包 - WS Web服务和Jersey for JAX-RS休息服务。建议通过WAR的WEB-INF文件夹中包含的sun-web.xml文件配置类加载器。它应包括以下内容:

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>

过去,我发现偶尔会遇到部署问题;因此,我实际上已从Glassfish服务器配置文件中删除了Metro和Jersey功能。以下是有关部署的更多信息。

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

我注意到的另一件事是你发布了一条包含Jetty传输的日志消息。这意味着您正在运行Jetty HTTP服务器并运行Glassfish HTTP服务器。我建议只使用Glassfish作为Web服务器并使用CXF servlet传输。

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.

这篇关于如何将Apache CXF Web服务部署到Glassfish的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆