Issue 1:
Andy Piper opened SPR-5345 and commented

In AbstractApplicationContext the isActive flag is set in prepareRefresh(), however the multicaster is not initialized until later in refresh(), thus if you have error handling code which does:

if (context.isActive()) {

context.close();

}

you end up with this error:

<09-Dec-2008 11:00:32 o'clock GMT> <Error> <org.springframework.osgi.context.sup

port.OsgiBundleXmlApplicationContext> <BEA-000000> <Exception thrown from Applic

ationListener handling ContextClosedEvent

java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - c

all 'refresh' before multicasting events via the context: org.springframework.os

gi.context.support.OsgiBundleXmlApplicationContext@9d4d84: display name [OsgiBun

dleXmlApplicationContext(bundle=helloworld, config=osgibundle:/META-INF/spring/*

.xml)]; startup date [Tue Dec 09 11:00:31 GMT 2008]; root of context hierarchy

at org.springframework.context.support.AbstractApplicationContext.getApp

licationEventMulticaster(AbstractApplicationContext.java:287)

at org.springframework.context.support.AbstractApplicationContext.publis

hEvent(AbstractApplicationContext.java:274)

at org.springframework.context.support.AbstractApplicationContext.doClos

e(AbstractApplicationContext.java:819)

at org.springframework.osgi.context.support.AbstractOsgiBundleApplicatio

nContext.doClose(AbstractOsgiBundleApplicationContext.java:206)

at org.springframework.osgi.context.support.AbstractDelegatedExecutionAp

plicationContext.access$501(AbstractDelegatedExecutionApplicationContext.java:68

)

at org.springframework.osgi.context.support.AbstractDelegatedExecutionAp

plicationContext$2.run(AbstractDelegatedExecutionApplicationContext.java:217)

at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCus

tomTCCL(PrivilegedUtils.java:85)

at org.springframework.osgi.context.support.AbstractDelegatedExecutionAp

plicationContext.normalClose(AbstractDelegatedExecutionApplicationContext.java:2

13)

at org.springframework.osgi.extender.internal.dependencies.startup.Depen

dencyWaiterApplicationContextExecutor.close(DependencyWaiterApplicationContextEx

ecutor.java:345)

at org.springframework.osgi.context.support.AbstractDelegatedExecutionAp

plicationContext.doClose(AbstractDelegatedExecutionApplicationContext.java:228)

at org.springframework.context.support.AbstractApplicationContext.close(

AbstractApplicationContext.java:794)

at org.springframework.osgi.extender.internal.activator.ContextLoaderLis

tener$3.run(ContextLoaderListener.java:832)

at org.springframework.osgi.extender.internal.util.concurrent.RunnableTi

medExecution$MonitoredRunnable.run(RunnableTimedExecution.java:60)

at org.springframework.scheduling.timer.DelegatingTimerTask.run(Delegati

ngTimerTask.java:66)

at java.util.TimerThread.mainLoop(Timer.java:512)

at java.util.TimerThread.run(Timer.java:462)

Spring-DM has exactly this kind of code and fails in exactly this way.

Either the event should be silently dropped or isActive should be set at the end of refresh()

Affects: 2.5.6

Issue Links:

#10021 AbstractApplicationContext.isActive() out of sync with multicaster ("is duplicated by")

Issue 2:
Rossen Stoyanchev opened SPR-9384 and commented

Affects: 3.1.1

This issue is a backport sub-task of #14010

Issue Links:

#14031 Backport "Reinstate check for a type-level @RequestMapping annotation to decide if a bean contains @RequestMapping methods" ("is duplicated by")

Referenced from: commits 2fa0e63