FeignClient API-Call with application/x-www-form-urlencoded HEADER - spring-boot

i try to call an azure-api to get a access-token. With postman this work verry well. Now i'am trying to do it with spring boot and feign client.
The Azure-Api-Call need a application/x-www-form-urlencoded header. On the internet I found out that a lot of people have trouble fith feign and this header. I found a git-repro with an FormEncoder which should do the trick, but didn't.
So what i do:
I create a credentialObject with getter and setters which include grant_type, client_id, client_secret and the resource.
Second I create the client itself
import feign.Headers;
import feign.RequestLine;
import org.springframework.web.bind.annotation.RequestBody;
public interface AzureProvisioningClient {
#RequestLine("POST c760270c-f3da-4cfa-9737-03808ef5579f/oauth2/token")
#Headers("Content-Type: application/x-www-form-urlencoded")
Token getToken(#RequestBody Credentials credentials);
}
After that I use the feign.Build to uenter code herese the own Encoder which is suggested here https://github.com/OpenFeign/feign-form
AzureProvisioningClient azureProvisioningClient;
Credentials credentials = new Credentials();
credentials.setGrant_type("client_credentials");
credentials.setClient_id("b7021287-ec86-4864-acbe-0bd55b4e7adc");
credentials.setClient_secret("j7v/mxLDsTA9JIkiyev9/E3+vJdaWQ8Ilz/127ASwK4=");
credentials.setResource("https://management.azure.com/");
azureProvisioningClient = Feign.builder().encoder(new FormEncoder())
.target(AzureProvisioningClient.class, "https://login.microsoftonline.com/");
Token token = azureProvisioningClient.getToken(credentials);
If i run this example I get the following Error:
Caused by: feign.codec.EncodeException: class
de.telemotive.loggerIngressService.client.Credentials is not a type supported
by this encoder.
I also tried with the following: Instead of
Token getToken(#RequestBody Credentials credentials);
I try this: Token getToken(#Param("grant_type") String grant_type, #Param("client_id") String client_id .......);
and than
Token token = azureProvisioningClient.getToken("client_credentials", "b7021287-ec86-4864-acbe-0bd55b4e7adc", ......);
Now I get the following error:
Caused by: feign.FeignException: status 401 reading AzureProvisioningClient#getToken(String,String,String,String)
at feign.FeignException.errorStatus(FeignException.java:60) ~[feign-core-9.7.0.jar:na]
at feign.codec.ErrorDecoder$Default.decode(ErrorDecoder.java:89) ~[feign-core-9.7.0.jar:na]
at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:143) ~[feign-core-9.7.0.jar:na]
at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:77) ~[feign-core-9.7.0.jar:na]
at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:102) ~[feign-core-9.7.0.jar:na]
at com.sun.proxy.$Proxy237.getToken(Unknown Source) ~[na:na]
at de.telemotive.loggerIngressService.handler.LoggerDeleteListener.handleIncommingDelete(LoggerDeleteListener.java:38) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_181]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_181]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_181]
at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:181) ~[spring-messaging-5.0.10.RELEASE.jar:5.0.10.RELEASE]
at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:114) ~[spring-messaging-5.0.10.RELEASE.jar:5.0.10.RELEASE]
at org.springframework.cloud.stream.binding.StreamListenerMessageHandler.handleRequestMessage(StreamListenerMessageHandler.java:55) ~[spring-cloud-stream-2.0.1.RELEASE.jar:2.0.1.RELEASE]
... 29 common frames omitted
Hope you can help me :)

Related

Springboot Application fails after database restart

We have developed a Springboot Java application and using 1.5.6 version. Using spring data jpa and provided custom implementation as well.
If I restart DB and execute some operation then it throws an below error for the services which are annotated with #Transactional annotation. Though, its working well for other DAO repository call which are not annotated with this annotation. Also, if I restart my spring boot application then it works fine.
org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:431)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373)
at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:447)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:277)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:133)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:57)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy.$Proxy155.findOne(Unknown Source)
at au.com.outware.swepad.tasks.WorkOrderManagerTask.taskFetchAndProcessWorkOrderDetails(WorkOrderManagerTask.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:65)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.persistence.PersistenceException: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1692)
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1602)
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:1700)
at org.hibernate.jpa.internal.TransactionImpl.begin(TransactionImpl.java:48)
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.beginTransaction(HibernateJpaDialect.java:189)
at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:380)
... 30 common frames omitted
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:206)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.checkClosed(SQLServerConnection.java:724)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.setAutoCommit(SQLServerConnection.java:2615)
at sun.reflect.GeneratedMethodAccessor163.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java:126)
at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:108)
at org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.invoke(AbstractCreateStatementInterceptor.java:79)
at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:108)
at org.apache.tomcat.jdbc.pool.DisposableConnectionFacade.invoke(DisposableConnectionFacade.java:81)
at com.sun.proxy.$Proxy102.setAutoCommit(Unknown Source)
at org.hibernate.resource.jdbc.internal.AbstractLogicalConnectionImplementor.begin(AbstractLogicalConnectionImplementor.java:67)
at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.begin(LogicalConnectionManagedImpl.java:238)
at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.begin(JdbcResourceLocalTransactionCoordinatorImpl.java:214)
at org.hibernate.engine.transaction.internal.TransactionImpl.begin(TransactionImpl.java:52)
at org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1512)
at org.hibernate.jpa.internal.TransactionImpl.begin(TransactionImpl.java:45)
... 32 common frames omitted
2018-10-29 16:00:08,995 WARN pool-30-thread-1 org.hibernate.engine.jdbc.spi.SqlExceptionHelper - SQL Error: 0, SQLState: null
2018-10-29 16:00:08,996 ERROR pool-30-thread-1 org.hibernate.engine.jdbc.spi.SqlExceptionHelper - The connection is closed.
2018-10-29 16:30:00,017 INFO pool-13-threa
Herewith sharing the method which causing this issue:
#Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = true, isolation = Isolation.READ_UNCOMMITTED, transactionManager = AppConstants.CHILD_TRANSACTION_MANAGER)
public Map<String, Object> getParentIdFromChildsId(String childIds, int userId, int projectID) {
jdbcTemplate.query("EXEC getParentIdFromChildsId?,?,?", new Object[] { childIds, userId, projectID },
(rs, rowNum) -> {
List<String> list = new ArrayList<>();
list.add(0, rs.getString("parent_id"));
list.add(1, rs.getString("box_id"));
list.add(2, rs.getString("permission"));
return list;
});
}
Also we are Using org.apache.tomcat.jdbc.pool.DataSource connection pool.
Let me know if other details required. Please help me on this.
This is likely because all the connections in your connection pool are broken after restarting the database. I can't really explain why it doesn't happen with other methods, but maybe it's just a timing issue, where the connections get closed and reopened after they failed once.
If my suspicion is correct setting testOnBorrow to true should solve the issue. This answer describes how to do that in Spring Boot:
spring.datasource.tomcat.testOnBorrow=true
spring.datasource.tomcat.validationQuery=SELECT 1

JobInstanceAlreadyCompleteException when running a Batch-Task in Spring cloud Dataflow

I have a Batch job working as a Task in spring cloud dataflow. When i try to execute the same task Definition a second time i get the exception:
java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:793)
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:774)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:335)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1234)
at com.tigerbooks.importer.ImportTask.main(ImportTask.java:20)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException: A job instance already exists and is complete for parameters={-spring.cloud.task.executionid=3, -spring.datasource.username=dataflow_stage, -spring.datasource.url=jdbc:mysql://10.59.254.101:3306/dataflow_staging, -spring.datasource.driverClassName=org.mariadb.jdbc.Driver, -import.import-audio-content=false, -spring.datasource.password=bVs64CMlKvcTdkRLWL2zNPANYD3HMB, -import.syncfolder=/import-integrationtest, -spring.cloud.task.name=Integration-Test, -spring.profiles.active=ftp01,dev}. If you want to run this job again, change the parameters.
at org.springframework.batch.core.repository.support.SimpleJobRepository.createJobExecution(SimpleJobRepository.java:130)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:338)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:197)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java
My Job configuration looks like this:
#EnableBatchProcessing
public class JobConfiguration {
#Bean
public Job importJob() {
return jobBuilderFactory.get("Import-Products").incrementer(new RunIdIncrementer())
.flow(step1())
.next(step2())
.end()
.build();
}
}
As far as i found out, a JobParametersIncrementor is supposed to fix this exception by adding a incrementing runId to the parameters. But in my case i can only run the job once on the server, then i have to clear the database (mysql) and the RunId is nowhere in the database.
As #Michael Minela already guessed my jobs where started with the wrong docker image-version. So the RunIdIncrementer was not present and it did not work.
After registering a new app with the correct version everything worked. Thanks.

Class Cast Exception when using spring API for Unmarshalling xml

Below is the error message :
INFO [integration.ordXX.controller.PaymentOrder] (http-127.0.0.1:7070-1) ......Request Received for the ordergetPackagesToScan : [Ljava.lang.String;#6472d5b3
2017-06-20 14:57:02,989 ERROR [integration.ordXX.controller.PaymentOrder] (http-127.0.0.1:7070-1) Error in submit method: java.lang.ClassCastException: integration.ordXX.request.Order cannot be cast to javax.xml.bind.JAXBElement
at integration.ordXX.controller.PaymentOrder.submit(PaymentOrder.java:72) [classes:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_111]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_111]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_111]
at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_111]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) [spring-web-4.3.6.RELEASE.j
Here we are using spring API :
//JAXBElement<Order> element = (JAXBElement<Order>) convertor.unmarshal(ordXXReqMarshaller, orderXml);
Order ord=(Order)JAXBIntrospector.getValue(ordXXReqMarshaller.unmarshal(new StreamSource(new StringReader(orderXml))));
//order = element.getValue();
We are trying to unmarshall the xml object with above code but we are getting exception on top of code.
When we tried to achieve the same with camel route it is successful.
Can someone help me please?
Camel route used
from("read from file")
.unmarshall()
.jaxb("package")
.process(new TestProcess())
.to()

Indcredible mistake ent.SuperStudentEntity cannot be cast ent.SuperStudentEntity

Hibernate+Spring Boot
i can not get object
My controller
#RequestMapping(value = "/get/{id}", method = RequestMethod.GET)
public #ResponseBody
SuperStudentEntity getById(#PathVariable("id") int id) {
return new StudentDAOImpl().getById(id);
}
DAO function
public SuperStudentEntity getById(int id){
openTransactionSession();
Session s = getSession();
String sql = "SELECT * FROM student WHERE id_student =:id";
org.hibernate.query.Query query = s.createNativeQuery(sql).addEntity(SuperStudentEntity.class);
query.setParameter("id",id);
SuperStudentEntity student = (SuperStudentEntity) query.getSingleResult();
closeTransactionSesstion();
return student;
}
And get exceptions
java.lang.ClassCastException: org.codexample.ent.SuperStudentEntity cannot be cast to org.codexample.ent.SuperStudentEntity
at org.codexample.impldao.StudentDAOImpl.getById(StudentDAOImpl.java:45) ~[classes/:na]
at org.codexample.controllers.StudentController.getById(StudentController.java:54) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_101]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_101]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_101]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_101]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at ....
And browser tell me :
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Thu May 18 20:02:30 MSK 2017 There was an unexpected error (type=Internal Server Error, status=500). org.codexample.ent.SuperStudentEntity cannot be cast to org.codexample.ent.SuperStudentEntity
I don't understand how resolve it problem.

How to have multiple Camel Rest DSL definitions with Swagger

I am using Camel 2.16.0 with camel-netty4-http, camel-swagger-java and camel-spring-boot in a Spring-boot application. My SpringBootRouter is configured in the following way:
public void configure() {
restConfiguration()
.component("netty4-http")
.bindingMode(RestBindingMode.json)
.dataFormatProperty("prettyPrint", "true")
.host("0.0.0.0")
.contextPath("/")
.port(port)
.apiContextPath("/api-doc")
.apiProperty("api.title", "User API")
.apiProperty("api.version", "1.2.3")
.apiProperty("cors", "true");
rest("/hello").description("Say hello.")
.produces("application/json")
.get().description("Get hello.").route().transform(constant("hello"));
rest("/hi").description("Say hi.")
.produces("application/json")
.get().description("Get hi.").route().transform(constant("hi"));
}
How can I have multiple rest definitions with Swagger? The configuration above gives me just the exception below. However, if I remove the other rest definition rest("/hi") then Swagger is working just fine.
The exception:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.springframework.boot.maven.RunMojo$LaunchRunner.run(RunMojo.java:423)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.camel.spring.boot.CamelSpringBootInitializationException: org.apache.camel.FailedToStartRouteException: Failed to start route route4 because of Multiple consumers for the same endpoint is not allowed: Endpoint[http://0.0.0.0:10000/api-doc?httpMethodRestrict=GET]
at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:81)
at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:37)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:331)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:775)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:139)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:117)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:689)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
at org.apache.camel.spring.boot.FatJarRouter.main(FatJarRouter.java:26)
... 6 more
Caused by: org.apache.camel.FailedToStartRouteException: Failed to start route route4 because of Multiple consumers for the same endpoint is not allowed: Endpoint[http://0.0.0.0:10000/api-doc?httpMethodRestrict=GET]
at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:3473)
at org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:3449)
at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3379)
at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3147)
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3003)
at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:172)
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2799)
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2795)
at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2818)
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2795)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2764)
at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:79)
... 17 more
Yeah that is a bug in Apache Camel. I have logged a ticket:
https://issues.apache.org/jira/browse/CAMEL-9247

Resources