Depending on what you're trying to achieve could use either of the following options to avoid a 1066 from being reported to your end users:
1. If it's possible that the beginClassNotification was never executed at the time your code is calling endClassNotification, and that is a valid situation for ...