A few things i did when i encountered the same problem.
1.Introduced a package for the bean program.(test)
2.Make sure the class file is placed inside
the package folder for example
web-inf/classes/test/yourclass.class, test being your package name.
3.Check if the package name test is the first line of your bean program.
4.While using useBean use the following syntax
<jsp:useBean id="cart" scope="session" class="test.ShoppingCart" />
test being the package name and ShoppingCart
your class(bean) name.
Note: The following syntax gave me a ServletException. Don't know what was wrong.
It seems valid code to me.
<%@ page import="test.*" %>
<jsp:useBean id="cart" scope="session" class="ShoppingCart" />