Getting 404 “Not Found” error from basic Spring Boot Camel REST DSL request












0















I have been working on a basic demo of Camel and REST DSL for the past few days, but I have finally hit a brick wall with this issue. I am fairly new to Spring Boot's magic, so any feedback is much appreciated!



When I run the project, everything looks like it starts up correctly for my two routes. However, when I try a GET request, I always get a 404 "Not Found" message back.



The only two classes I have are in the same package, so I do not believe visibility would be the problem. I created the project as a Spring Start Project, and I run it as a Spring Boot application. The logs show that the two routes are started successfully, and Tomcat is using port 8080. The context path is specifically configured in the application.properties file.



My main application class:



package com.example.demo;



import org.apache.camel.CamelContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@SpringBootApplication
@Configuration
@ComponentScan("com.example.demo")
public class DemoApplication {

@Autowired
CamelContext camelContext;

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


My router class:



package com.example.demo;

import org.springframework.stereotype.Component;
import org.apache.camel.LoggingLevel;
import org.apache.camel.model.rest.RestBindingMode;
import org.apache.camel.builder.RouteBuilder;

@Component
public class DemoCamelRouter extends RouteBuilder {
@Override
public void configure() throws Exception {

restConfiguration().component("servlet")
.bindingMode(RestBindingMode.auto);

rest().get("/hello")
.to("direct:hello");

from("direct:hello")
.log(LoggingLevel.INFO, "Hello World")
.transform().simple("Hello World");
}
}


My application.properties file:



camel.springboot.main-run-controller=true
server.servlet.context-path=/demo


I am testing this service using http://localhost:8080/demo/hello



Here are the Maven dependencies I have.



spring-boot-starter-web (managed:2.1.0.RELEASE)
spring-boot-starter-web-services (managed:2.1.0.RELEASE)
spring-boot-starter-test (managed:2.1.0.RELEASE)
camel-core: 2.22.2
camel-spring-boot-starter: 2.22.2
camel-servlet: 2.22.2
camel-http-common: 2.22.2
javax.servlet-api (managed:4.0.1)


Lastly, here is what the log shows.



2018-11-21 00:58:38.454  INFO 11072 --- [           main] o.a.camel.spring.boot.RoutesCollector    : Starting CamelMainRunController to ensure the main thread keeps running
2018-11-21 00:58:38.470 INFO 11072 --- [ main] o.a.camel.spring.SpringCamelContext : Route: route2 started and consuming from: direct://hello
2018-11-21 00:58:38.470 INFO 11072 --- [ main] o.a.camel.spring.SpringCamelContext : Route: route1 started and consuming from: servlet:/hello?httpMethodRestrict=GET
2018-11-21 00:58:38.470 INFO 11072 --- [ main] o.a.camel.spring.SpringCamelContext : Total 2 routes, of which 2 are started
2018-11-21 00:58:38.470 INFO 11072 --- [ main] o.a.camel.spring.SpringCamelContext : Apache Camel 2.22.2 (CamelContext: camel-1) started in 0.236 seconds
2018-11-21 00:58:38.486 INFO 11072 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '/demo'
2018-11-21 00:58:38.501 INFO 11072 --- [ main] com.example.demo.DemoApplication : Started DemoApplication in 3.882 seconds (JVM running for 6.868)
2018-11-21 01:00:12.445 INFO 11072 --- [nio-8080-exec-4] o.a.c.c.C.[Tomcat].[localhost].[/demo] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2018-11-21 01:00:12.445 INFO 11072 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2018-11-21 01:00:12.453 INFO 11072 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet : Completed initialization in 8 ms









share|improve this question





























    0















    I have been working on a basic demo of Camel and REST DSL for the past few days, but I have finally hit a brick wall with this issue. I am fairly new to Spring Boot's magic, so any feedback is much appreciated!



    When I run the project, everything looks like it starts up correctly for my two routes. However, when I try a GET request, I always get a 404 "Not Found" message back.



    The only two classes I have are in the same package, so I do not believe visibility would be the problem. I created the project as a Spring Start Project, and I run it as a Spring Boot application. The logs show that the two routes are started successfully, and Tomcat is using port 8080. The context path is specifically configured in the application.properties file.



    My main application class:



    package com.example.demo;



    import org.apache.camel.CamelContext;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.context.annotation.ComponentScan;
    import org.springframework.context.annotation.Configuration;

    @SpringBootApplication
    @Configuration
    @ComponentScan("com.example.demo")
    public class DemoApplication {

    @Autowired
    CamelContext camelContext;

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


    My router class:



    package com.example.demo;

    import org.springframework.stereotype.Component;
    import org.apache.camel.LoggingLevel;
    import org.apache.camel.model.rest.RestBindingMode;
    import org.apache.camel.builder.RouteBuilder;

    @Component
    public class DemoCamelRouter extends RouteBuilder {
    @Override
    public void configure() throws Exception {

    restConfiguration().component("servlet")
    .bindingMode(RestBindingMode.auto);

    rest().get("/hello")
    .to("direct:hello");

    from("direct:hello")
    .log(LoggingLevel.INFO, "Hello World")
    .transform().simple("Hello World");
    }
    }


    My application.properties file:



    camel.springboot.main-run-controller=true
    server.servlet.context-path=/demo


    I am testing this service using http://localhost:8080/demo/hello



    Here are the Maven dependencies I have.



    spring-boot-starter-web (managed:2.1.0.RELEASE)
    spring-boot-starter-web-services (managed:2.1.0.RELEASE)
    spring-boot-starter-test (managed:2.1.0.RELEASE)
    camel-core: 2.22.2
    camel-spring-boot-starter: 2.22.2
    camel-servlet: 2.22.2
    camel-http-common: 2.22.2
    javax.servlet-api (managed:4.0.1)


    Lastly, here is what the log shows.



    2018-11-21 00:58:38.454  INFO 11072 --- [           main] o.a.camel.spring.boot.RoutesCollector    : Starting CamelMainRunController to ensure the main thread keeps running
    2018-11-21 00:58:38.470 INFO 11072 --- [ main] o.a.camel.spring.SpringCamelContext : Route: route2 started and consuming from: direct://hello
    2018-11-21 00:58:38.470 INFO 11072 --- [ main] o.a.camel.spring.SpringCamelContext : Route: route1 started and consuming from: servlet:/hello?httpMethodRestrict=GET
    2018-11-21 00:58:38.470 INFO 11072 --- [ main] o.a.camel.spring.SpringCamelContext : Total 2 routes, of which 2 are started
    2018-11-21 00:58:38.470 INFO 11072 --- [ main] o.a.camel.spring.SpringCamelContext : Apache Camel 2.22.2 (CamelContext: camel-1) started in 0.236 seconds
    2018-11-21 00:58:38.486 INFO 11072 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '/demo'
    2018-11-21 00:58:38.501 INFO 11072 --- [ main] com.example.demo.DemoApplication : Started DemoApplication in 3.882 seconds (JVM running for 6.868)
    2018-11-21 01:00:12.445 INFO 11072 --- [nio-8080-exec-4] o.a.c.c.C.[Tomcat].[localhost].[/demo] : Initializing Spring DispatcherServlet 'dispatcherServlet'
    2018-11-21 01:00:12.445 INFO 11072 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
    2018-11-21 01:00:12.453 INFO 11072 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet : Completed initialization in 8 ms









    share|improve this question



























      0












      0








      0








      I have been working on a basic demo of Camel and REST DSL for the past few days, but I have finally hit a brick wall with this issue. I am fairly new to Spring Boot's magic, so any feedback is much appreciated!



      When I run the project, everything looks like it starts up correctly for my two routes. However, when I try a GET request, I always get a 404 "Not Found" message back.



      The only two classes I have are in the same package, so I do not believe visibility would be the problem. I created the project as a Spring Start Project, and I run it as a Spring Boot application. The logs show that the two routes are started successfully, and Tomcat is using port 8080. The context path is specifically configured in the application.properties file.



      My main application class:



      package com.example.demo;



      import org.apache.camel.CamelContext;
      import org.springframework.beans.factory.annotation.Autowired;
      import org.springframework.boot.SpringApplication;
      import org.springframework.boot.autoconfigure.SpringBootApplication;
      import org.springframework.context.annotation.ComponentScan;
      import org.springframework.context.annotation.Configuration;

      @SpringBootApplication
      @Configuration
      @ComponentScan("com.example.demo")
      public class DemoApplication {

      @Autowired
      CamelContext camelContext;

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


      My router class:



      package com.example.demo;

      import org.springframework.stereotype.Component;
      import org.apache.camel.LoggingLevel;
      import org.apache.camel.model.rest.RestBindingMode;
      import org.apache.camel.builder.RouteBuilder;

      @Component
      public class DemoCamelRouter extends RouteBuilder {
      @Override
      public void configure() throws Exception {

      restConfiguration().component("servlet")
      .bindingMode(RestBindingMode.auto);

      rest().get("/hello")
      .to("direct:hello");

      from("direct:hello")
      .log(LoggingLevel.INFO, "Hello World")
      .transform().simple("Hello World");
      }
      }


      My application.properties file:



      camel.springboot.main-run-controller=true
      server.servlet.context-path=/demo


      I am testing this service using http://localhost:8080/demo/hello



      Here are the Maven dependencies I have.



      spring-boot-starter-web (managed:2.1.0.RELEASE)
      spring-boot-starter-web-services (managed:2.1.0.RELEASE)
      spring-boot-starter-test (managed:2.1.0.RELEASE)
      camel-core: 2.22.2
      camel-spring-boot-starter: 2.22.2
      camel-servlet: 2.22.2
      camel-http-common: 2.22.2
      javax.servlet-api (managed:4.0.1)


      Lastly, here is what the log shows.



      2018-11-21 00:58:38.454  INFO 11072 --- [           main] o.a.camel.spring.boot.RoutesCollector    : Starting CamelMainRunController to ensure the main thread keeps running
      2018-11-21 00:58:38.470 INFO 11072 --- [ main] o.a.camel.spring.SpringCamelContext : Route: route2 started and consuming from: direct://hello
      2018-11-21 00:58:38.470 INFO 11072 --- [ main] o.a.camel.spring.SpringCamelContext : Route: route1 started and consuming from: servlet:/hello?httpMethodRestrict=GET
      2018-11-21 00:58:38.470 INFO 11072 --- [ main] o.a.camel.spring.SpringCamelContext : Total 2 routes, of which 2 are started
      2018-11-21 00:58:38.470 INFO 11072 --- [ main] o.a.camel.spring.SpringCamelContext : Apache Camel 2.22.2 (CamelContext: camel-1) started in 0.236 seconds
      2018-11-21 00:58:38.486 INFO 11072 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '/demo'
      2018-11-21 00:58:38.501 INFO 11072 --- [ main] com.example.demo.DemoApplication : Started DemoApplication in 3.882 seconds (JVM running for 6.868)
      2018-11-21 01:00:12.445 INFO 11072 --- [nio-8080-exec-4] o.a.c.c.C.[Tomcat].[localhost].[/demo] : Initializing Spring DispatcherServlet 'dispatcherServlet'
      2018-11-21 01:00:12.445 INFO 11072 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
      2018-11-21 01:00:12.453 INFO 11072 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet : Completed initialization in 8 ms









      share|improve this question
















      I have been working on a basic demo of Camel and REST DSL for the past few days, but I have finally hit a brick wall with this issue. I am fairly new to Spring Boot's magic, so any feedback is much appreciated!



      When I run the project, everything looks like it starts up correctly for my two routes. However, when I try a GET request, I always get a 404 "Not Found" message back.



      The only two classes I have are in the same package, so I do not believe visibility would be the problem. I created the project as a Spring Start Project, and I run it as a Spring Boot application. The logs show that the two routes are started successfully, and Tomcat is using port 8080. The context path is specifically configured in the application.properties file.



      My main application class:



      package com.example.demo;



      import org.apache.camel.CamelContext;
      import org.springframework.beans.factory.annotation.Autowired;
      import org.springframework.boot.SpringApplication;
      import org.springframework.boot.autoconfigure.SpringBootApplication;
      import org.springframework.context.annotation.ComponentScan;
      import org.springframework.context.annotation.Configuration;

      @SpringBootApplication
      @Configuration
      @ComponentScan("com.example.demo")
      public class DemoApplication {

      @Autowired
      CamelContext camelContext;

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


      My router class:



      package com.example.demo;

      import org.springframework.stereotype.Component;
      import org.apache.camel.LoggingLevel;
      import org.apache.camel.model.rest.RestBindingMode;
      import org.apache.camel.builder.RouteBuilder;

      @Component
      public class DemoCamelRouter extends RouteBuilder {
      @Override
      public void configure() throws Exception {

      restConfiguration().component("servlet")
      .bindingMode(RestBindingMode.auto);

      rest().get("/hello")
      .to("direct:hello");

      from("direct:hello")
      .log(LoggingLevel.INFO, "Hello World")
      .transform().simple("Hello World");
      }
      }


      My application.properties file:



      camel.springboot.main-run-controller=true
      server.servlet.context-path=/demo


      I am testing this service using http://localhost:8080/demo/hello



      Here are the Maven dependencies I have.



      spring-boot-starter-web (managed:2.1.0.RELEASE)
      spring-boot-starter-web-services (managed:2.1.0.RELEASE)
      spring-boot-starter-test (managed:2.1.0.RELEASE)
      camel-core: 2.22.2
      camel-spring-boot-starter: 2.22.2
      camel-servlet: 2.22.2
      camel-http-common: 2.22.2
      javax.servlet-api (managed:4.0.1)


      Lastly, here is what the log shows.



      2018-11-21 00:58:38.454  INFO 11072 --- [           main] o.a.camel.spring.boot.RoutesCollector    : Starting CamelMainRunController to ensure the main thread keeps running
      2018-11-21 00:58:38.470 INFO 11072 --- [ main] o.a.camel.spring.SpringCamelContext : Route: route2 started and consuming from: direct://hello
      2018-11-21 00:58:38.470 INFO 11072 --- [ main] o.a.camel.spring.SpringCamelContext : Route: route1 started and consuming from: servlet:/hello?httpMethodRestrict=GET
      2018-11-21 00:58:38.470 INFO 11072 --- [ main] o.a.camel.spring.SpringCamelContext : Total 2 routes, of which 2 are started
      2018-11-21 00:58:38.470 INFO 11072 --- [ main] o.a.camel.spring.SpringCamelContext : Apache Camel 2.22.2 (CamelContext: camel-1) started in 0.236 seconds
      2018-11-21 00:58:38.486 INFO 11072 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '/demo'
      2018-11-21 00:58:38.501 INFO 11072 --- [ main] com.example.demo.DemoApplication : Started DemoApplication in 3.882 seconds (JVM running for 6.868)
      2018-11-21 01:00:12.445 INFO 11072 --- [nio-8080-exec-4] o.a.c.c.C.[Tomcat].[localhost].[/demo] : Initializing Spring DispatcherServlet 'dispatcherServlet'
      2018-11-21 01:00:12.445 INFO 11072 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
      2018-11-21 01:00:12.453 INFO 11072 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet : Completed initialization in 8 ms






      rest spring-boot apache-camel spring-camel






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 21 '18 at 17:51







      Rachel217

















      asked Nov 21 '18 at 7:44









      Rachel217Rachel217

      34




      34
























          1 Answer
          1






          active

          oldest

          votes


















          1














          As of Camel’s version 2.19, CamelServlet is by default set to “/camel”. So your url becomes:



          http://localhost:8080/demo/camel/hello 


          Update:
          You will also need to define following bean as you're using camel-servlet:



          @Bean
          public ServletRegistrationBean<Servlet> servletRegistrationBean() {
          ServletRegistrationBean<Servlet> registration = new ServletRegistrationBean<>(new CamelHttpTransportServlet(), "/camel/*");
          registration.setName("CamelServlet");
          return registration;
          }


          Or instead of camel-servlet dependency, you should add camel-servlet-starter dependency






          share|improve this answer


























          • Hi Sukhpal, Thank you for the response. I tried the above mentioned link, but I still get a 404 response back. Perhaps, there is another issue in the project as well.

            – Rachel217
            Nov 21 '18 at 16:17











          • @Rachel217 Which version of camel spring boot starter are you using? Do check servlet-component

            – Sukhpal Singh
            Nov 21 '18 at 17:14











          • Sukhpal, I have now added a list of all my maven dependencies in the above question in case there is a mistake there. I am using camel-spring-boot-starter version 2.22.2 which is the same as the camel-core version. With these, I am using Java 8. Thanks!

            – Rachel217
            Nov 21 '18 at 17:55











          • Looking more closely at my Maven dependencies, there may be some unnecessary ones there, like javax.servlet-api and spring-boot-starter-web-services. I tried removing these, and nothing changed in the app's log output.

            – Rachel217
            Nov 21 '18 at 18:16











          • Thank you Sukhpal! I added the camel-servlet-starter dependency instead of the camel-servlet dependency, and it works now. Much appreciated!

            – Rachel217
            Nov 21 '18 at 21:10











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53407343%2fgetting-404-not-found-error-from-basic-spring-boot-camel-rest-dsl-request%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          As of Camel’s version 2.19, CamelServlet is by default set to “/camel”. So your url becomes:



          http://localhost:8080/demo/camel/hello 


          Update:
          You will also need to define following bean as you're using camel-servlet:



          @Bean
          public ServletRegistrationBean<Servlet> servletRegistrationBean() {
          ServletRegistrationBean<Servlet> registration = new ServletRegistrationBean<>(new CamelHttpTransportServlet(), "/camel/*");
          registration.setName("CamelServlet");
          return registration;
          }


          Or instead of camel-servlet dependency, you should add camel-servlet-starter dependency






          share|improve this answer


























          • Hi Sukhpal, Thank you for the response. I tried the above mentioned link, but I still get a 404 response back. Perhaps, there is another issue in the project as well.

            – Rachel217
            Nov 21 '18 at 16:17











          • @Rachel217 Which version of camel spring boot starter are you using? Do check servlet-component

            – Sukhpal Singh
            Nov 21 '18 at 17:14











          • Sukhpal, I have now added a list of all my maven dependencies in the above question in case there is a mistake there. I am using camel-spring-boot-starter version 2.22.2 which is the same as the camel-core version. With these, I am using Java 8. Thanks!

            – Rachel217
            Nov 21 '18 at 17:55











          • Looking more closely at my Maven dependencies, there may be some unnecessary ones there, like javax.servlet-api and spring-boot-starter-web-services. I tried removing these, and nothing changed in the app's log output.

            – Rachel217
            Nov 21 '18 at 18:16











          • Thank you Sukhpal! I added the camel-servlet-starter dependency instead of the camel-servlet dependency, and it works now. Much appreciated!

            – Rachel217
            Nov 21 '18 at 21:10
















          1














          As of Camel’s version 2.19, CamelServlet is by default set to “/camel”. So your url becomes:



          http://localhost:8080/demo/camel/hello 


          Update:
          You will also need to define following bean as you're using camel-servlet:



          @Bean
          public ServletRegistrationBean<Servlet> servletRegistrationBean() {
          ServletRegistrationBean<Servlet> registration = new ServletRegistrationBean<>(new CamelHttpTransportServlet(), "/camel/*");
          registration.setName("CamelServlet");
          return registration;
          }


          Or instead of camel-servlet dependency, you should add camel-servlet-starter dependency






          share|improve this answer


























          • Hi Sukhpal, Thank you for the response. I tried the above mentioned link, but I still get a 404 response back. Perhaps, there is another issue in the project as well.

            – Rachel217
            Nov 21 '18 at 16:17











          • @Rachel217 Which version of camel spring boot starter are you using? Do check servlet-component

            – Sukhpal Singh
            Nov 21 '18 at 17:14











          • Sukhpal, I have now added a list of all my maven dependencies in the above question in case there is a mistake there. I am using camel-spring-boot-starter version 2.22.2 which is the same as the camel-core version. With these, I am using Java 8. Thanks!

            – Rachel217
            Nov 21 '18 at 17:55











          • Looking more closely at my Maven dependencies, there may be some unnecessary ones there, like javax.servlet-api and spring-boot-starter-web-services. I tried removing these, and nothing changed in the app's log output.

            – Rachel217
            Nov 21 '18 at 18:16











          • Thank you Sukhpal! I added the camel-servlet-starter dependency instead of the camel-servlet dependency, and it works now. Much appreciated!

            – Rachel217
            Nov 21 '18 at 21:10














          1












          1








          1







          As of Camel’s version 2.19, CamelServlet is by default set to “/camel”. So your url becomes:



          http://localhost:8080/demo/camel/hello 


          Update:
          You will also need to define following bean as you're using camel-servlet:



          @Bean
          public ServletRegistrationBean<Servlet> servletRegistrationBean() {
          ServletRegistrationBean<Servlet> registration = new ServletRegistrationBean<>(new CamelHttpTransportServlet(), "/camel/*");
          registration.setName("CamelServlet");
          return registration;
          }


          Or instead of camel-servlet dependency, you should add camel-servlet-starter dependency






          share|improve this answer















          As of Camel’s version 2.19, CamelServlet is by default set to “/camel”. So your url becomes:



          http://localhost:8080/demo/camel/hello 


          Update:
          You will also need to define following bean as you're using camel-servlet:



          @Bean
          public ServletRegistrationBean<Servlet> servletRegistrationBean() {
          ServletRegistrationBean<Servlet> registration = new ServletRegistrationBean<>(new CamelHttpTransportServlet(), "/camel/*");
          registration.setName("CamelServlet");
          return registration;
          }


          Or instead of camel-servlet dependency, you should add camel-servlet-starter dependency







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 21 '18 at 19:00

























          answered Nov 21 '18 at 8:34









          Sukhpal SinghSukhpal Singh

          994212




          994212













          • Hi Sukhpal, Thank you for the response. I tried the above mentioned link, but I still get a 404 response back. Perhaps, there is another issue in the project as well.

            – Rachel217
            Nov 21 '18 at 16:17











          • @Rachel217 Which version of camel spring boot starter are you using? Do check servlet-component

            – Sukhpal Singh
            Nov 21 '18 at 17:14











          • Sukhpal, I have now added a list of all my maven dependencies in the above question in case there is a mistake there. I am using camel-spring-boot-starter version 2.22.2 which is the same as the camel-core version. With these, I am using Java 8. Thanks!

            – Rachel217
            Nov 21 '18 at 17:55











          • Looking more closely at my Maven dependencies, there may be some unnecessary ones there, like javax.servlet-api and spring-boot-starter-web-services. I tried removing these, and nothing changed in the app's log output.

            – Rachel217
            Nov 21 '18 at 18:16











          • Thank you Sukhpal! I added the camel-servlet-starter dependency instead of the camel-servlet dependency, and it works now. Much appreciated!

            – Rachel217
            Nov 21 '18 at 21:10



















          • Hi Sukhpal, Thank you for the response. I tried the above mentioned link, but I still get a 404 response back. Perhaps, there is another issue in the project as well.

            – Rachel217
            Nov 21 '18 at 16:17











          • @Rachel217 Which version of camel spring boot starter are you using? Do check servlet-component

            – Sukhpal Singh
            Nov 21 '18 at 17:14











          • Sukhpal, I have now added a list of all my maven dependencies in the above question in case there is a mistake there. I am using camel-spring-boot-starter version 2.22.2 which is the same as the camel-core version. With these, I am using Java 8. Thanks!

            – Rachel217
            Nov 21 '18 at 17:55











          • Looking more closely at my Maven dependencies, there may be some unnecessary ones there, like javax.servlet-api and spring-boot-starter-web-services. I tried removing these, and nothing changed in the app's log output.

            – Rachel217
            Nov 21 '18 at 18:16











          • Thank you Sukhpal! I added the camel-servlet-starter dependency instead of the camel-servlet dependency, and it works now. Much appreciated!

            – Rachel217
            Nov 21 '18 at 21:10

















          Hi Sukhpal, Thank you for the response. I tried the above mentioned link, but I still get a 404 response back. Perhaps, there is another issue in the project as well.

          – Rachel217
          Nov 21 '18 at 16:17





          Hi Sukhpal, Thank you for the response. I tried the above mentioned link, but I still get a 404 response back. Perhaps, there is another issue in the project as well.

          – Rachel217
          Nov 21 '18 at 16:17













          @Rachel217 Which version of camel spring boot starter are you using? Do check servlet-component

          – Sukhpal Singh
          Nov 21 '18 at 17:14





          @Rachel217 Which version of camel spring boot starter are you using? Do check servlet-component

          – Sukhpal Singh
          Nov 21 '18 at 17:14













          Sukhpal, I have now added a list of all my maven dependencies in the above question in case there is a mistake there. I am using camel-spring-boot-starter version 2.22.2 which is the same as the camel-core version. With these, I am using Java 8. Thanks!

          – Rachel217
          Nov 21 '18 at 17:55





          Sukhpal, I have now added a list of all my maven dependencies in the above question in case there is a mistake there. I am using camel-spring-boot-starter version 2.22.2 which is the same as the camel-core version. With these, I am using Java 8. Thanks!

          – Rachel217
          Nov 21 '18 at 17:55













          Looking more closely at my Maven dependencies, there may be some unnecessary ones there, like javax.servlet-api and spring-boot-starter-web-services. I tried removing these, and nothing changed in the app's log output.

          – Rachel217
          Nov 21 '18 at 18:16





          Looking more closely at my Maven dependencies, there may be some unnecessary ones there, like javax.servlet-api and spring-boot-starter-web-services. I tried removing these, and nothing changed in the app's log output.

          – Rachel217
          Nov 21 '18 at 18:16













          Thank you Sukhpal! I added the camel-servlet-starter dependency instead of the camel-servlet dependency, and it works now. Much appreciated!

          – Rachel217
          Nov 21 '18 at 21:10





          Thank you Sukhpal! I added the camel-servlet-starter dependency instead of the camel-servlet dependency, and it works now. Much appreciated!

          – Rachel217
          Nov 21 '18 at 21:10




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53407343%2fgetting-404-not-found-error-from-basic-spring-boot-camel-rest-dsl-request%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          鏡平學校

          ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

          Why https connections are so slow when debugging (stepping over) in Java?