Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find RestProducerFactory in Registry or as a Component to use" #3290

Closed
barius opened this issue May 19, 2022 · 7 comments
Closed

Cannot find RestProducerFactory in Registry or as a Component to use" #3290

barius opened this issue May 19, 2022 · 7 comments

Comments

@barius
Copy link

barius commented May 19, 2022

I'm trying to use Rest component like this file:

hello-rest.groovy

from('rest:get:hello')
    .to('direct:hello');

from('direct:hello')
    .to('rest:get:processor?host=localhost:8080');


from('rest:get:processor')
    .to('direct:processor')
    .to('log:info');

from('direct:processor')
    .setHeader(Exchange.CONTENT_TYPE, constant('text/plain'))
    .transform().simple('Hello World');

When I run the integration in either local mode or with run --dev, it fails with

"Cannot find RestProducerFactory in Registry or as a Component to use",

The full log:
error.txt

Not sure I'm using the syntax the correct way because I'm still learning Camel.
Also tried to add external dependencies like kamel local run --dependency camel-quarkus:camel-quarkus-rest with no effect.

I've read https://camel.apache.org/camel-quarkus/2.9.x/reference/extensions/rest.html and https://camel.apache.org/components/3.16.x/rest-component.html#_component_options and tried to add configuration with
restConfiguration().host('localhost:8080').component('http'); and it also didn't work :(

System info:

macOS 12.3.1
Camel K Client 1.9.1, 
Apache Maven 3.8.5 (3599d3414f046de2324203b78ddcf9b5e4388aa0)
Java version: 17.0.3.1, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk-17.0.3.1.jdk/Contents/Home
@barius
Copy link
Author

barius commented May 19, 2022

Rest consumer works though :)

@davsclaus
Copy link
Contributor

davsclaus commented May 19, 2022

you can add camel-http as explicit dependency

Something along the line of in the CLI args

-d camel-http

See more at
https://camel.apache.org/camel-k/1.9.x/configuration/dependencies.html

@davsclaus
Copy link
Contributor

And there is also a producerComponent I think in rest-dsl as the consumer and producer can be different. I am not aware if camel-k can detect this part of the code when it scans for camel JARs to include

@barius
Copy link
Author

barius commented May 19, 2022

@davsclaus thx :)

-d camel-http reports

Error: Unexpected type for user-provided dependency: camel-http. Additional top-level dependencies are specified with the format:
<type>:<dependency-name>
where <type> is one of {bom|camel|camel-k|camel-quarkus|mvn|github}.

Looks like the args parsing has changed but this is not a big problem.

but -d camel:camel-http hit me in the head with failure while building project: exit status 1

just randomly testing the dependencies and found that
--dependency camel-quarkus:camel-quarkus-http
kinda works (not throwing exceptions on launch at least) :)

@davsclaus
Copy link
Contributor

Oh yeah I thought first it was

-d camel:http

notice that its using colon

@barius
Copy link
Author

barius commented May 19, 2022

yeah -d camel:http works :)

@barius barius closed this as completed May 19, 2022
@davsclaus
Copy link
Contributor

Ticket to update docs: #3291

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants