cxf,apache-camel , CXF endpoint definition, and Failed to resolve endpoint:No bean could be found in the registry


CXF endpoint definition, and Failed to resolve endpoint:No bean could be found in the registry

Question:

Tag: cxf,apache-camel

I try to define a CXF endpoint, but the it doesn't work. When I want to address the endpoint then I'v got the "bean not found" exception.

CXF definition:

    @Override
    public void configure() throws Exception
    {

        errorHandler(deadLetterChannel(systemInfo.getQueuName())
                .allowRedeliveryWhileStopping(true)
                .maximumRedeliveries(-1)
                );

        onException(Exception.class).process(routeHandlingBean);


        CamelContext camelContext = getContext();

        CxfEndpoint partnerTestService = new CxfEndpoint();
        partnerTestService.setEndpointNameString("partnerTestService");
        partnerTestService.setAddress("http://localhost:9081/MockPartnerService");
        partnerTestService.setWsdlURL("http://localhost:9081/MockPartnerService?wsdl");
        partnerTestService.setServiceClass(aaa.bbb.ccc.service.PartnerService.class);
        partnerTestService.setServiceNameString("partnerTestService");
        partnerTestService.setDataFormat(DataFormat.CXF_MESSAGE);
        partnerTestService.setCamelContext(camelContext);

        try {
            camelContext.addEndpoint("partnerTestService", partnerTestService);
        } catch (Exception e) {
            e.printStackTrace();
        }

When I try to call the endpoint:

cxf:bean:partnerTestService

Then I have got this error message:

org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: cxf://bean:partnerTestService due to: No bean could be found in the registry for: partnerTestService of type: org.apache.camel.component.cxf.CxfEndpoint

I don't know what else I have to set up.

Thx! Feri


Answer:

The solution is the usage of CxfEndpoint class. I wrote a function what gives back a needed object (instead of string endpoint), and so it is work.

The route definition:

    ValueBuilder dynRouterMethod = method(esbDynRouter, "endpointRoute");

    from(queueName).id(systemInfo.getRouteId()).routeId(systemInfo.getRouteId()).autoStartup(false)
    .transacted()
    .log(LoggingLevel.INFO, systemInfo.getRouteId() + " route usage.")
    .beanRef("statusUpdaterBean", "updateSendingStatus")
    .dynamicRouter(dynRouterMethod)
    .beanRef("statusUpdaterBean", "updateSentStatus")
    ;

The procedure (it called in dynamic router procedure):

private CxfEndpoint getCxfEndpoint(DispConfView target) throws Exception
    {
        CxfEndpoint cxfEndpoint = (CxfEndpoint) camelContext.getEndpoint(<Something>);

        if (cxfEndpoint == null)
        {
            String serviceClassNme = <class name what represent the POJO class>;
            String methodName = <WS methode name>;

            cxfEndpoint = new CxfEndpoint();
            cxfEndpoint.setAddress(methodName);
            cxfEndpoint.setDataFormat(DataFormat.POJO);
            cxfEndpoint.setServiceClass(serviceClassNme);

            cxfEndpoint.setCamelContext(camelContext);

            camelContext.addEndpoint(<Something>, cxfEndpoint);
        }

        return cxfEndpoint;
    }

This solution work if the message is POJO-type.


Related:


CamelContext doesn't startup if one route is misconfigured


java,apache-camel
We use Java DSL to configure our routes. All configurations for routes are in a db table and can be configured via a GUI. How is it possible to ensure that the camelContext starts up even if a route is misconfigured (e.g. .to(invalidurl or typo) in a route or simply...

JBoss Fuse container: Karaf or Wildfly


apache-camel,jbossfuse
What is the recommended container for JBoss Fuse 6.1: Apache Karaf or JBoss Enterprise Application Server? Since things like datasource configuration are much easier in an application server environment compared to that of Karaf, I am tilted towards Wildfly. But I am unsure if the choice of Wildfly is at...

Why wsdl2java generated code use CXF dependencies at will?


maven,cxf,jax-ws,wsdl2java
I use Apache CXF 3.0.4 wsdl2java to generate code from this wsdl with following command: ./wsdl2java -client -exsh true -d weather -p weather -verbose url As far as I know wsdl2java generates pure java code using only JAX-WS. Generated code works fine without any additional library/dependency. I've grepped it to...

Camel file component URI format


java,apache-camel
Camel file component supports two notations for URI format: file:directoryName[?options] file://directoryName[?options] Why does the second one exist? It is less readable, especially when using Unix-like absolute paths, which is a frequent use case. In general, should I give preference to one over the other?...

Cannot connect to websocket server using AHC-WS component in Apache Camel


apache-camel,slack-api
I'm using ACH-WS component in Apache Camel to connect to a websocket server using WSS (Slack's websocket server to be more precise). I have a route like this one: from("ahc-wss://host") .log(...) .to(...) When I init my app I see the following log: Route: wss-inbound-event started and consuming from: Endpoint[ahc-wss://ms109.slack-msgs.com/websocket/....] However...

Expose RAML contract instead WADL in CXF


rest,cxf,wadl,cxfrs,raml
I am new in REST world, an in most of CXF examples that I saw there is an configuration to expose WADL in REST services when published. Something like Available RESTful services: Endpoint address: http://localhost:8080/ouat-servicesImpl/api WADL : http://localhost:8080/ouat-servicesImpl/api?_wadl Then, when clicked <application> <grammars/> <resources base="http://localhost:8080/ouat-servicesImpl/api"> <resource path="/topics"> <method name="POST"> <request>...

Multiple Connection Factories


java,spring,apache-camel,activemq,javabeans
I'm using spring boot and setting up multiple connection factories (pooled and jms). The issue I'm getting is that it seems to be trying to autowire them to the same object in javax.jms.ConnectionFactory. So its resulting in this exception: Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.jms.ConnectionFactory org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration.connectionFactory; nested...

How to add command line argument to a web application(Spring MVC)


web-applications,wsdl,cxf,command-line-arguments
I'm working on a web project that uses Apache CXF and web services, which i use to hit a request to server and get the response back. The server(Actually the service provider) had given me some username and password. Now, when I run my request as a java application...

Getting Apache Camel to stop retrying if failed to move the file after route completion


java,file-io,exception-handling,locking,apache-camel
The example route below picks up a file and performs a series of operations on them. Once completed, as noted in the camel:from field, the route is instructed to move the file to a .processed directory. Alternatively if failed, move it to the .error folder. The problem occurs when another...

Camel Multi-threaded Consumer


java,multithreading,apache-camel,producer
I have a DB with orders, each with a due date and a creation date. I want to pull a maximum of 4 orders into route and process them simultaneously. Each order may take between 10-20 minutes to process. But I would like to keep all threads going as much...

Sending mail with a custom MIME Message using Camel


java,email,apache-camel,spring-integration
I want to send a multipart MIME message (custom headers, plain text and HTML) using Camel. I can see in the source code that if I send a javax.mail.internet.MimeMessage in the body of a Camel message to the mail component, it send it without creating a new one. But in...

Java & Apache-Camel: From direct-endpoint to file-endpoint


java,apache-camel
I've tried to build a route to copy files from one directory to an other directory. But instead of using: from(file://source-directory).to(file://destination-directory) I want to do something like this: from(direct:start) .to(direct:doStuff) .to(direct:readDirectory) .to(file://destination-folder) I've done the following stuff: Route @Component public class Route extends AbstractRouteBuilder { @Override public void configure() throws...

Camel Thread Id changing when calling http component


java,redis,apache-camel
My route is like this: from(rabbitmq). to(redisLockerProcessor). to(processor1). to(ahc://http:).to(processor2) .to(redisLockReleaseProcessor) I am using redisson library which stores thread id which took the lock in redis. But in redisLockReleaseProcessor it is throwing exception that thread id is not same as thread id which took the lock. How does http components thread...

Refactoring some legacy camel code, is this code unnecessary or am I missing something?


jboss,apache-camel,jbossfuse
I'm refactoring some apache camel legacy code in a JBoss Fuse instance and I've run into some code that I'm not sure what it's purpose is for. <when condition> <loadBalance id="someVar"> <failover roundRobin="true" maximumFailoverAttempts="3" /> <to uri="fabric:FABRICENDPOINT" /> </loadBalance> </when> I haven't used Fabric's load balancer before but from what...

Pros and Cons of setting Lot of headers in Camel Exchange


apache-camel
I would like to know few things about Camel Headers what are the pros and cons of setting too many headers in camel Exchange? what are the pros and cons of setting too large headers in camel Exchange? ...

error while calling soap ws with basic authentification and ssl


java,ssl,soap,cxf,basic-authentication
I am facing problem when calling two remote methods from different wsdl which are protected by basic authentication and ssl the first call is OK but the second call of the second method which is located on an other wsdl don't work when i call the second method first it...

Changing default settings for JMS messaging in Camel


apache-camel
I've found only a way to specify JMS settings directly on end points, but I would like to change default values, so that we do not have to remember to set the same value on each endpoint. Below there are few examples of properties which I would like to set...

CXF SOAP Client outbound message has empty body


java,cxf,soap-client
I had generated a set of classes using WSDL2Java and had built a testing client to try invoke the SOAP Service. The classes are generated, but when I call the web service, i notice that the body of the outbound message is empty. The following is some info on the...

apache camel route to split sql results


mysql,jdbc,apache-camel
I am trying to do is select all rows from DB, and for each row update some column for that row. Below is my camel route. from("direct:insert"). from("sql:select * from my_table"). split(body()). log("${body[id]}"). end(); I use the below code to start this route... context.createProducerTemplate().sendBody("direct:insert", null); Problem is it happens multiple...

Camel Redirecting to another route on throttling


apache-camel,throttling
I have a camel route which will be throttled on recieving loads of messages. Suppose the maximum exchanges i defined is 3 per 2 seconds and the route recieves more than the limit i want to redirect those messages to some other load balancer route. Can someone help me how...

Can anyone tell me how to test my Camel Route if I have a choice operation?


java,unit-testing,testing,apache-camel
I have a Camel route that has implemented a Content based Routing EIP(Choice operation). I need to test it. I'm new to Camel. So, I'm unsure how to do it. Can anyone tell me how to test this operation. I have mentioned a sample code below that has to be...

Mocking test class Spring camel


junit,apache-camel,spring-test
I am new to camel. I am trying to write a test case. public class A { private B b; public void update(String s){ //calling some methods on B ..... } } Test class public class TestA extends CamelSpringTestSupport { private ClassPathXmlApplicationContext xmlAppContext; @Test public void testA() { String xml...

Failed to deploy quickstart to Fabric8 on Jube


java,maven,apache-camel,jbossfuse,fabric8
I'm running Fabric8 2.1.5 version with Jube on my local Win7 PC, and trying to follow the documentation to deploy the Camel-Spring quickstart When I run "mvn fabric8:deploy" under quickstarts/java/camel-spring folder, I got the following error: [ERROR] Failed to execute goal io.fabric8:fabric8-maven-plugin:2.1.5:deploy (default-cli) on project quickstart-java-cam el-spring: Error executing: Failed...

Where I can find my WADL? (CXF)


java,web-services,rest,cxf
I have developed a simple RESTful service using Apache CXF coupled in a web application and is working fine. I Can access it on "http://localhost:8080/SpringRestProjectJava/api/books/1234" and I am also getting the proper JSON response. My understanding is that from this link that WADL will be autogenerated. Is it correct? If...

Camel pollEnrich and xml 'prettyPrint'


apache-camel
I am attempting to use Camel's pollEnrich feature, but it is not behaving as I would like... I'm not saying it's broken, but wondering if there is a way to get the behavior I desire. That is, I have an XML (blueprint) defined route that goes something like this: <route>...

Camel JMS - does it pull messages from queue in a loop?


apache-camel,activemq
I've enabled JMS transactions as described in this document: http://camel.apache.org/transactional-client.html My queue subscriber is registered as follows: from("jms:queue:xyz).to(MyBean.class) There are no messages on this queue, but I can see in Camel log, that it starts and ends multiple JMS transactions and this happens multiple times with different thread id. This...

Apache Camel CXF


java,soap,apache-camel
Camel Configuration was working fine with v 2.13.4. After migrating to v 2.15.1 I am getting following error: Caused by: org.springframework.beans.FatalBeanException: Invalid NamespaceHandler class [org.apache.camel.component.cxf.spring.NamespaceHandler] for namespace [http://camel.apache.org/schema/cxf]: problem with handler class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=org/apache/camel/component/cxf/spring/NamespaceHandler, offset=6 at...

Create Enveloped Signature with CXF and WSS4J


java,soap,cxf,jax-ws,xml-signature
I am currently creating a SOAP-Client in Java with help of Apache CXF. I've generated the Service classes from a given WSDL and configure the client programmatically.(Just to make clear, that I'm not using Spring configuration). The service I'm calling has the requirement that each Request I send, needs to...

How can I add a session/login servlet to get a session object for a Spring - Apache CXF backend?


spring,spring-mvc,servlets,cxf,jax-rs
I have a whole lot of REST webservices developed with CXF and managed in a spring application container, and I have been tasked with creating a servlet that will create a session object that will store attributes which will be read within the Jax-RS services. I have tried just adding...

How to access exception in Camel errorHandler?


java,exception-handling,apache-camel
Use Case I'd like to log unhandled exceptions for a particular route in Camel in a reusable manner. Specifically, I'd like to extract enough information from the exception and write it to the database, which is then read by some monitoring software. Through the use of a dead letter queue,...

What exactly does multicast() do?


apache-camel
What's the exact difference between from("stream:in") .to("stream:out", "stream:err"); and from("stream:in") .multicast() .to("stream:out", "stream:err"); ?...

Camel Delete File Exception


java,file,apache-camel
When I am trying to process a file in Camel and it fails I try to move the file to an error directory but get the following error message: org.apache.camel.component.file.GenericFileOperationFailedException: Cannot delete file:.... I don't know if Windows is locking the file, but I have closed any streams that may...

Automatic conversion to JSON when using ProducerTemplate


apache-camel
I would like to send JMS messages containing Java POJOs to ActiveMQ and all messages should be converted to JSON documents. So I need mechanism that will convert POJO to JSON and will send created document as text message to ActiveMQ. I would like to use ProducerTemplate#send(...) method without need...

Is there a way I can autowire a bean in my route without using the .bean keyword in Camel?


java,spring,apache-camel,javabeans,autowired
Lets say for example, I have the following route: from(.....) .choice() .when(condition1) .bean(Class1.class,"method1") .when(condition2) .bean(Class1.class,"method2") .otherwise() .bean(Class1.class,"method3") .end(); Is there a way I can autowire Class1 to use all the methods instead of using the .bean function in camel. If you know any other efficient method. Please do let me...

How to log soap requests response time with cxf on the client side?


java,web-services,soap,cxf
I'm using cxf to build a client on a soap webservice. Is there any cxf interceptor feature that could automatically measures and logs the webservice response time? I'm already using org.apache.cxf.interceptor.LoggingInInterceptor and LoggingOutInterceptor for logging the xml content itself....

Camel Multicast; Direct and AMQ


java,web-services,soap,apache-camel,activemq
I have a Generic Camel Route which listens to a CXF:Bean(SOAP) Request with DataFormat: POJO. What I want this route to do is multicast the incoming exchange to AMQ JMS Queue, which will be consumed by another internal route at a later point and the other endpoint is a direct:Endpoint...

Extract data from JSON in vanilla Java/Camel/Spring


apache-camel,activemq,jolokia
I am trying to write a Camel route to get JMX data from an ActiveMQ server through the Jolokia REST API. I was able to successfully get the JSON object from the ActiveMQ server, but I am running into an issue where I cannot figure out how to parse the...

Camel netty component example doesn't work, within Spring MVC


spring,apache-camel,netty
I've tried out a good looking example in this topic ( http://shengwangi.blogspot.hu/2015/01/camel-netty-hello-world-simple-example.html ), but it doesn't work for me. I would like to create an simple workable TCP adapter, which uses an own encoder and decoder. At first I check out above example ( it uses a simple String encoder...

Mule: Migrating to the New HTTP Connector


http,mule,cxf
I've upgraded from Mule 3.5.x to 3.6.x and since the old http transport is deprecated in 3.6.x I wanted to migrate to the new HTTP connector. Here is the original code for calling my webservice: <http:outbound-endpoint ref="OrderEndpoint" doc:name="GetApprovedOrder"> <cxf:jaxws-client serviceClass="com.acme.orders.IOrderServiceBean" port="OrderServiceBean_v2_0Port" operation="getApprovedOrderOp" /> </http:outbound-endpoint> The point I have got to...

Camel requestBodyAndHeaders() doesn't return the route result


apache-camel
I have a Camel route with split/aggregate: from("seda:start") .routeId("camelRoute") .log("Request: ${body}") .split() .method(SplitService.class, "splitRequest") .parallelProcessing() .bean(SendToWorker.class, "sendToQ1(${body}, ${headers})") .aggregate(header("corrID"), new CustomAggregationStrategy()).completionSize(5) .log("Aggregated ${body}") .bean(SendToWorker.class, "sendToQ2(${body}, ${headers})") .log("Response: ${body}"); The last log displays the result correctly. When I call it as @Autowired private ProducerTemplate...

Why Does This Apache Camel Route Not Convert JSON to XML?


java,json,xml,apache-camel
I am trying to convert some JSON to XML using an Apache Camel route. Below is the code with the route in it, listing 1. The code that calls this code is the second source code segment, listing 2. The JSON that I want to convert to XML is in...

cxf request scoped bean not working in unit test (soap)


web-services,unit-testing,soap,scope,cxf
CXF soap application, using following versions: springBootVersion = 1.2.3.RELEASE springVersion = '4.1.6.RELEASE' cxfVersion = '3.1.0' junitVersion = '4.12' I have a spring bean with a request scope: @Component @Scope( value=WebApplicationContext.SCOPE_REQUEST, proxyMode = ScopedProxyMode.TARGET_CLASS ) public class RequestScopedClass which I fetch dynamically from ApplicationContext in my CXF endpoint implementation: @Component @WebService(endpointInterface...

Automatically restore connection to the main queue when server is up again


java,jms,apache-camel,websphere-mq
I have a master MQ and a slave MQ. If the master MQ goes down, can I send the messages through the slave MQ using a message driven bean ? Also after my master MQ is up again can I reconnect the line automatically without restarting the JVM ?

Database not update when using apache camel sql component


apache-camel
I'm trying to use apache camel (sql component) to update the DB. Problem is that the DB just doesn't get updated. The sql:update is working fine when i hard code the query, but when i try to use ${body[0][id]} it doesn't update required field. Any feedback on what might be...

Throttle requests in camel not working


groovy,apache-camel,throttle,eip
Below are my 3 routes in my base groovy routes class deployed as base framework. from("jms:queue:EndPoint1?concurrentConsumers=100") .routePolicyRef("myPolicy") .transacted() .log("Recieved From Endpoint1") /*.to("log:Recieved From Endpoint1?groupSize=100")*/ .to("CommonEndpoint"); from("jms:queue:EndPoint2?concurrentConsumers=50") .rootPolicyRef("myPolicy") /*.to("log:Recieved From Endpoint2?groupSize=100")*/ .log("Recieved From Endpoint2") .to("CommonEndpoint"); from("CommonEndpoint") .delay(50)...

How to transfer files in order (first come first serve) using apache camel


spring,apache-camel
In my code there are two types of files with extension .csv or .psv and .tigger files. .csv files have more size than .trigger files, so .trigger files are getting transfer in prior to .csv files. How to make sure that once .csv files are transferred only .trigger files should...

How To Disable Camel HTTP Endpoint Stream Caching When Using Servlet in OSGi


apache-camel
I'm using an Apache Camel route to receive incoming HTTP traffic using the servlet component. The route is very simple: <camel:route id="peopleSoftServletService" errorHandlerRef="errorHandler"> <camel:from uri="servlet:///PeopleSoftService" /> <camel:setHeader headerName="origin"> <camel:simple>PeopleSoft Server: ${in.header.X-Forwarded-For}</camel:simple> </camel:setHeader> <camel:inOnly uri="activemq:peoplesoft" /> </camel:route> I'm encountering problems with stream caching. I'm not...

Why does Jasypt try to decrypt Camel Property Placeholders, regardless of the ENC( prefix?


apache-camel,jbossfuse,jasypt,blueprint-osgi,blueprint
In my Blueprint application deployed in JBoss Fuse 6.1.0-379, I want to secure the password I use for creating a database connection. I read this article and added <enc:property-placeholder> to the blueprint configuration. However my blueprint configuration has many property placeholders, and it seems that the Jasypt Placeholder Resolver is...

WS-Security Policy node not being generated in Apache CXF with Spring and custom context file


spring,soap,wsdl,cxf,ws-security
I have an SOAP web service generated with Apache CXF and using Spring. The interface was generated from a WSDL without WS-Security Policy. Now I need to include this WS-Security node in the generated WSDL: <wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" wsu:Id="wss_saml_or_username_token_service_policy">...

Where is this variable coming from in this Apache Camel program?


java,apache-camel
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you...