<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=neilhart" rel="nofollow">Neil Hart</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-2649?redirect=false" rel="nofollow">SPR-2649</a></strong> and commented</p>
<p dir="auto">There is a Sun bug: <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4665132" rel="nofollow">http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4665132</a> that causes us to fail when loading our XML config files.  When using this within JWS and with a very limit security policy we get the following stack trace:</p>
<p dir="auto">java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader)<br>
at java.security.AccessControlContext.checkPermission(Unknown Source)<br>
at java.security.AccessController.checkPermission(Unknown Source)<br>
at java.lang.SecurityManager.checkPermission(Unknown Source)<br>
at java.lang.Thread.getContextClassLoader(Unknown Source)<br>
at org.springframework.util.ClassUtils.getDefaultClassLoader(ClassUtils.java:101)<br>
at org.springframework.core.io.DefaultResourceLoader.&lt;init&gt;(DefaultResourceLoader.java:53)<br>
at org.springframework.context.support.AbstractApplicationContext.&lt;init&gt;(AbstractApplicationContext.java:178)<br>
at org.springframework.context.support.AbstractRefreshableApplicationContext.&lt;init&gt;(AbstractRefreshableApplicationContext.java:78)<br>
at org.springframework.context.support.AbstractXmlApplicationContext.&lt;init&gt;(AbstractXmlApplicationContext.java:58)<br>
at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:90)<br>
at com.creditex.spring.SpringRegistry$StaticSpringRegistry.add(SpringRegistry.java:127)</p>
<p dir="auto">Can we/you change the ClassUtils.getDefaultClassLoader() to get the Thread's classLoader in a try/catch block?  Like this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="public static ClassLoader getDefaultClassLoader() {
            ClassLoader cl = null;
            try {
	        cl = Thread.currentThread().getContextClassLoader();
            }
	catch (Throwable ex) {
		if (logger.isDebugEnabled()) {
			logger.debug(&quot;Getting the thread class loader cause a failure: &quot; + ex);
		}
	}
	if (cl == null) {
		// No thread context class loader -&gt; use class loader of this class.
		cl = ClassUtils.class.getClassLoader();
	}
	return cl;
}"><pre class="notranslate"><code class="notranslate">public static ClassLoader getDefaultClassLoader() {
            ClassLoader cl = null;
            try {
	        cl = Thread.currentThread().getContextClassLoader();
            }
	catch (Throwable ex) {
		if (logger.isDebugEnabled()) {
			logger.debug("Getting the thread class loader cause a failure: " + ex);
		}
	}
	if (cl == null) {
		// No thread context class loader -&gt; use class loader of this class.
		cl = ClassUtils.class.getClassLoader();
	}
	return cl;
}
</code></pre></div>
<p dir="auto">The current workaround I have now is to duplicate the class hierarchy:</p>
<p dir="auto">AbstractApplicationContext<br>
AbstractRefreshableApplicationContext<br>
AbstractXmlApplicationContext<br>
ClassPathXmlApplicationContext</p>
<p dir="auto">so that my AbstractApplicationContext passes in the ClassLoader to DefaultResourceLoader</p>
<p dir="auto">Thanks</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 1.2.8, 2.0 RC3, 2.0 RC4</p>
<p dir="auto"><strong>Backported to:</strong> <a href="https://github.com/spring-projects/spring-framework/milestone/39?closed=1">1.2.9</a></p>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=mkanaley" rel="nofollow">Michael Kanaley</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-2326?redirect=false" rel="nofollow">SPR-2326</a></strong> and commented</p>
<p dir="auto">Spring 2.0 now supports ApplicationContexts implementing the Lifecycle interface. I would like to see the start/stop functionality treated identically to that of init/destroy in the following way:</p>
<ul dir="auto">
<li>sending of an ApplicationEvent after start and before stop<br>
Currently init and destroy of ApplicationContexts send events as well. I would like to see this for start/stop too.</li>
</ul>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.0 RC2</p>