Liberty Core:找不到春季启动上下文根

时间:2019-01-24 15:25:09

标签: java spring-boot websphere

使用Liberty Core运行我的Spring Boot应用程序会给我这个错误,并且没有记录错误!

因此,我基于spring-boot-starter-web创建了一个pom文件,并排除了tomcat 带有入门类:

@Configuration
@EnableAutoConfiguration
@SpringBootApplication
@ComponentScan(basePackages = { "com.a.b.c" }, lazyInit = true)
public class SpringBootApp extends SpringBootServletInitializer {

  /**
   * @param args main aguments
   */
  public static void main(final String[] args) {

    SpringApplication.run(SpringBootApp.class, args);
  }

  /*
   * (non-Javadoc)
   * 
   * @see org.springframework.boot.web.support.SpringBootServletInitializer#configure(org.springframework.boot.builder.
   * SpringApplicationBuilder)
   */
  @Override
  protected SpringApplicationBuilder configure(final SpringApplicationBuilder builder) {

    return builder.sources(SpringBootApp.class);
  }

}

我的控制器:

@RestController
@RequestMapping("/api")
public class CustomerResource {


    /**
     * @param customerDTO
     * @return
     */
    @PostMapping("/customers")
    public ResponseEntity<URI> addOrder(
            @Valid @RequestBody final CustomerDTO customerDTO) {

        final URI location = ServletUriComponentsBuilder.fromCurrentRequest()
                .path("/{id}").buildAndExpand("id").toUri();
        return ResponseEntity.created(location).build();
    }

    /**
     * @param customerID
     * @return
     */
    @GetMapping("/customers/{customerID}")
    public CustomerDTO getCustomer(@PathVariable final String customerID) {

        return new CustomerDTO();
    }

}

WS自由代码(85)上的服务器x​​ml

<?xml version="1.0" encoding="UTF-8"?>
<server description="sa-57487">

    <!-- Enable features -->
    <featureManager>
        <feature>jsp-2.2</feature>
        <feature>ssl-1.0</feature>
        <feature>jpa-2.0</feature>
        <feature>jdbc-4.0</feature>
        <feature>jndi-1.0</feature>
        <feature>servlet-3.0</feature>
        <feature>localConnector-1.0</feature>
        <feature>restConnector-1.0</feature>
        <feature>beanValidation-1.1</feature>
          <feature>adminCenter-1.0</feature>
  </featureManager>

   <quickStartSecurity userName="wasadmin" userPassword="ded"/>

   <keyStore id="defaultKeyStore" password="ded"/>

    <!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
    <httpEndpoint id="defaultHttpEndpoint"
                  host="*"
                  httpPort="${http_port}"
                  httpsPort="${https_port}"/>






    <!-- Log File Rotation and Maximun Number of Historical  -->
    <logging
        logDirectory="sa-57487_api01_mob-biz-1/logs"
        messageFileName="messages.log"
        traceFileName="trace.log"
        traceSpecification="*=info"
        maxFileSize="10"
        maxFiles="10"
        copySystemStreams="false"
        consoleLogLevel="INFO"
    />

        <!-- Installation application -->

        <application id="api" location="installedApps/sample-service-exposition-0.0.10.war" name="api-0.0.1-SNAPSHOT" type="war" context-root="api"/>

踪迹给了我这个

[24/01/19 16:12:30:285 CET] 00000c50 com.ibm.ws.http.internal.VirtualHostImpl                     A CWWKT0016I: Web application available (default_host): http://xxx.fr.net.intra:9081/api/
[24/01/19 16:12:30:286 CET] 00000c52 com.ibm.ws.session.WASSessionCore                            I SESN0176I: A new session context will be created for application key default_host/api
[24/01/19 16:12:30:286 CET] 00000c52 com.ibm.ws.util                                              I SESN0172I: The session manager is using the Java default SecureRandom implementation for session ID generation.
[24/01/19 16:12:30:307 CET] 00000c50 com.ibm.ws.app.manager.AppMessageHelper                      A CWWKZ0001I: Application AP12213-melchior-0.0.1-SNAPSHOT started in 2.298 seconds.
[24/01/19 16:12:30:497 CET] 00000c2d com.ibm.ws.webcontainer.osgi.mbeans.PluginGenerator          I SRVE9103I: A configuration file for a web server plugin was automatically generated for this server at /applis/logs/57487-api01/wlc/sa-57487_api01_mob-biz-1/sa-57487_api01_mob-biz-1/logs/state/plugin-cfg.xml.
[24/01/19 16:12:30:532 CET] 00000c52 com.ibm.ws.webcontainer.webapp                               I SRVE0292I: Servlet Message - [sample-service-exposition-0.0.10]:.2 Spring WebApplicationInitializers detected on classpath

当我进入服务器URL时:http://xxx.fr.net.intra:9081/api/

给我:Context Root Not Found

任何帮助都

0 个答案:

没有答案