Java: fixing multiple SCI initializations.
- Ignoring Tomcat WebSocket container initialization. - Renaming application class loader to UnitClassLoader to avoid development environment enablement in Spring Boot. This closes #609 issue on GitHub.
This commit is contained in:
parent
f845283820
commit
818a78d82c
2 changed files with 21 additions and 4 deletions
|
@ -37,6 +37,12 @@ some Perl applications failed to process the request body, notably with Plack.
|
|||
</para>
|
||||
</change>
|
||||
|
||||
<change type="bugfix">
|
||||
<para>
|
||||
some Spring Boot applications failed to start, notably with Grails.
|
||||
</para>
|
||||
</change>
|
||||
|
||||
</changes>
|
||||
|
||||
|
||||
|
|
|
@ -422,7 +422,7 @@ public class Context implements ServletContext, InitParams
|
|||
|
||||
processWebXml(root);
|
||||
|
||||
loader_ = new AppClassLoader(urls,
|
||||
loader_ = new UnitClassLoader(urls,
|
||||
Context.class.getClassLoader().getParent());
|
||||
|
||||
Class wsSession_class = WsSession.class;
|
||||
|
@ -531,7 +531,7 @@ public class Context implements ServletContext, InitParams
|
|||
}
|
||||
}
|
||||
|
||||
private static class AppClassLoader extends URLClassLoader
|
||||
private static class UnitClassLoader extends URLClassLoader
|
||||
{
|
||||
static {
|
||||
ClassLoader.registerAsParallelCapable();
|
||||
|
@ -547,7 +547,7 @@ public class Context implements ServletContext, InitParams
|
|||
|
||||
private ClassLoader system_loader;
|
||||
|
||||
public AppClassLoader(URL[] urls, ClassLoader parent)
|
||||
public UnitClassLoader(URL[] urls, ClassLoader parent)
|
||||
{
|
||||
super(urls, parent);
|
||||
|
||||
|
@ -1514,6 +1514,18 @@ public class Context implements ServletContext, InitParams
|
|||
{
|
||||
trace("loadInitializer: initializer: " + sci.getClass().getName());
|
||||
|
||||
/*
|
||||
Unit WebSocket container is a copy of Tomcat WsSci with own
|
||||
transport implementation. Tomcat implementation will not work in
|
||||
Unit and should be ignored here.
|
||||
*/
|
||||
if (sci.getClass().getName()
|
||||
.equals("org.apache.tomcat.websocket.server.WsSci"))
|
||||
{
|
||||
trace("loadInitializer: ignore");
|
||||
return;
|
||||
}
|
||||
|
||||
HandlesTypes ann = sci.getClass().getAnnotation(HandlesTypes.class);
|
||||
if (ann == null) {
|
||||
trace("loadInitializer: no HandlesTypes annotation");
|
||||
|
@ -1558,7 +1570,6 @@ public class Context implements ServletContext, InitParams
|
|||
|
||||
try {
|
||||
sci.onStartup(handles_classes, this);
|
||||
metadata_complete_ = true;
|
||||
} catch(Exception e) {
|
||||
System.err.println("loadInitializer: exception caught: " + e.toString());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue