One example of the general principle: curl -I -X GET "${DATAVERSE_HOST}/dataverseuser.xhtml?editMode=foo" shouldn't result in a http 500 error / IllegalStateException.
There are a variety of other cases that appear to result in additional IllegalStateExceptions (and EJBExceptions), but more information needs to be developed on those.