Issue 1:
Oleksandr Alesinskyy opened SPR-2503 and commented

I have following context.xml

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:aop="http://www.springframework.org/schema/aop"

xmlns:tx="http://www.springframework.org/schema/tx"

xsi:schemaLocation=

"http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans.xsd

http://www.springframework.org/schema/aop

http://www.springframework.org/schema/aop/spring-aop.xsd

http://www.springframework.org/schema/tx

http://www.springframework.org/schema/tx/spring-tx.xsd"

<tx:annotation-driven transaction-manager="txManager"/>

<!-- TOPOLOGY -->

<bean id="topologyAddressFactoryBuilder"

class="de.ntec.lms.impl.topology.TopologyAddressFactoryBuilder">

<property name="delimiter" value="/"/>

</bean>

<bean id="topologyAddressFactory"

factory-bean="topologyAddressFactoryBuilder"

factory-method="create"

/>

<!-- DATABASE & HIBERNATE -->

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">

<property name="driverClassName" value="org.apache.derby.jdbc.ClientDriver"/>

<property name="url" value="jdbc:derby://localhost:1527//work/lms"/>

<property name="username" value="lms"/>

<property name="password" value="secret"/>

</bean>

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">

<property name="dataSource" ref="dataSource"/>

<property name="mappingResources">

<list>

<value>de/ntec/lms/impl/topology/Company.hbm.xml</value>

<value>de/ntec/lms/impl/topology/Site.hbm.xml</value>

<value>de/ntec/lms/impl/topology/Location.hbm.xml</value>

<value>de/ntec/lms/impl/topology/Rack.hbm.xml</value>

<value>de/ntec/lms/impl/topology/Cell.hbm.xml</value>

<value>de/ntec/lms/impl/topology/Place.hbm.xml</value>

</list>

</property>

<property name="hibernateProperties">

<props>

<prop key="hibernate.dialect">org.hibernate.dialect.DerbyDialect</prop>

</props>

</property>

</bean>

<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">

<property name="sessionFactory" ref="sessionFactory"/>

</bean>

<!-- PERSISTENCE -->

<bean id="placeDao"

class="de.ntec.lms.impl.topology.PlaceDao" init-method="init">

<property name="sessionFactory" ref="sessionFactory"/>

<property name="beanClass" value="de.ntec.lms.impl.topology.PlaceImpl"/>

</bean>

<bean id="cellDao"

class="de.ntec.lms.impl.topology.CellDao" init-method="init">

<property name="sessionFactory" ref="sessionFactory"/>

<property name="beanClass" value="de.ntec.lms.impl.topology.CellImpl"/>

<property name="successorDao" ref="placeDao"/>

</bean>

<bean id="rackDao"

class="de.ntec.lms.impl.topology.RackDao" init-method="init">

<property name="sessionFactory" ref="sessionFactory"/>

<property name="beanClass" value="de.ntec.lms.impl.topology.RackImpl"/>

<property name="successorDao" ref="cellDao"/>

</bean>

<bean id="locationDao"

class="de.ntec.lms.impl.topology.LocationDao" init-method="init">

<property name="sessionFactory" ref="sessionFactory"/>

<property name="beanClass" value="de.ntec.lms.impl.topology.LocationImpl"/>

<property name="successorDao" ref="rackDao"/>

</bean>

<bean id="siteDao"

class="de.ntec.lms.impl.topology.SiteDao" init-method="init">

<property name="sessionFactory" ref="sessionFactory"/>

<property name="beanClass" value="de.ntec.lms.impl.topology.SiteImpl"/>

<property name="successorDao" ref="locationDao"/>

</bean>

<bean id="companyDao"

class="de.ntec.lms.impl.topology.CompanyDao" init-method="init">

<property name="sessionFactory" ref="sessionFactory"/>

<property name="beanClass" value="de.ntec.lms.impl.topology.CompanyImpl"/>

<property name="successorDao" ref="siteDao"/>

</bean>

<bean id="topologyService"

class="de.ntec.lms.impl.topology.TopologyServiceImpl" init-method="init">

<property name="companyDao" ref="companyDao"/>

<property name="addressFactory" ref="topologyAddressFactory"/>

</bean>

</beans>

and following log4j configuration

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

log4j:configuration

<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">

<layout class="org.apache.log4j.PatternLayout">

<param name="ConversionPattern" value="%d{ISO8601} %5p %c%n %m%n"/>

</layout>

</appender>

<logger name="org.springframework" additivity="false">

<level value="info"/>

<appender-ref ref="CONSOLE"/>

</logger>

<root>

<priority value="info"/>

<appender-ref ref="CONSOLE"/>

</root>

</log4j:configuration>

I start a bunch of unit tests and with this configuration all runs smoothly. As soon as change level value in "org.springframework" logger to "debug" run immediately fails with exception (see at the and of the post). Interesting thing is that if context xml does not contain <tx:annotation-driven transaction-manager="txManager"/>

tag log level does not affect behavior (even in presence of XML configuration for transactional AOP, e.g.

<bean id="topologyServiceTarget"

class="de.ntec.lms.impl.topology.TopologyServiceImpl" init-method="init">

<property name="companyDao" ref="companyDao"/>

<property name="addressFactory" ref="topologyAddressFactory"/>

</bean>

<bean id="topologyService"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager" ref="txManager"/>
<property name="proxyInterfaces" value="de.ntec.lms.topology.TopologyService"/>
<property name="target" ref="topologyServiceTarget"/>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>

)

junit.framework.AssertionFailedError: Exception in constructor: testDummy (java.lang.ExceptionInInitializerError

at de.ntec.lms.TopologyTest.<init>(TopologyTest.java:18)

at de.ntec.lms.impl.topology.PlacePerformanceTest.<init>(PlacePerformanceTest.java:15)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

at java.lang.reflect.Constructor.newInstance(Constructor.java:494)

at junit.framework.TestSuite.createTest(TestSuite.java:131)

at junit.framework.TestSuite.addTestMethod(TestSuite.java:114)

at junit.framework.TestSuite.<init>(TestSuite.java:75)

at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.getTest(JUnit3TestLoader.java:102)

at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.loadTests(JUnit3TestLoader.java:59)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor': Instantiation of bean failed; nested exception is java.lang.NullPointerException

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:432)

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:242)

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:239)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:155)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:303)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:348)

at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:92)

at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:77)

at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:68)

at de.ntec.lms.TestContext.<clinit>(TestContext.java:23)

... 15 more

Caused by: java.lang.NullPointerException

at org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor$TransactionAttributeSourcePointcut.getTransactionAttributeSource(TransactionAttributeSourceAdvisor.java:102)

at org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor$TransactionAttributeSourcePointcut.hashCode(TransactionAttributeSourceAdvisor.java:121)

at java.lang.Object.toString(Object.java:209)

at java.lang.String.valueOf(String.java:2577)

at java.lang.StringBuffer.append(StringBuffer.java:220)

at org.springframework.aop.support.AbstractPointcutAdvisor.toString(AbstractPointcutAdvisor.java:71)

at java.lang.String.valueOf(String.java:2577)

at java.lang.StringBuffer.append(StringBuffer.java:220)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:383)

... 25 more

)

at junit.framework.Assert.fail(Assert.java:47)

at junit.framework.TestSuite$1.runTest(TestSuite.java:263)

at junit.framework.TestCase.runBare(TestCase.java:127)

at junit.framework.TestResult$1.protect(TestResult.java:106)

at junit.framework.TestResult.runProtected(TestResult.java:124)

at junit.framework.TestResult.run(TestResult.java:109)

at junit.framework.TestCase.run(TestCase.java:118)

at junit.framework.TestSuite.runTest(TestSuite.java:208)

at junit.framework.TestSuite.run(TestSuite.java:203)

at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)

at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

Affects: 2.0 RC3

Issue Links:

#7102 NPE with TransactionAttributeSourceAdvisor.TransactionAttributeSourcePointcut when debug enabled ("duplicates")

Issue 2:
Henryk Paluch opened SPR-344 and commented

There is an problem in JPetStore application.

When a new user attempts to registers itself on:

http://localhost:8080/jpetstore/shop/newAccount.do

there is not handled the case, when entered user id already exists.

For example for User ID: j2ee

on submit error is displayed:

org.springframework.dao.DataIntegrityViolationException: SqlMapTemplate: Violation of unique index: PK_ACCOUNT in statement [insert into ACCOUNT (EMAIL, FIRSTNAME, LASTNAME, STATUS, ADDR1, ADDR2, CITY, STATE, ZIP, COUNTRY, PHONE, USERID) values ('asdf', 'asdf', 'asdf', 'OK', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'j2ee')]; nested exception is java.sql.SQLException: Violation of unique index: PK_ACCOUNT in statement [insert into ACCOUNT (EMAIL, FIRSTNAME, LASTNAME, STATUS, ADDR1, ADDR2, CITY, STATE, ZIP, COUNTRY, PHONE, USERID) values ('asdf', 'asdf', 'asdf', 'OK', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'j2ee')]

java.sql.SQLException: Violation of unique index: PK_ACCOUNT in statement [insert into ACCOUNT (EMAIL, FIRSTNAME, LASTNAME, STATUS, ADDR1, ADDR2, CITY, STATE, ZIP, COUNTRY, PHONE, USERID) values ('asdf', 'asdf', 'asdf', 'OK', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'j2ee')]

at com.ibatis.db.sqlmap.MappedStatement.executeUpdate(Unknown Source)

at org.springframework.orm.ibatis.SqlMapTemplate$8.doInMappedStatement(SqlMapTemplate.java:218)

at org.springframework.orm.ibatis.SqlMapTemplate.execute(SqlMapTemplate.java:111)

at org.springframework.orm.ibatis.SqlMapTemplate.executeUpdate(SqlMapTemplate.java:216)

at org.springframework.samples.jpetstore.dao.ibatis.SqlMapAccountDao.insertAccount(SqlMapAccountDao.java:24)

at org.springframework.samples.jpetstore.domain.logic.PetStoreImpl.insertAccount(PetStoreImpl.java:74)

Please note, that it is very common problem on user registration. It would be nice to fix this sample to have nice reference implementation. I like to provide fix, but have no idea, how to make custom errors in onSubmit() method of AccountFormController (it is not obvious how to do this).

Affects: 1.0.2