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

Dependancy issue with pulsar4s and pulsar-functions-local-runner-original/pulsar-client-admin-original #371

Open
Haaroon opened this issue Dec 9, 2021 · 14 comments

Comments

@Haaroon
Copy link

Haaroon commented Dec 9, 2021

Having issues whereby my Local File Reader runner fails to run because of a dependency clash between pulsar4s and the pulsar java libraries.

The code is attempting to load a connector via the soureConfig object

Below is the build.sbt file,

libraryDependencies += "com.clever-cloud.pulsar4s"    % "pulsar4s-core_2.13"               % "2.8.0"
libraryDependencies += "com.clever-cloud.pulsar4s"    % "pulsar4s-circe_2.13"              % "2.8.0"
libraryDependencies += "org.apache.pulsar"            %  "pulsar-client-messagecrypto-bc"  % pulsarVersion
libraryDependencies += "org.apache.pulsar"            %  "pulsar-functions-local-runner-original" % pulsarVersion
libraryDependencies += "org.apache.pulsar"            %  "pulsar-client-admin-original"    % pulsarVersion

Below is the error log

15:19:03.712 [main] INFO  org.apache.pulsar.functions.utils.io.ConnectorUtils - Searching for connectors in /Users/haaroony/Documents/pulsar/pulsar-test/connectors
15:19:03.773 [main] WARN  org.apache.pulsar.functions.utils.io.ConnectorUtils - Failed to load connector from /Users/haaroony/Documents/pulsar/pulsar-test/connectors/pulsar-io-file-2.7.2.nar
java.lang.NoSuchMethodError: 'com.fasterxml.jackson.databind.ObjectMapper org.apache.pulsar.common.util.ObjectMapperFactory.getThreadLocalYaml()'
	at org.apache.pulsar.functions.utils.io.ConnectorUtils.getConnectorDefinition(ConnectorUtils.java:115) ~[pulsar-functions-utils-2.7.2.jar:2.7.2]
	at org.apache.pulsar.functions.utils.io.ConnectorUtils.getConnectorDefinition(ConnectorUtils.java:107) ~[pulsar-functions-utils-2.7.2.jar:2.7.2]
	at org.apache.pulsar.functions.utils.io.ConnectorUtils.searchForConnectors(ConnectorUtils.java:164) [pulsar-functions-utils-2.7.2.jar:2.7.2]
	at org.apache.pulsar.functions.LocalRunner.getConnectors(LocalRunner.java:508) [pulsar-functions-local-runner-original-2.7.2.jar:2.7.2]
	at org.apache.pulsar.functions.LocalRunner.isBuiltInSource(LocalRunner.java:477) [pulsar-functions-local-runner-original-2.7.2.jar:2.7.2]
	at org.apache.pulsar.functions.LocalRunner.start(LocalRunner.java:275) [pulsar-functions-local-runner-original-2.7.2.jar:2.7.2]
	at com.raphtory.FileSpoutLocal$.main(FileSpoutLocal.scala:32) [classes/:?]
	at com.raphtory.FileSpoutLocal.main(FileSpoutLocal.scala) [classes/:?]
Exception in thread "main" java.lang.NoSuchMethodError: 'com.fasterxml.jackson.databind.ObjectMapper org.apache.pulsar.common.util.ObjectMapperFactory.getThreadLocalYaml()'
	at org.apache.pulsar.functions.utils.io.ConnectorUtils.getIOSourceClass(ConnectorUtils.java:59)
	at org.apache.pulsar.functions.utils.SourceConfigUtils.validate(SourceConfigUtils.java:303)
	at org.apache.pulsar.functions.LocalRunner.start(LocalRunner.java:290)
	at com.raphtory.FileSpoutLocal$.main(FileSpoutLocal.scala:32)
	at com.raphtory.FileSpoutLocal.main(FileSpoutLocal.scala)
15:19:03.893 [Thread-0] INFO  org.apache.pulsar.functions.LocalRunner - Shutting down the localrun runtimeSpawner ...

code example

      val sourceConfig = SourceConfig.builder
        .tenant("public")
        .namespace("default")
        .topicName("example-file-io")
        .name("file-source-example")
        .archive("/Users/haaroony/Documents/pulsar/pulsar-test/connectors/pulsar-io-file-2.7.2.nar")
        .configs(configs)
        .build

      val localRunner = LocalRunner.builder
        .brokerServiceUrl("pulsar://localhost:6650")
        .sourceConfig(sourceConfig)
        .build

      localRunner.start(false)
@Haaroon
Copy link
Author

Haaroon commented Dec 9, 2021

fyi if i remove pulsar4s it runs fine

@judu
Copy link
Member

judu commented Dec 9, 2021

Does this fail for every pulsar java client version? Which version are you on?

@Haaroon
Copy link
Author

Haaroon commented Dec 9, 2021

Running the latest 2.8.0 with pulsar 2.9.0, i even tried pulsar 2.8.1 and same issues

@judu
Copy link
Member

judu commented Dec 9, 2021

Out of curiosity: did you try pulsar4s 2.8.0?
It's been released yesterday.
Beware: since the original maintainer gave the project away, the organisation for the artifact is now com.clever-cloud.pulsar4s instead of com.sksamuel.pulsar4s.

@Haaroon
Copy link
Author

Haaroon commented Dec 9, 2021

yes i did and it still doesnt work unfortunately,

@Haaroon
Copy link
Author

Haaroon commented Dec 9, 2021

I have had a similar dependency issue with pulsar before, which is why we add the -original name to the dep which pull the build without the shady deps

@miratepuffin
Copy link

image
I don't think this is a solution solution, but as a quick patch to get this working I excluded the base pulsar libs from pulsar4s in my build and it now runs (I work with Haaroon).

@judu
Copy link
Member

judu commented Dec 9, 2021

That is weird, because pulsar4s 2.8.0 depends on pulsar-client 2.9.0. 🤔

@Haaroon
Copy link
Author

Haaroon commented Dec 9, 2021 via email

@judu
Copy link
Member

judu commented Dec 9, 2021

I may investigate this in future versions. If possible, drop the pulsar-client to use the other ones, or add the others with versions pinning.

@judu
Copy link
Member

judu commented Dec 10, 2021

Would you agree to run some tests in local by cloning this repo, mangling the deps to your liking, see if your project works with it and see if the tests still pass? 🙏

@miratepuffin
Copy link

Sure, can do. We are getting a wonderful netty issue as well at the moment (below) which also seems to be a dependency problem, so this could help with that.
image

@judu
Copy link
Member

judu commented Dec 10, 2021

Oh, the much dreaded netty error. Some coworkers got it but we could not find out why. :(

@Haaroon
Copy link
Author

Haaroon commented Dec 13, 2021

we have the netty but it seems to work all fine

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