Merge pull request #3168 from stianst/master
KEYCLOAK-3462 Fix exception not displayed in init from KeycloakServer
This commit is contained in:
commit
5a4bb5f3f0
2 changed files with 11 additions and 1 deletions
|
@ -70,6 +70,8 @@ public class KeycloakApplication extends Application {
|
|||
|
||||
private static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
|
||||
|
||||
protected boolean embedded = false;
|
||||
|
||||
protected Set<Object> singletons = new HashSet<Object>();
|
||||
protected Set<Class<?>> classes = new HashSet<Class<?>>();
|
||||
|
||||
|
@ -78,6 +80,10 @@ public class KeycloakApplication extends Application {
|
|||
|
||||
public KeycloakApplication(@Context ServletContext context, @Context Dispatcher dispatcher) {
|
||||
try {
|
||||
if ("true".equals(context.getInitParameter("keycloak.embedded"))) {
|
||||
embedded = true;
|
||||
}
|
||||
|
||||
loadConfig(context);
|
||||
|
||||
this.contextPath = context.getContextPath();
|
||||
|
@ -139,7 +145,9 @@ public class KeycloakApplication extends Application {
|
|||
|
||||
setupScheduledTasks(sessionFactory);
|
||||
} catch (Throwable t) {
|
||||
if (!embedded) {
|
||||
exit(1);
|
||||
}
|
||||
throw t;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -309,6 +309,8 @@ public class KeycloakServer {
|
|||
di.setDeploymentName("Keycloak");
|
||||
di.setDefaultEncoding("UTF-8");
|
||||
|
||||
di.addInitParameter("keycloak.embedded", "true");
|
||||
|
||||
di.setDefaultServletConfig(new DefaultServletConfig(true));
|
||||
|
||||
ServletInfo restEasyDispatcher = Servlets.servlet("Keycloak REST Interface", HttpServlet30Dispatcher.class);
|
||||
|
|
Loading…
Reference in a new issue