【发布时间】:2015-02-19 00:20:16
【问题描述】:
我有一个非常简单的 Spring Boot 应用程序,我想将它部署到 Jboss EAP。这是我的简单应用程序类:
@SpringBootApplication
public class MayurApplication extends SpringBootServletInitializer{
public static void main(String[] args) {
SpringApplication.run(MayurApplication.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(applicationClass);
}
private static Class<MayurApplication> applicationClass = MayurApplication.class;
}
@RestController
class GreetingController {
@RequestMapping("/hello/{name}")
String hello(@PathVariable String name) {
return "Hello, " + name + "!";
}
}
而且我的 pom.xml 也很基础。当我在 Tomcat 上运行此应用程序时,使用 Spring Boot 附带的嵌入式 Tomcat。只需单击一下,一切都像魅力一样。我可以访问http://localhost:8080/demo/hello/World,它也可以。
现在我试图让它与 Jboss EAP 兼容战争,我通过从 spring-boot-starter-web 中排除来禁用 Tomcat,并将其转换为战争项目。 (正如文章http://spring.io/blog/2014/03/07/deploying-spring-boot-applications 所建议的那样)。
我还补充了:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>,
因为它在抱怨。
现在,在这一切之后,它编译得很好并且也产生了战争。当我将此战争复制到 jboss 部署时,我可以看到它成功部署在控制台上。
但是其余的 api http://localhost:8080/demo/hello/World 只是不起作用,并且不断在浏览器上抛出错误:
JBWEB000068: message /demo/hello/World
JBWEB000069: description JBWEB000124: The requested resource is not available.
我做错了什么?
【问题讨论】:
标签: maven-3 spring-boot jboss-eap-6