带有WAR打包的Spring Boot Apache CXF Web服务

时间:2019-01-28 19:12:15

标签: java apache spring-boot tomcat cxf

因此,我一直在寻找一个示例性的春季启动应用程序,该应用程序使用Apache CXF公开了SOAP Web服务,并将WAR打包部署到Tomcat服务器。但是,我所能找到的都是使用嵌入了Tomcat的JAR打包的教程。

我正在遵循使用tutorial示例代码的this。当我按原样编译代码并运行它时,它似乎可以正常工作,并且能够在/ services URL下看到WSDL定义。在pom中,如果我将包装从JAR更改为WAR,然后将该战争部署到我的tomcat实例,则相同的URL将返回404。

<groupId>com.opencodez</groupId>
<artifactId>apache-cxf-ws</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging> <!-- used to be jar -->

我还尝试过像这样从SpringBootServletInitializer扩展主类:

@SpringBootApplication
@ImportResource({ "classpath:webservice-definition-beans.xml" })
public class Application extends SpringBootServletInitializer {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

示例代码使用Spring Boot 1.5.10.RELEASE。 spring-boot-starter-web引入了tomcat 8.5.27。我正在运行的实例的版本是8.5.35,所以我认为这不是依赖版本的问题。我的tomcat安装也是具有默认配置的基本安装。

我想知道我的tomcat是否在/ lib文件夹中缺少jax-ws依赖关系?或者,也许我需要在server.xml文件中进行一些额外的配置?任何帮助将不胜感激!

0 个答案:

没有答案
相关问题