Hi!
I have one CxfEnpoint configured by method hostCxfEndpointService. It
actually is found as I send to it from route:
.to("cxf:bean:hostCxfEndpointService")
But the second one called hostCxfEndpointInformation could not be found.
I use Camel 3.11 and have tried with 3.13. Code is following, the
exception is placed below.
What do I do wrong?
@Configuration public class HostCxfEndpointConfiguration {
@Bean public CxfEndpoint hostCxfEndpointService(CamelContext camelContext,
SpringBus springBus,
@Value("${app.host.card-service.wsdl-location}") String wsdlLocation,
@Value("${app.host.card-service.endpoint}") String endpointUrl) {
return createHostEndpoint(camelContext,
springBus,"hostCxfEndpointService", wsdlLocation, endpointUrl,
CardService.class);
}
@Bean public CxfEndpoint hostCxfEndpointInformation(CamelContext
camelContext,
SpringBus springBus,
@Value("${app.host.card-information.wsdl-location}") String wsdlLocation,
@Value("${app.host.card-information.endpoint}") String endpointUrl) {
return createHostEndpoint(camelContext,
springBus,"hostCxfEndpointInformation", wsdlLocation, endpointUrl,
CardInformation.class);
}
//
https://blog.codecentric.de/en/2016/07/spring-boot-apache-cxf-logging-monitoring-logback-elasticsearch-logstash-kibana/
@Bean(name = Bus.DEFAULT_BUS_ID)
public SpringBus springBus() {
SpringBus springBus =new SpringBus();
LoggingFeature logFeature =new LoggingFeature();
logFeature.setPrettyLogging(true);
logFeature.initialize(springBus);
springBus.getFeatures().add(logFeature);
return springBus;
}
private CxfEndpoint createHostEndpoint(CamelContext camelContext,
SpringBus springBus,
String beanId,
String wsdlLocation,
String endpointUrl,
Class<?> tClass) {
CxfEndpoint endpoint =new CxfEndpoint();
endpoint.setBeanId(beanId);
endpoint.setAddress(endpointUrl);
endpoint.setCamelContext(camelContext);
endpoint.setDataFormat(DataFormat.POJO);
endpoint.setServiceClass(tClass);
endpoint.setWsdlURL(wsdlLocation);
endpoint.setSynchronous(true);
endpoint.setLoggingFeatureEnabled(true);
LoggingFeature logFeature =new LoggingFeature();
logFeature.setPrettyLogging(true);
logFeature.initialize(springBus);
endpoint.getFeatures().add(logFeature);
return endpoint;
}
}
org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>>
Bean[ref:cxf:bean:hostCxfEndpointInformation] <<< in route:
Route(route1)[From[direct://get-card-details] -> [Bean[com.p... because of No bean could be found
in the registry for: cxf:bean:hostCxfEndpointInformation
at
org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:240)
at
org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:74)
at
org.apache.camel.impl.DefaultModelReifierFactory.createRoute(DefaultModelReifierFactory.java:49)
at
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:851)
at
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:741)
at
org.apache.camel.impl.engine.AbstractCamelContext.doInit(AbstractCamelContext.java:2773)
at
org.apache.camel.support.service.BaseService.init(BaseService.java:83)
at
org.apache.camel.impl.engine.AbstractCamelContext.init(AbstractCamelContext.java:2491)
at
org.apache.camel.support.service.BaseService.start(BaseService.java:111)
at
org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2510)
at
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:246)
at
org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:119)
at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:151)
at
org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
at
org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
at
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:421)
at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:378)
at
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:938)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586)
at
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
at
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
at
org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:338)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1343)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1332)
at com.pf.product.card.CardApplication.main(CardApplication.java:21)
Caused by: org.apache.camel.NoSuchBeanException: No bean could be found in the
registry for: cxf:bean:hostCxfEndpointInformation
at
org.apache.camel.component.bean.RegistryBean.doGetBean(RegistryBean.java:134)
at
org.apache.camel.component.bean.RegistryBean.getBean(RegistryBean.java:102)
at
org.apache.camel.component.bean.RegistryBean.createCacheHolder(RegistryBean.java:95)
at
org.apache.camel.component.bean.DefaultBeanProcessorFactory.createBeanProcessor(DefaultBeanProcessorFactory.java:79)
at
org.apache.camel.reifier.BeanReifier.createProcessor(BeanReifier.java:48)
at
org.apache.camel.reifier.ProcessorReifier.makeProcessor(ProcessorReifier.java:838)
at
org.apache.camel.reifier.ProcessorReifier.addRoutes(ProcessorReifier.java:579)
at
org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:236)
... 26 common frames omitted
2021-12-25 21:03:22.263 DEBUG 60866 --- [ main]
o.s.b.a.ApplicationAvailabilityBean : Application availability state
ReadinessState changed to REFUSING_TRAFFIC
2021-12-25 21:03:22.263 DEBUG 60866 --- [ main]
ConfigServletWebServerApplicationContext : Closing
org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@5652f555,
started on Sat Dec 25 21:03:16 MSK 2021
2021-12-25 21:03:22.273 INFO 60866 --- [ main]
j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for
persistence unit 'default'
2021-12-25 21:03:22.274 INFO 60866 --- [ main]
com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2021-12-25 21:03:22.637 INFO 60866 --- [ main]
com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
Process finished with exit code 1
--
Vyacheslav Boyko
mailto:mail4...@gmail.com