Issue 1:
Michael Donaghy opened SPR-9031 and commented

It seems that using @ComponentScan with an includeFilters set only works for top-level contexts, not for @Imported contexts? See the attached minimal example maven project: the LowLevelContext works correctly, but the HighLevelContext does not, even though all the HighLevelContext does is to @Import the LowLevelContext.

Stepping through in a debugger I found that different AnnotationMetadata implementations are passed to ConfigurationClassParser#doProcessConfigurationClass in the two cases:

For LowLevelContext a StandardAnnotationMetadata is used (and behaves correctly).

For HighLevelContext an AnnotationMetadataReadingVisitor is used, and seems to return an empty array from getAnnotationAttributes(ComponentScan.class.getName()).get("includeFilters"), which is incorrect.

Affects: 3.1 GA

Attachments:

springproblem.tar.gz (1.58 kB)

Issue Links:

#13361 @ComponentScan(includeFilters=@Filter(...)) fails when @Import'ed ("is duplicated by")

#13738 ClassPathBeanDefinitionScanner vs ClassPathBeanDefinitionScanner: difference in behavior when dealing with @ComponentScan excludeFilters ("is duplicated by")

#12634 @ComponentScan does not work when referenced from XML config

#13871 Reduce log level for message re: missing annotation

Referenced from: commits spring-attic/spring-framework-issues@dd79a1b

Issue 2:
Yogesh opened SPR-4916 and commented

Deploy a MessageBean that is using BMT. The following sequence of events in the onMessage() method will cause the IllegalStateException:

create TransactionTemplate with PROPAGATION_REQUIRED

in the execute do this:

2a. Connection conn = DataSourceUtils.getConnection(ds);

2b. DataSourceUtils.releaseConnection(conn, ds);

2c. call method that does the following:

I. create TransactionTemplate with PROPAGATION_REQUIRES_NEW

II. call execute and the exception is thrown.

Here is the debug and stacktrace:

12:03:50,703 INFO [STDOUT] MyMessageBean got message!

12:03:50,705 INFO [STDOUT] // obtain DataSource

12:03:50,707 INFO [STDOUT] *** Create TransactionManager

12:03:50,900 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] Retrieving JTA UserTransaction from JNDI location [java:comp/UserTransaction]

12:03:50,901 DEBUG [org.springframework.jndi.JndiTemplate] Looking up JNDI object with name [java:comp/UserTransaction]

12:03:50,981 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] Retrieving JTA TransactionManager from JNDI location [java:/TransactionManager]

12:03:50,983 DEBUG [org.springframework.jndi.JndiTemplate] Looking up JNDI object with name [java:/TransactionManager]

12:03:50,985 INFO [org.springframework.transaction.jta.JtaTransactionManager] Using JTA UserTransaction: org.jboss.ejb.EnterpriseContext$UserTransactionImpl@66d882

12:03:50,987 INFO [org.springframework.transaction.jta.JtaTransactionManager] Using JTA TransactionManager: org.jboss.tm.TxManager@104e65

12:03:50,988 INFO [STDOUT] *** Create TransactionTemplate

12:03:50,997 INFO [STDOUT] *** Propagation=0

12:03:51,005 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] Using transaction object [org.springframework.transaction.jta.JtaTransactionObject@401ab1]

12:03:51,007 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] Creating new transaction with name [null]

12:03:51,017 DEBUG [org.springframework.transaction.support.TransactionSynchronizationManager] Initializing transaction synchronization

12:03:51,026 INFO [STDOUT] *** doInTransaction org.springframework.transaction.support.DefaultTransactionStatus@bc60f2

12:03:51,056 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] Fetching JDBC Connection from DataSource

12:03:53,260 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] Registering transaction synchronization for JDBC Connection

12:03:53,419 DEBUG [org.springframework.transaction.support.TransactionSynchronizationManager] Bound value [org.springframework.jdbc.datasource.ConnectionHolder@2900c9] for key [org.jboss.resource.adapter.jdbc.WrapperDataSource@bf2c98] to thread [JMS SessionPool Worker-0]

12:03:53,420 INFO [STDOUT] *** doInConnection

12:03:53,420 DEBUG [org.springframework.transaction.support.TransactionSynchronizationManager] Retrieved value [org.springframework.jdbc.datasource.ConnectionHolder@2900c9] for key [org.jboss.resource.adapter.jdbc.WrapperDataSource@bf2c98] bound to thread [JMS SessionPool Worker-0]

12:03:53,421 INFO [STDOUT] === Create TransactionTemplate 2

12:03:53,422 INFO [STDOUT] === Propagation=3

12:03:53,424 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] Using transaction object [org.springframework.transaction.jta.JtaTransactionObject@1548ee]

12:03:53,424 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] Suspending current transaction, creating new transaction with name [null]

12:03:53,425 DEBUG [org.springframework.transaction.support.TransactionSynchronizationManager] Removed value [org.springframework.jdbc.datasource.ConnectionHolder@2900c9] for key [org.jboss.resource.adapter.jdbc.WrapperDataSource@bf2c98] from thread [JMS SessionPool Worker-0]

12:03:53,433 DEBUG [org.springframework.transaction.support.TransactionSynchronizationManager] Clearing transaction synchronization

12:03:53,438 DEBUG [org.springframework.transaction.support.TransactionTemplate] Initiating transaction rollback on application exception

java.lang.IllegalStateException: Trying to change transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=samoa.local/20, BranchQual=, localId=20] in enlist!

at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.enlist(TxConnectionManager.java:551)

at org.jboss.resource.connectionmanager.TxConnectionManager.transactionStarted(TxConnectionManager.java:357)

at org.jboss.resource.connectionmanager.CachedConnectionManager.userTransactionStarted(CachedConnectionManager.java:403)

at org.jboss.ejb.EnterpriseContext$UserTransactionImpl.begin(EnterpriseContext.java:576)

at org.springframework.transaction.jta.JtaTransactionManager.doJtaBegin(JtaTransactionManager.java:664)

at org.springframework.transaction.jta.JtaTransactionManager.doBegin(JtaTransactionManager.java:622)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.handleExistingTransaction(AbstractPlatformTransactionManager.java:320)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:262)

at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:111)

at com.springdeveloper.ejb.MyMessageBean.testSpring2(MyMessageBean.java:95)

at com.springdeveloper.ejb.MyMessageBean.access$100(MyMessageBean.java:24)

at com.springdeveloper.ejb.MyMessageBean$1.doInTransactionWithoutResult(MyMessageBean.java:80)

at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33)

at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:114)

at com.springdeveloper.ejb.MyMessageBean.testSpring(MyMessageBean.java:71)

at com.springdeveloper.ejb.MyMessageBean.onMessage(MyMessageBean.java:54)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:585)

at org.jboss.invocation.Invocation.performCall(Invocation.java:345)

at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:475)

at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:149)

at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)

at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:106)

at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:158)

at org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT.invoke(MessageDrivenTxInterceptorBMT.java:32)

at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:101)

at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:94)

at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)

at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)

at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:389)

at org.jboss.ejb.Container.invoke(Container.java:873)

at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:1077)

at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1379)

at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:256)

at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:904)

at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:160)

at org.jboss.mq.SpySession.run(SpySession.java:333)

at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:180)

at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)

at java.lang.Thread.run(Thread.java:613)

12:03:53,447 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] Triggering beforeCompletion synchronization

12:03:53,448 ERROR [org.springframework.transaction.support.TransactionTemplate] Application exception overridden by rollback exception

java.lang.IllegalStateException: Trying to change transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=samoa.local/20, BranchQual=, localId=20] in enlist!

at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.enlist(TxConnectionManager.java:551)

at org.jboss.resource.connectionmanager.TxConnectionManager.transactionStarted(TxConnectionManager.java:357)

at org.jboss.resource.connectionmanager.CachedConnectionManager.userTransactionStarted(CachedConnectionManager.java:403)

at org.jboss.ejb.EnterpriseContext$UserTransactionImpl.begin(EnterpriseContext.java:576)

at org.springframework.transaction.jta.JtaTransactionManager.doJtaBegin(JtaTransactionManager.java:664)

at org.springframework.transaction.jta.JtaTransactionManager.doBegin(JtaTransactionManager.java:622)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.handleExistingTransaction(AbstractPlatformTransactionManager.java:320)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:262)

at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:111)

at com.springdeveloper.ejb.MyMessageBean.testSpring2(MyMessageBean.java:95)

at com.springdeveloper.ejb.MyMessageBean.access$100(MyMessageBean.java:24)

at com.springdeveloper.ejb.MyMessageBean$1.doInTransactionWithoutResult(MyMessageBean.java:80)

at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33)

at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:114)

at com.springdeveloper.ejb.MyMessageBean.testSpring(MyMessageBean.java:71)

at com.springdeveloper.ejb.MyMessageBean.onMessage(MyMessageBean.java:54)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:585)

at org.jboss.invocation.Invocation.performCall(Invocation.java:345)

at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:475)

at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:149)

at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)

at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:106)

at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:158)

at org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT.invoke(MessageDrivenTxInterceptorBMT.java:32)

at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:101)

at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:94)

at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)

at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)

at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:389)

at org.jboss.ejb.Container.invoke(Container.java:873)

at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:1077)

at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1379)

at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:256)

at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:904)

at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:160)

at org.jboss.mq.SpySession.run(SpySession.java:333)

at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:180)

at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)

at java.lang.Thread.run(Thread.java:613)

12:03:53,461 INFO [org.jboss.resource.connectionmanager.CachedConnectionManager] Closing a connection for you. Please close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection@d698d3

java.lang.Throwable: STACKTRACE

at org.jboss.resource.connectionmanager.CachedConnectionManager.registerConnection(CachedConnectionManager.java:333)

at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:482)

at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:894)

at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:73)

at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:107)

at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)

at com.springdeveloper.ejb.MyMessageBean$1.doInTransactionWithoutResult(MyMessageBean.java:76)

at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33)

at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:114)

at com.springdeveloper.ejb.MyMessageBean.testSpring(MyMessageBean.java:71)

at com.springdeveloper.ejb.MyMessageBean.onMessage(MyMessageBean.java:54)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:585)

at org.jboss.invocation.Invocation.performCall(Invocation.java:345)

at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:475)

at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:149)

at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)

at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:106)

at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:158)

at org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT.invoke(MessageDrivenTxInterceptorBMT.java:32)

at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:101)

at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:94)

at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)

at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)

at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:389)

at org.jboss.ejb.Container.invoke(Container.java:873)

at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:1077)

at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1379)

at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:256)

at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:904)

at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:160)

at org.jboss.mq.SpySession.run(SpySession.java:333)

at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:180)

at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)

at java.lang.Thread.run(Thread.java:613)

12:03:53,473 ERROR [org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT] Application error: BMT stateless bean MyMessageBean should complete transactions before returning (ejb1.1 spec, 11.6.1)

12:03:53,478 ERROR [org.jboss.ejb.plugins.jms.JMSContainerInvoker] Exception in JMSCI message listener

javax.ejb.EJBException: null; CausedByException is:

Application error: BMT stateless bean MyMessageBean should complete transactions before returning (ejb1.1 spec, 11.6.1)

at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:411)

at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:196)

at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)

at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:389)

at org.jboss.ejb.Container.invoke(Container.java:873)

at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:1077)

at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1379)

at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:256)

at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:904)

at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:160)

at org.jboss.mq.SpySession.run(SpySession.java:333)

at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:180)

at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)

at java.lang.Thread.run(Thread.java:613)

java.rmi.RemoteException: Application error: BMT stateless bean MyMessageBean should complete transactions before returning (ejb1.1 spec, 11.6.1)

at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.checkStatelessDone(AbstractTxInterceptorBMT.java:225)

at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:165)

at org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT.invoke(MessageDrivenTxInterceptorBMT.java:32)

at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:101)

at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:94)

at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)

at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)

at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:389)

at org.jboss.ejb.Container.invoke(Container.java:873)

at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:1077)

at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1379)

at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:256)

at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:904)

at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:160)

at org.jboss.mq.SpySession.run(SpySession.java:333)

at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:180)

at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)

at java.lang.Thread.run(Thread.java:613)

Affects: 1.2.5

Issue Links:

#6084 IllegalStateException thrown by JBoss 4.0.3 when PROPAGATION_REQUIRES_NEW used during active transaction in MessageBean with BMT ("duplicates")