Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-15386

[Apicurito] Wrong import of SpringBootServletInitializer

    XMLWordPrintable

Details

    • Bug
    • Status: Done
    • Blocker
    • Resolution: Done
    • fuse-7.8-GA
    • fuse-7.8-GA
    • None
    • build9
    • Hide
      1. Deploy Apicurito from templates on any OCP cluster
      2. Open API Designer UI -> Open API -> Upload the sample json
      3. Generate -> Fuse Camel Project -> Download the zip
      4. Unzip the project
      5. Run
        mvn clean package
      1. You will see the following error: 
        package org.springframework.boot.context.web does not exist
        
      Show
      Deploy Apicurito from templates on any OCP cluster Open API Designer UI -> Open API -> Upload the sample json Generate -> Fuse Camel Project -> Download the zip Unzip the project Run mvn clean package You will see the following error:  package org.springframework.boot.context.web does not exist
    • Hide

      Replace

      import org.springframework.boot.web.support.SpringBootServletInitializer;

      by 

      import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; 

      in .../camel-project/src/main/java/io/example/openapi/Application.java of the generated Fuse Camel Project

      Show
      Replace import org.springframework.boot.web.support.SpringBootServletInitializer; by  import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;  in .../camel-project/src/main/java/io/example/openapi/Application.java of the generated Fuse Camel Project

    Description

      Used images:

      • fuse7-fuse-java-openshift:1.8-9
      • fuse7-fuse-apicurito:1.8-10
      • fuse7-fuse-apicurito-generator:1.8-20

      I deployed the Apicurito on OCP 4.6 and opened API Designer UI with a sample todo-swagger.json

      I tried to generate the Fuse Camel Project, I successfully downloaded and unzipped.

      However, when I tried to run 

      mvn clean package

      or

      mvn spring-boot:run

      I get the following errors: 

      [ERROR] COMPILATION ERROR : 
      [INFO] -------------------------------------------------------------
      [ERROR] /home/jsolovjo/Desktop/camel-project/src/main/java/io/example/openapi/Application.java:[20,44] package org.springframework.boot.context.web does not exist
      [ERROR] /home/jsolovjo/Desktop/camel-project/src/main/java/io/example/openapi/Application.java:[25,34] cannot find symbol
        symbol: class SpringBootServletInitializer
      [INFO] 2 errors 
      [INFO] -------------------------------------------------------------
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time:  7.089 s
      [INFO] Finished at: 2020-12-02T17:05:51+01:00
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project todo-app-api: Compilation failure: Compilation failure: 
      [ERROR] /home/jsolovjo/Desktop/camel-project/src/main/java/io/example/openapi/Application.java:[20,44] package org.springframework.boot.context.web does not exist
      [ERROR] /home/jsolovjo/Desktop/camel-project/src/main/java/io/example/openapi/Application.java:[25,34] cannot find symbol
      [ERROR]   symbol: class SpringBootServletInitializer
      [ERROR] -> [Help 1]
      [ERROR] 
      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR] 
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
      

       After an investigation I found that:

      • Spring Boot 1.x: import org.springframework.boot.web.support
      • Spring Boot 2.x: import org.springframework.boot.web.servlet.support

      When I changed the import in .../camel-project/src/main/java/io/example/openapi/Application.java it started working

       

      Attachments

        Activity

          People

            lgarciaac Luis García Acosta
            jsolovjo Juri Solovjov
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: