Revert "Improve check if running in OSGi"

This reverts commit fa02b217501d5d36f79f62cac696260ab86e1e92.