getCurrentAudioDevice() returns null when app working as .dll library

Hi,
I am struggling with issue regarding to connect juce app with default audio device. I have a java UI which uses set of classes and in the form of juce .dll for playback/processing.
When i am trying do get output device:
auto *device = audioDeviceManager.getCurrentAudioDevice();
if ( device == nullptr) AlertWindow::showMessageBox(AlertWindow::WarningIcon, “ERROR”, “Audio Device not found!”);
device returns null.
I checked in another app (only juce without java ui) and created callback in the same way and it is working perfect.
What can be a reason?