use of org.qi4j.api.common.InvalidApplicationException in project qi4j-sdk by Qi4j.
the class ValueAssemblyImpl method newValueModel.
ValueModel newValueModel(StateDeclarations stateDeclarations, AssemblyHelper helper) {
try {
associationsModel = new AssociationsModel();
manyAssociationsModel = new ManyAssociationsModel();
buildComposite(helper, stateDeclarations);
ValueModel valueModel = new ValueModel(types, visibility, metaInfo, mixinsModel, (ValueStateModel) stateModel, compositeMethodsModel);
return valueModel;
} catch (Exception e) {
throw new InvalidApplicationException("Could not register " + types, e);
}
}
use of org.qi4j.api.common.InvalidApplicationException in project qi4j-sdk by Qi4j.
the class AbstractQi4jServletBootstrap method contextInitialized.
@Override
public final void contextInitialized(ServletContextEvent sce) {
try {
ServletContext context = sce.getServletContext();
LOGGER.trace("Assembling Application");
qi4j = new Energy4Java();
applicationModel = qi4j.newApplicationModel(this);
LOGGER.trace("Instanciating and activating Application");
application = applicationModel.newInstance(qi4j.api());
api = qi4j.api();
beforeApplicationActivation(application);
application.activate();
afterApplicationActivation(application);
LOGGER.trace("Storing Application in ServletContext");
context.setAttribute(Qi4jServletSupport.APP_IN_CTX, application);
} catch (Exception ex) {
if (application != null) {
try {
beforeApplicationPassivation(application);
application.passivate();
afterApplicationPassivation(application);
} catch (Exception ex1) {
LOGGER.warn("Application not null and could not passivate it.", ex1);
}
}
throw new InvalidApplicationException("Unexpected error during ServletContext initialization, see previous log for errors.", ex);
}
}
Aggregations