When you say you have tried an example, what example are you referring to? Or is it your own? In any case it is very hard to help you when we have no knowledge whatsoever what you have done or are trying to do. You are not even telling if you use JSF 1 or JSF 2.
The error itself is telling that the it can not find myfaces class. I think the default implementation of JSF in GlassFish is Mojarra and not Apache MyFaces. So are you trying to use same specific MyFaces example with the Mojarra implementation of JSF?