Não é possível activar o arranque de molas no EAP 6.3.3 do jBoss

estou a usar a versão do pacote de ferramentas Primavera: 3.7.0.RELEASE to deploy a spring boot project using tc server which works fine but fails on JBoss EAP 6.1+. Eu recebo um JBWEB000065: HTTP Status 404- /shell /

Shell application.java

@SpringBootApplication
@ComponentScan("shell")
public class ShellApplication extends SpringBootServletInitializer {

@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.sources(ShellApplication.class);
}

public static void main(String[] args) {
      SpringApplication.run(ShellApplication.class, args);
}      
}

Src / main/webapp/WEB-INF / jboss-web.xml

<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
    <context-root>/</context-root>
</jboss-web>

registo de consola

13:41:36,460 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015876: Starting deployment of "shell.war" (runtime-name: "shell.war")
13:42:15,089 INFO  [org.jboss.web] (ServerService Thread Pool -- 53) JBAS018210: Register web context: /shell
13:42:17,332 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "shell.war" (runtime-name : "shell.war")

navegador

JBWEB000065: HTTP Status 404 - /shell/

--------------------------------------------------------------------------------

JBWEB000309: type JBWEB000067: Status report

JBWEB000068: message /shell/

JBWEB000069: description JBWEB000124: The requested resource is not available.
Author: Michael Petch, 2015-09-30

1 answers

Encontrei exactamente o mesmo problema e finalmente encontrei uma solução.
Tente os seguintes passos:

1. Em pom.xml:
<dependency>
   <groupId>javax.servlet</groupId>
   <artifactId>javax.servlet-api</artifactId>
   <scope>provided</scope>
</dependency>

2. Adicionar uma classe implementa inicialização da aplicação web:

@Configuration
public class WebApplicationInitializerImpl implements WebApplicationInitializer{

    @Override 
    public void onStartup(ServletContext container) throws ServletException {
        WebApplicationContext context = getContext();

        Dynamic registration = container.addServlet("dispatcher", new DispatcherServlet(context));
        registration.setLoadOnStartup(1);
        registration.addMapping("/*");
    } 

    private WebApplicationContext getContext() { 
        AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
        context.setConfigLocation(ApplicationMain.class.getName());
        return context;
    } 

}

3. Lembre-se de extender o Inicializador de Springbootservlet pela sua aplicação:

@SpringBootApplication
public class ApplicationMain extends SpringBootServletInitializer{

   @Override
   protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
      return builder.sources(ApplicationMain.class);
   }

   public static void main(String[] args) {
      SpringApplication.run(ApplicationMain.class, args);
   }
}
Para mais explicações, respondi noutra Pergunta: 6
Espero que ajude.
 0
Author: kinolollipop, 2018-08-31 03:42:28