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

Camel-Elasticsearch Connector not working on OpenShift #342

Closed
r-lam opened this issue Jul 29, 2020 · 5 comments
Closed

Camel-Elasticsearch Connector not working on OpenShift #342

r-lam opened this issue Jul 29, 2020 · 5 comments

Comments

@r-lam
Copy link

r-lam commented Jul 29, 2020

I'm trying to use the camel elasticsearch connector with my Kafka cluster on OpenShift but on my Connect instance I'm getting this warnings for the 'exchange' class not found and then failed to start the CamelSinkConnector class.

Here's the log:

2020-07-29 15:57:09,912 WARN /connectors/camel-connector/config (org.eclipse.jetty.server.HttpChannel) [qtp1064315206-118]
javax.servlet.ServletException: org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: org/apache/camel/Exchange
	at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:408)
	at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:346)
	...
Caused by: org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: org/apache/camel/Exchange

As I mention, after some time has passed, this comes out:

WARN unhandled due to prior sendError (org.eclipse.jetty.server.HttpChannelState) [qtp1064315206-119]
javax.servlet.ServletException: org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: Could not initialize class org.apache.camel.kafkaconnector.CamelSinkConnectorConfig

I'm working with this dockerfile:

FROM registry.redhat.io/amq7/amq-streams-kafka-25-rhel7:1.5.0
USER root:root
COPY camel-elasticsearch-rest-kafka-connector/ /opt/kafka/plugins/
USER 1001

And this is the config of the Connector:

apiVersion: kafka.strimzi.io/v1alpha1
kind: KafkaConnector
metadata:
  name: camel-connector
  labels:
    strimzi.io/cluster: camel-connect
  namespace: demo-amq-streams
spec:
  class: org.apache.camel.kafkaconnector.CamelSinkConnector
  config:
    key.converter: org.apache.kafka.connect.storage.StringConverter
    value.converter: org.apache.kafka.connect.storage.StringConverter
    camel.sink.url: elasticsearch-rest://elasticsearch?hostAddresses=elasticsearch:9200&operation=Index&indexName=customers
    topics: smt.inventory.customers
  tasksMax: 1
@orpiske
Copy link
Contributor

orpiske commented Jul 29, 2020

Can you list what's inside the /opt/kafka/plugins/ directory, please?

@oscerd
Copy link
Contributor

oscerd commented Jul 29, 2020

The configuration class is wrong
you need to set this class here: https://github.com/apache/camel-kafka-connector/blob/master/connectors/camel-elasticsearch-rest-kafka-connector/src/main/java/org/apache/camel/kafkaconnector/elasticsearchrest/CamelElasticsearchrestSinkConnector.java

Setting the generic class won't work.

@r-lam
Copy link
Author

r-lam commented Jul 29, 2020

Here's the list of plugins on /opt/kafka/plugins:
image

And here's the result of connector-plugins:

[
  {
    "class": "org.apache.camel.kafkaconnector.CamelSinkConnector",
    "type": "sink",
    "version": "0.3.0"
  },
  {
    "class": "org.apache.camel.kafkaconnector.CamelSourceConnector",
    "type": "source",
    "version": "0.3.0"
  },
  {
    "class": "org.apache.kafka.connect.file.FileStreamSinkConnector",
    "type": "sink",
    "version": "2.5.0.redhat-00003"
  },
  {
    "class": "org.apache.kafka.connect.file.FileStreamSourceConnector",
    "type": "source",
    "version": "2.5.0.redhat-00003"
  },
  {
    "class": "org.apache.kafka.connect.mirror.MirrorCheckpointConnector",
    "type": "source",
    "version": "1"
  },
  {
    "class": "org.apache.kafka.connect.mirror.MirrorHeartbeatConnector",
    "type": "source",
    "version": "1"
  },
  {
    "class": "org.apache.kafka.connect.mirror.MirrorSourceConnector",
    "type": "source",
    "version": "1"
  }
]

The configuration class is wrong
you need to set this class here: https://github.com/apache/camel-kafka-connector/blob/master/connectors/camel-elasticsearch-rest-kafka-connector/src/main/java/org/apache/camel/kafkaconnector/elasticsearchrest/CamelElasticsearchrestSinkConnector.java

Setting the generic class won't work.

Yes, I already tried with the class mentioned in the example folder, but is still missing:

ERROR Uncaught exception in REST call to /connectors/camel-connector/config (org.apache.kafka.connect.runtime.rest.errors.ConnectExceptionMapper) [qtp1126112943-92]
org.apache.kafka.connect.errors.ConnectException: Failed to find any class that implements Connector and which name matches org.apache.camel.kafkaconnector.elasticsearchrest.CamelElasticsearchrestSinkConnector

@oscerd
Copy link
Contributor

oscerd commented Jul 29, 2020

The connector needs to be in his own directory. So you should have opt/kafka/plugins/camel-elasticsearch-rest-connector/ dir. Inside it you should have the content of the package

@r-lam
Copy link
Author

r-lam commented Jul 29, 2020

Working!!
My mistake to copy only the jar files and not the entire folder...

Thank you both @oscerd @orpiske !!

@r-lam r-lam closed this as completed Jul 29, 2020
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

3 participants