I recently got objectify working with app engine, but I'm having trouble with registering a class for objectify multiple times. While developing in Eclipse, which recompiles and runs again every time the localhost is refreshed, the script that registers the student is run multiple times, and crashes the program after just one refresh.
<%
//In my main.jsp file, which is the main interactive html page
ObjectifyService.register(Object.class);
%>
How can I ensure that this script is only run once? Is there a way to check if a class is registered with objectify? I followed a suggestion on another stackoverflow thread to do the following:
public class Object {
...
static {
ObjectifyService.register(Object.class);
}
...
}
This gave me a different error. How can I solve this?