This is certainly a shelf life issue or a contamination issue.
Shellac is a really good finish for many applications, I don't see any problem with using it as you have stated. It does have a limited shelf life -- generally 6 months for pre-mixed products, 3 years for flakes. Zinsser "BullsEye" brand shellac is the most commonly available premixed product. It does have an extended shelf life of up to 3 years, although it does take a bit longer to dry toward the end of that time.
The other possibility is contamination. Just a little bit of water, even from condensation in the can, can ruin quite a bit of wet shellac. Heat also shortens the shelf life considerably.
Now, how to fix this. First, you need to get rid of the shellac you already put on. Use a clean, lint-free cloth saturated with denatured alcohol to remove the rough and sticky material you have. It may take several wipe downs to get it. You do not have to remove all of the shellac, just the sticky surface material.
Once you get the other off, you should be ready to apply some fresh shellac. When you buy, check the date code on the bottom of the can and read the directions to find the recommended shelf life and if the date is a manufacture date or expiration date if there is any question.
Test the new shellac on something before you apply to your project. Heat and any number of other factors can induce premature failure of the product and you never know how it was stored before you get it, so always best to test first. If it dries on the test, you should be good to go.
When working with shellac, never work out of the can if you intend to use the product again. Even when testing, pour some into another container and work from that, seal the container as quickly as possible. This will avoid contamination.
I would not necessarily suggest that you look for flake shellac to mix on your own. You do get better shelf life this way and the places that handle it are usually better about proper storage and rotating stock, but it is harder to find and mixing is a chore if you have one small project. You can get good results as long as you watch the date code and test first.