Mic*_* J. 6 web-services cxf java-ee jsr250
我有一个使用Apache CXF生成和构建的Web服务客户端.接下来我有JAX-RS Jersey应用程序,我想从该webservice调用方法.当我尝试将这个简单的项目部署到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.
Run Code Online (Sandbox Code Playgroud)
命令部署失败.
我在这个项目中唯一的CXF依赖是:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle-jaxrs</artifactId>
<version>2.7.6</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)
是否还有其他与JSR 250兼容的CXF库?谢谢
Glassfish 的挑战之一是完整的服务器配置文件与用于 JAX-WS 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>
Run Code Online (Sandbox Code Playgroud)
过去,我发现偶尔还是会遇到部署问题;因此,我实际上已从 Glassfish 服务器配置文件中完全删除了 Metro 和 Jersey 功能。以下是有关部署的更多信息。
http://cxf.apache.org/docs/application-server-specific-configuration-guide.html
我注意到的另一件事是您发布了一条日志消息,其中包括 Jetty 传输。这意味着您正在运行 Jetty HTTP 服务器并运行 Glassfish HTTP 服务器。我建议仅使用 Glassfish 作为 Web 服务器并使用 CXF servlet 传输。