Need to write a script in UNIX to find a file if another file exists

So I have a lot of Java applications on my servers all having their own folder from the applications subdirectory. Now, I need to do the following.

Search all the applications subdirectories for message.jar.

If the message.jar file exists, I need to search the application directory for license text.

For example, my application subdirectory consists of the following application folders.

application/messagingApp/
application/databaseApp/
application/toolsApp/

Now when I run the following command from :/application:

:/application % find . message.jar -print

I get the following:
application/messagingApp/common/jars/message.jar
application/toolsApp/jars/message.jar

Now, since I know that the messagingApp and toolsApp contains message.jar, I now need to search all files in the directory (subdirectories don't have to be searched) application/messagingApp and application/toolsApp for the
following text: licenseKey=, and if it doesn't exist, I need to know what the application folder is.

For example, application/messagingApp/licensing.prop contains licenseKey= but there is no file in application/toolsApp that contains licenseKey= and toolsApp should be the output of the program.

Something like this perhaps (untested):

for dir in $(find . -name message.jar | awk -F/ '{print $2}')
do
    if ! grep -q licenseKey= $dir/*
    then
        echo $dir
    fi
done