I am getting 404 errors on a Sprinb Boot 3 application with Java 17 deployed as a war file on Tomcat 10.1 with Maven

My JSPs do not resolve.

Below are my application properties

spring.application.name=codereaper

spring.datasource.url=jdbc:mysql://192.168.0.28:3306/reference_tables?allowPublicKeyRetrieval=true&useSSL=false&autoReconnect=true&

spring.datasource.username=reference

spring.datasource.password=Peconic4Bay

spring.datasource.pool-size=5

spring.mvc.view.prefix=/WEB-INF/jsp/

spring.mvc.view.suffix=.jsp

server.servlet.context-path=/codereaper

security.basic.enable=false

management.security.enabled=false

#mybatis

spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration

mybatis.config-location=classpath:mybatis/MapperConfig.xml

mybatis.type-aliases-package=classpath:com.empirestateids.domain

mybatis.mapper-locations=classpath*:mybatis/*Mapper.xml

management.endpoints.web.exposure.include=mappings

server.error.whitelabel.enabled=false

I have tried using application properties to detail where my JSPs are as well as an internal view resolver

he JSPs in the war file are in the war file at /WEB-INF/jsp/*

Not sure why the views don’t resolve Eg I get a 404 on the /home view but the error page renders.

I have tried using a Internal view resolver as below since the application properties do not appear to be working

Here is my Controller

    @Controller
    public class MainController {

    static Logger logger = LogManager.getLogger(MainController.class);

    @Autowired
    MainService mainService;


    @RequestMapping("/home")
    public String home(Model model,HttpServletRequest request,HttpServletResponse response) {
    MainContent mainContent = new MainContent();
    Device currentDevice = DeviceUtils.getCurrentDevice(request);
    DevicePlatform platform  = currentDevice.getDevicePlatform();

    String username; 
    logger.error("Main Controller:/home"+ " Device Mobile:"+currentDevice.isMobile());

    model.addAttribute("userName", "Username");
    model.addAttribute(platform);
    return("home");

    }
        @Configuration
        @EnableWebMvc
        public class WebMvcConfig implements WebMvcConfigurer {
  
      @Override
      public void configureViewResolvers(ViewResolverRegistry registry) {
      InternalResourceViewResolver resolver = new InternalResourceViewResolver();
      resolver.setPrefix("/WEB-INF/jsp/");
      resolver.setSuffix(".jsp");
      registry.viewResolver(resolver);
      }
    }

Here is the Spring main

    @SpringBootApplication(exclude = { SecurityAutoConfiguration.class })
    @MapperScan("com.empirestateids.dao")
    @MappedTypes({Address.class,Article.class,Contact.class,CvxAttributes.class,
    CvxCatalogs.class,CvxCodes.class,Email.class,Events.class,GroupAuthority.class,
    GroupMember.class,Groups.class,Icd10.class,Icd11.class,IdSeq.class,
    IpowerliftId.class,Loinc.class,Lookup.class,PersistentLogins.class,
    Person.class, Registration.class, RxNormCodes.class, Users.class})
    public class CodereaperApplication {

    static Logger logger = LogManager.getLogger(CodereaperApplication.class);
    
    public static void main(String[] args) {
        System.setProperty("server.servlet.context-path", "/codereaper");
        SpringApplication.run(CodereaperApplication.class, args);
        
        logger.debug("Debug");
        logger.error("Error");
        logger.info("Info");
    }
    
    @Bean
      public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
        return args -> {
          logger.debug("Debug logging");
          logger.error("Error logging");
          logger.info("Info logging");  
          System.out.println("Let's inspect the beans provided by Spring Boot:");

          String[] beanNames = ctx.getBeanDefinitionNames();
          Arrays.sort(beanNames);
          for (String beanName : beanNames) {
            System.out.println(beanName);
          }
        };
      }    

}

New contributor

charles didonato is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật