App Store Connect Error When Uploading to Apple

I am trying to notarize a Mac app on Xcode 12.2. I archive the app, open the Organizer, select the archive and click the Distribute App button.

I go through the steps in the wizard. Everything goes well until I click the Upload button to upload the app to Apple to notarize. When I click the Upload button, I get the following error:

App Store Connect Operation Error
Could not find or load main class

Followed by a path to the Library.Java.Extensions folder on my Mac.

I have tried cleaning the build folder and creating a fresh archive, but the upload error persists. How do I fix this error?


Accepted Reply

The upload error went away when I updated to Xcode 13.

Replies

Some people have reported solving this problem by changing the name of the Xcode executable. It may be related to having one or more beta versions installed. Personally I think it would be better to look at "xcode-select" first.
My Xcode executable is named Xcode. I do not have any beta Xcode versions installed on my Mac. The active developer directory from Xcode-select is the following:

/Applications/Xcode.app/Contents/Developer

I'm running macOS 10.15.7.

The upload error went away when I updated to Xcode 13.