question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

System.DllNotFoundException: Failed to load the librdkafka native library

See original GitHub issue

System.DllNotFoundException: Failed to load the librdkafka native library

An error occurred using the Dotnet core Web API Errors are as follows

Microsoft.AspNetCore.Server.Kestrel[13] Connection id “0HL9RN5T1D654”, Request id “0HL9RN5T1D654:00000001”: An unhandled exception was thrown by the application. System.DllNotFoundException: Failed to load the librdkafka native library. at Confluent.Kafka.Impl.LibRdKafka.Initialize(String userSpecifiedPath) at Confluent.Kafka.Producer…ctor(IEnumerable1 config, Boolean manualPoll, Boolean disableDeliveryReports) at Confluent.Kafka.Producer2…ctor(IEnumerable1 config, ISerializer1 keySerializer, ISerializer`1 valueSerializer, Boolean manualPoll, Boolean disableDeliveryReports)

How to reproduce

Use Asp.net Core WebApi on Centos7

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:36 (15 by maintainers)

github_iconTop GitHub Comments

6reactions
glazkovalexcommented, Feb 12, 2019

Hi guys, I am trying to do exactly what @sfrooster said - building netstandard2.0 lib used by a netcoreapp2.0 console app and it fails with aforementioned error on Windows 10, is there any resolution/solution to this yet?

I was helped with this code before creating the producer

try
{
	_producer = builder.Build();
}
catch (DllNotFoundException)
{   // Загрузка злоебучей librdkafka.dll
	if (!Library.IsLoaded)
	{
		var pathToLibrd = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location),
			$"librdkafka\\{(Environment.Is64BitOperatingSystem ? "x64" : "x86")}\\librdkafka.dll");
		_log.Info($"librdkafka is not loaded. Trying to load {pathToLibrd}");
		Library.Load(pathToLibrd);
		_log.Info($"Using librdkafka version: {Library.Version}");
	}
	_producer = builder.Build();
}
3reactions
sfroostercommented, Mar 9, 2018

@mhowlett “brew install openssl” fixed everything such that he also no longer needs to explicitly call Load.

As for versions, he’s on osx 10.13.3, dotnet cli 2.2-preview/2.1, mono 5.8, Confluent.Kafka 0.11.3, building a netstandard2.0 lib used by a netcoreapp2.0 console app.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exception "Failed to load the librdkafka native library" when ...
Description Getting the following exception when building a consumer using 1.0.0-beta3: Unhandled Exception: System.DllNotFoundException: ...
Read more >
Diagnose `DllNotFoundException` for native library in a ...
I want to run this app in a docker container based on an alpine image, built for the linux-arm64 platform. At runtime I...
Read more >
Kafka Confluence librdkafka.dll where to put?
I'm facing the DLL missing issue, Any inputs on this. System.DllNotFoundException: Failed to load the librdkafka native library. at Confluent.
Read more >
Resolving Native Dependencies for RdKafka
LibRdKafka' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'librdkafka': The specified module could not be found.
Read more >
Class Library | Confluent.Kafka
Methods. Load(). Loads the native librdkafka library. Does nothing if the library is already loaded. Declaration.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found