I just had a similar error. In spite of the very little detail you provided about your case, I have the feeling that it could be a similar issue as in my case.
In my case, okular was not able to find its component and generator libraries, because my environment was not correctly setup. I managed to resolve it by adding
the following to my environment:
export PATH=/usr/local/bin:$PATH
# LD_LIBRARY_PATH only needed if you are building without rpath
# export LD_LIBRARY_PATH=/usr/local/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
export XDG_DATA_DIRS=/usr/local/share:${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/}
export XDG_CONFIG_DIRS=/usr/local/etc/xdg:${XDG_CONFIG_DIRS:-/etc/xdg}
export QT_PLUGIN_PATH=/usr/local/lib/x86_64-linux-gnu/plugins:$QT_PLUGIN_PATH
export QML2_IMPORT_PATH=/usr/local/lib/x86_64-linux-gnu/qml:$QML2_IMPORT_PATH
(I found this in a file prefix.sh
from directory of my okular sources. Note, that I am running a custom compiled version. Of course you may have to adapt the paths. In case your okular is usually running normally, you should be able to get the correct configuration by comparing your usual shell environment with the one inside your script.)