0
votes

I have a spring web application that works in tomcat and jetty server but when i deploy it in jboss server (7.1.1 version) there is an error 404.

my configuration in web.xml is

    <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
              http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">

    <display-name>rci_sof</display-name>


    <!-- Servlet de démarrage de l'application -->
    <servlet>
        <servlet-name>AppContextInitializerServlet</servlet-name>
        <servlet-class>com.rcibanque.sof.server.servlet.SofContextInitializerServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <!-- Services RPC -->
    <servlet>
        <servlet-name>dataServiceRPC</servlet-name>
        <servlet-class>com.rcibanque.sof.server.service.data.SofDataServiceImpl</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>dataServiceRPC</servlet-name>
        <url-pattern>/rci_sof/dataService.rpc</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>dataServiceRPC</servlet-name>
        <url-pattern>/rci_admin/dataService.rpc</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>dataModuleServiceRPC</servlet-name>
        <servlet-class>com.rcibanque.sof.server.service.data.SofDataModuleServiceImpl</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>dataModuleServiceRPC</servlet-name>
        <url-pattern>/rci_sof/dataModuleService.rpc</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>dataModuleServiceRPC</servlet-name>
        <url-pattern>/rci_admin/dataModuleService.rpc</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>tariffingServiceRPC</servlet-name>
        <servlet-class>com.rcibanque.sof.server.service.tariffing.TariffingServiceImpl</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>tariffingServiceRPC</servlet-name>
        <url-pattern>/rci_sof/tariffingService.rpc</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>tariffingServiceRPC</servlet-name>
        <url-pattern>/rci_admin/tariffingService.rpc</url-pattern>
    </servlet-mapping>

    <!-- RPC Chart -->
    <servlet>
        <servlet-name>chartRPC</servlet-name>
        <servlet-class>com.rcibanque.sof.server.chart.ChartGeneratorImpl</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>chartRPC</servlet-name>
        <url-pattern>/rci_sof/chart.rpc</url-pattern>
    </servlet-mapping>

    <!-- RPC Print Report -->
    <servlet>
        <servlet-name>printReportRPC</servlet-name>
        <servlet-class>com.rcibanque.sof.server.print.report.SofPrintReportImpl</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>printReportRPC</servlet-name>
        <url-pattern>/rci_sof/printReport.rpc</url-pattern>
    </servlet-mapping>

    <!-- RPC Mail -->
    <servlet>
        <servlet-name>messagingServiceRPC</servlet-name>
        <servlet-class>com.rcibanque.sof.server.print.messaging.SofMessagingServiceImpl</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>messagingServiceRPC</servlet-name>
        <url-pattern>/rci_sof/messagingService.rpc</url-pattern>
    </servlet-mapping>

    <!-- RPC TOPCAR -->
    <servlet>
        <servlet-name>topCarServiceRPC</servlet-name>
        <servlet-class>com.rcibanque.sof.server.service.topcar.TopCarService</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>topCarServiceRPC</servlet-name>
        <url-pattern>/rci_sof/topCarService.rpc</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>topCarServiceRPC</servlet-name>
        <url-pattern>/rci_admin/topCarService.rpc</url-pattern>
    </servlet-mapping>

    <!-- RPC Fiscalité CO2 -->
    <servlet>
        <servlet-name>fiscaliteCO2</servlet-name>
        <servlet-class>com.rcibanque.socle.server.service.data.FiscaliteCO2Service</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>fiscaliteCO2</servlet-name>
        <url-pattern>/rci_sof/fiscaliteCO2Service.rpc</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>fiscaliteCO2</servlet-name>
        <url-pattern>/rci_admin/fiscaliteCO2Service.rpc</url-pattern>
    </servlet-mapping>

    <!-- RPC Offre -->
    <servlet>
        <servlet-name>offreServiceRPC</servlet-name>
        <servlet-class>com.rcibanque.sof.server.service.offre.OffreServiceRPCImpl</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>offreServiceRPC</servlet-name>
        <url-pattern>/rci_sof/offreService.rpc</url-pattern>
    </servlet-mapping>

    <!-- Servlets -->
    <servlet>
        <servlet-name>displayChartServlet</servlet-name>
        <servlet-class>org.jfree.chart.servlet.DisplayChart</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>displayChartServlet</servlet-name>
        <url-pattern>/rci_sof/displayChart</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>downloadServlet</servlet-name>
        <servlet-class>com.rcibanque.socle.server.servlet.DownloadServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>downloadServlet</servlet-name>
        <url-pattern>*.pdf</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>downloadServlet</servlet-name>
        <url-pattern>*.xls</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>downloadServlet</servlet-name>
        <url-pattern>*.txt</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>downloadServlet</servlet-name>
        <url-pattern>*.csv</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>topcarDownloadServlet</servlet-name>
        <servlet-class>com.rcibanque.socle.server.servlet.TopcarDownloadServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>topcarDownloadServlet</servlet-name>
        <url-pattern>/rci_sof/download</url-pattern>
    </servlet-mapping>
    <servlet>
        <servlet-name>uploadServlet</servlet-name>
        <servlet-class>com.rcibanque.socle.server.servlet.UploadServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>uploadServlet</servlet-name>
        <url-pattern>/rci_sof/upload</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>uploadServlet</servlet-name>
        <url-pattern>/rci_admin/upload</url-pattern>
    </servlet-mapping>
    <servlet>
        <servlet-name>uploadTopcarServlet</servlet-name>
        <servlet-class>com.rcibanque.socle.server.servlet.UploadTopcarServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>uploadTopcarServlet</servlet-name>
        <url-pattern>/rci_sof/uploadTopcar</url-pattern>
    </servlet-mapping>


    <!-- Filtre de gestion des caches -->
    <filter>
        <filter-name>gwtCacheControlFilter</filter-name>
        <filter-class>com.rcibanque.socle.server.filter.GWTCacheControlFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>gwtCacheControlFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <!-- Default page to serve -->
    <welcome-file-list>
        <welcome-file>Index.html</welcome-file>
    </welcome-file-list>

    <!-- Timeout QC32499 session connexion timeout <session-config> <session-timeout>300</session-timeout> 
        </session-config> -->

</web-app>   

and we use AbstractAnnotationConfigDispatcherServletInitializer for configuring Spring with java configuration

public class SoftWebInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {

     @Override
        protected Class<?>[] getRootConfigClasses() {
            return new Class[] { SoftWebConfig.class };
        }

        @Override
        protected Class<?>[] getServletConfigClasses() {
            return null;
        }

        @Override
        protected String[] getServletMappings() {
            return new String[] { "/*", "/ws/*" };
        }

}     

and my SoftWebConfig is

@Configuration
@Import(SoftDBConfig.class)
@EnableScheduling
@EnableWebMvc
@EnableHypermediaSupport(type = { HypermediaType.HAL })
@ComponentScan(basePackages = { "com.rcibanque.socle.server.*", "com.rcibanque.sof.server.*",
        "com.rcibanque.socle.server.ws.*" })
public class SoftWebConfig implements SchedulingConfigurer {

    @Override
    public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
        taskRegistrar.setScheduler(taskExecutor());
    }

    @Bean(name = "TOPCAR-EXECUTOR", destroyMethod = "shutdown")
    public Executor taskExecutor() {
        return Executors.newScheduledThreadPool(1);
    }

}

This application run perfectly in TOMCAT and JETTY servers but when i deploy it in Jboss Server and acceed the application with the http://localhost:8080/rci_sof/index.html a 404 error appear and in server.log i find this log :

11:30:07,927 INFO [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] (MSC service thread 1-8) Mapped "{[/inffr/mat/{codeModele}/{codeVersion}],methods=[GET],consumes=[text/plain || application/],produces=[application/hal+json]}" onto public org.springframework.http.ResponseEntity> com.rcibanque.socle.server.ws.inffr.WsVehiculeInffr.findByCodesMat(java.lang.String,java.lang.String,boolean,boolean) 11:30:07,933 INFO [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] (MSC service thread 1-8) Mapped "{[/inffr/mat/{codeModele}],methods=[GET],consumes=[text/plain || application/],produces=[application/hal+json]}" onto public org.springframework.http.ResponseEntity> com.rcibanque.socle.server.ws.inffr.WsVehiculeInffr.findByCodesMat(java.lang.String,boolean) 11:30:07,939 INFO [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] (MSC service thread 1-8) Mapped "{[/inffr/renault/{codeModeleRenault}/{libelleVersionRenault}],methods=[GET],consumes=[text/plain || application/],produces=[application/hal+json]}" onto public org.springframework.http.ResponseEntity> com.rcibanque.socle.server.ws.inffr.WsVehiculeInffr.findByCodesRenault(java.lang.String,java.lang.String,boolean,boolean) 11:30:07,945 INFO [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] (MSC service thread 1-8) Mapped "{[/inffr/renault/{codeModeleRenault}],methods=[GET],consumes=[text/plain || application/],produces=[application/hal+json]}" onto public org.springframework.http.ResponseEntity> com.rcibanque.socle.server.ws.inffr.WsVehiculeInffr.findByCodesRenault(java.lang.String,boolean) 11:30:07,952 INFO [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] (MSC service thread 1-8) Mapped "{[/historiquedlo/{siren}/{codeProduit}/{debut}],methods=[GET],consumes=[text/plain || application/],produces=[application/hal+json]}" onto public org.springframework.http.ResponseEntity> com.rcibanque.socle.server.ws.dlo.WsHistoriqueDlo.findHistoriqueDlo(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) 11:30:07,958 INFO [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] (MSC service thread 1-8) Mapped "{[/historiquedlo/{siren}/{debut}],methods=[GET],consumes=[text/plain || application/],produces=[application/hal+json]}" onto public org.springframework.http.ResponseEntity> com.rcibanque.socle.server.ws.dlo.WsHistoriqueDlo.findHistoriqueDlo(java.lang.String,java.lang.String,java.lang.String,java.lang.String) 11:30:08,198 INFO [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter] (MSC service thread 1-8) Looking for @ControllerAdvice: Root WebApplicationContext: startup date [Thu Aug 16 11:30:04 CEST 2018]; root of context hierarchy 11:30:08,248 INFO [org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver] (MSC service thread 1-8) Detected @ExceptionHandler methods in wsExceptionHandlerAdvice 11:30:08,327 INFO [org.springframework.web.context.ContextLoader] (MSC service thread 1-8) Root WebApplicationContext: initialization completed in 3565 ms 11:30:08,334 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/rci-sof-web-16.6.01-SNAPSHOT]] (MSC service thread 1-8) Initializing Spring FrameworkServlet 'dispatcher' 11:30:08,337 INFO [org.springframework.web.servlet.DispatcherServlet] (MSC service thread 1-8) FrameworkServlet 'dispatcher': initialization started 11:30:08,340 INFO [org.springframework.web.context.support.AnnotationConfigWebApplicationContext] (MSC service thread 1-8) Refreshing WebApplicationContext for namespace 'dispatcher-servlet': startup date [Thu Aug 16 11:30:08 CEST 2018]; parent: Root WebApplicationContext 11:30:08,345 INFO [org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor] (MSC service thread 1-8) JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 11:30:08,361 INFO [org.springframework.web.servlet.DispatcherServlet] (MSC service thread 1-8) FrameworkServlet 'dispatcher': initialization completed in 23 ms 11:30:08,364 INFO [stdout] (MSC service thread 1-8) null

11:30:08,365 INFO [com.rcibanque.socle.server.servlet.AbstractContextInitializerServlet] (MSC service thread 1-8) Propriétés chargées à partir de : null\rci_sof.properties 11:30:08,382 INFO [org.jboss.web] (MSC service thread 1-8) JBAS018210: Registering web context: /rci-sof-web-16.6.01-SNAPSHOT 11:30:08,388 INFO [org.jboss.as] (MSC service thread 1-2) JBAS015951: Admin console listening on http://127.0.0.1:9990 11:30:08,390 INFO [org.jboss.as] (MSC service thread 1-2) JBAS015874: JBoss AS 7.1.1.Final "Brontes" started in 66742ms - Started 263 of 341 services (76 services are passive or on-demand) 11:30:08,569 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "rci-sof-web-16.6.01-SNAPSHOT.war"

11:48:15,691 WARN [org.springframework.web.servlet.PageNotFound] (http--127.0.0.1-8080-2) No mapping found for HTTP request with URI [/rci-sof-web-16.6.01-SNAPSHOT/rci_sof/Index.html] in DispatcherServlet with name 'dispatcher' 11:48:20,311 WARN [org.springframework.web.servlet.PageNotFound] (http--127.0.0.1-8080-2) No mapping found for HTTP request with URI [/rci-sof-web-16.6.01-SNAPSHOT/Index.html] in DispatcherServlet with name 'dispatcher' 11:48:25,258 WARN [org.springframework.web.servlet.PageNotFound] (http--127.0.0.1-8080-2) No mapping found for HTTP request with URI [/rci-sof-web-16.6.01-SNAPSHOT/rci_sof/Index.html] in DispatcherServlet with name 'dispatcher' 11:48:42,939 WARN [org.springframework.web.servlet.PageNotFound] (http--127.0.0.1-8080-2) No mapping found for HTTP request with URI [/rci-sof/Index.html] in DispatcherServlet with name 'dispatcher'

Thank you for your help.

1
I see there "Index.html" with a capital I. I know of some case-insensitive repair features, which JBoss might not excercise there. Maybe "index.html"?Joop Eggen
Thank you for your response but i tried with "Index.html" and always i obtain the same problem.abdelmouheimen
You mean you tried it with index.html? It's hard for me to find something possibly wrong; I would have expected <welcome-file>index.html</welcome-file> with a small i.Joop Eggen
i tried the two possible case "index.html" and "Index.html" in web.xml and in the url also.abdelmouheimen
is your web application the only one running in the jboss container?Paul Janssens

1 Answers

0
votes

I resolved this problem by replacing "/*" by "/" and now it works in Jboss, Jetty and Tomcat.