我有一个用Apache CXF生成和构建的web服务客户端。接下来,我有一个JAX-RS Jersey应用程序,我想在其中调用JAX服务中的方法。当我试图将这个简单的项目部署到Glassfish 4.0服务器上时,我得到了这个异常:
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.命令deploy失败。
我在这个项目中唯一有一个CXF依赖项是:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle-jaxrs</artifactId>
<version>2.7.6</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>有没有其他与JSR250兼容的CXF库?谢谢
发布于 2014-11-16 22:07:31
Glassfish的挑战之一是,完整的服务器配置文件与用于JAX- web服务的Metro和用于JAX-RS rest服务的Jersey打包在一起。建议通过WAR的WEB-INF文件夹中包含的sun-web.xml文件配置类加载器。它应该包括以下内容:
<?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功能。以下是有关部署的更多信息。
http://cxf.apache.org/docs/application-server-specific-configuration-guide.html
我注意到的另一件事是,您发布了一条日志消息,其中包含Jetty传输。这意味着您正在运行Jetty HTTP服务器和Glassfish HTTP服务器。我建议只使用Glassfish作为web服务器,并使用CXF servlet传输。
https://stackoverflow.com/questions/19045664
复制相似问题