You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Mauro Filanti (Jira)" <ji...@apache.org> on 2020/06/03 09:54:00 UTC

[jira] [Commented] (CAMEL-14740) spring-boot - Error binding property in servlet-starter

    [ https://issues.apache.org/jira/browse/CAMEL-14740?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17124815#comment-17124815 ] 

Mauro Filanti commented on CAMEL-14740:
---------------------------------------

Hi guys,

I'm trying to test this but I cannot invoke any rest api with context's configuration via application.properties. 

I have
 * spring-boot 2.2.7.RELEASE
 * camel 3.3.0

application.properties
{code:java}
camel.component.servlet.mapping.enabled=true
camel.component.servlet.mapping.context-path=/rest/*camel.rest.component=servlet
camel.rest.binding-mode=json
{code}
 
 a simple route
{code:java}
rest().get("/api")
    	.to("direct:hello");
{code}
and I got nothing in [http://localhost:8080/rest/api].

But if I put the servlet registration as java code
{code:java}
    @Bean
    public ServletRegistrationBean camelServletRegistrationBean() {
      ServletRegistrationBean registration = new ServletRegistrationBean(new CamelHttpTransportServlet(), "/rest/*");
      registration.setName("CamelServlet");
      return registration;
    }
{code}
then it works.

I don't know if this must go in another issue, so let me know.

Thanks!

> spring-boot - Error binding property in servlet-starter
> -------------------------------------------------------
>
>                 Key: CAMEL-14740
>                 URL: https://issues.apache.org/jira/browse/CAMEL-14740
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-servlet
>            Reporter: Efanov Alexey
>            Priority: Major
>              Labels: starter
>             Fix For: 3.2.0
>
>
> Hi,
> I have this dependencies
> {code:java}
> // Camel
> implementation 'org.apache.camel.springboot:camel-spring-boot-starter:3.1.0'
> implementation 'org.apache.camel.springboot:camel-jackson-starter:3.1.0'
> implementation 'org.apache.camel.springboot:camel-jacksonxml-starter:3.1.0'
> implementation 'org.apache.camel.springboot:camel-activemq-starter:3.1.0'
> implementation 'org.apache.camel.springboot:camel-servlet-starter:3.1.0'
> implementation 'org.apache.camel.springboot:camel-rest-starter:3.1.0' {code}
> My application.properties
> {code:java}
> camel.component.servlet.mapping.enabled=true
> camel.component.servlet.mapping.context-path=/rest/*
> camel.rest.component=servlet
> camel.rest.binding-mode=json{code}
> When i run application i see this stacktrace
> {code:java}
>  Exception in thread "CamelMainRunController" java.lang.RuntimeException: org.apache.camel.PropertyBindingException: Error binding property (camel.component.servlet.mapping.enabled=true) with name: mapping.enabled on bean: org.apache.camel.component.servlet.ServletComponent@62562970 with value: true
> 	at org.apache.camel.spring.boot.CamelSpringBootApplicationController.run(CamelSpringBootApplicationController.java:90)
> 	at org.apache.camel.spring.boot.CamelMainRunController$DaemonTask.run(CamelMainRunController.java:53)
> 	at java.base/java.lang.Thread.run(Thread.java:834)
> Caused by: org.apache.camel.PropertyBindingException: Error binding property (camel.component.servlet.mapping.enabled=true) with name: mapping.enabled on bean: org.apache.camel.component.servlet.ServletComponent@62562970 with value: true
> 	at org.apache.camel.main.BaseMainSupport.setPropertiesOnTarget(BaseMainSupport.java:176)
> 	at org.apache.camel.main.BaseMainSupport.autoConfigurationFromProperties(BaseMainSupport.java:993)
> 	at org.apache.camel.main.BaseMainSupport.autoconfigure(BaseMainSupport.java:545)
> 	at org.apache.camel.main.BaseMainSupport.postProcessCamelContext(BaseMainSupport.java:587)
> 	at org.apache.camel.main.BaseMainSupport.initCamelContext(BaseMainSupport.java:423)
> 	at org.apache.camel.main.Main.doInit(Main.java:109)
> 	at org.apache.camel.support.service.ServiceSupport.init(ServiceSupport.java:83)
> 	at org.apache.camel.support.service.ServiceSupport.start(ServiceSupport.java:112)
> 	at org.apache.camel.main.MainSupport.run(MainSupport.java:82)
> 	at org.apache.camel.spring.boot.CamelSpringBootApplicationController.run(CamelSpringBootApplicationController.java:85)
> 	... 2 more
> {code}
> It always throw error on any first servlet property in configuration but all servlet properties binds correctly and works.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)