<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=al0" rel="nofollow">Oleksandr Alesinskyy</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-2503?redirect=false" rel="nofollow">SPR-2503</a></strong> and commented</p>
<p dir="auto">I have following context.xml</p>
<p dir="auto">&lt;?xml version="1.0" encoding="UTF-8"?&gt;</p>
<p dir="auto">&lt;beans xmlns="<a href="http://www.springframework.org/schema/beans" rel="nofollow">http://www.springframework.org/schema/beans</a>"<br>
xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance" rel="nofollow">http://www.w3.org/2001/XMLSchema-instance</a>"<br>
xmlns:aop="<a href="http://www.springframework.org/schema/aop" rel="nofollow">http://www.springframework.org/schema/aop</a>"<br>
xmlns:tx="<a href="http://www.springframework.org/schema/tx" rel="nofollow">http://www.springframework.org/schema/tx</a>"<br>
xsi:schemaLocation=<br>
"<a href="http://www.springframework.org/schema/beans" rel="nofollow">http://www.springframework.org/schema/beans</a><br>
<a href="http://www.springframework.org/schema/beans/spring-beans.xsd" rel="nofollow">http://www.springframework.org/schema/beans/spring-beans.xsd</a><br>
<a href="http://www.springframework.org/schema/aop" rel="nofollow">http://www.springframework.org/schema/aop</a><br>
<a href="http://www.springframework.org/schema/aop/spring-aop.xsd" rel="nofollow">http://www.springframework.org/schema/aop/spring-aop.xsd</a><br>
<a href="http://www.springframework.org/schema/tx" rel="nofollow">http://www.springframework.org/schema/tx</a><br>
<a href="http://www.springframework.org/schema/tx/spring-tx.xsd" rel="nofollow">http://www.springframework.org/schema/tx/spring-tx.xsd</a>"</p>
<blockquote>
<p dir="auto">&lt;tx:annotation-driven transaction-manager="txManager"/&gt;</p>
<p dir="auto">&lt;!-- TOPOLOGY --&gt;</p>
<p dir="auto">&lt;bean id="topologyAddressFactoryBuilder"<br>
class="de.ntec.lms.impl.topology.TopologyAddressFactoryBuilder"&gt;<br>
&lt;property name="delimiter" value="/"/&gt;<br>
&lt;/bean&gt;<br>
&lt;bean id="topologyAddressFactory"<br>
factory-bean="topologyAddressFactoryBuilder"<br>
factory-method="create"<br>
/&gt;</p>
<p dir="auto">&lt;!-- DATABASE &amp; HIBERNATE --&gt;<br>
&lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"&gt;</p>
<blockquote>
<p dir="auto">&lt;property name="driverClassName" value="org.apache.derby.jdbc.ClientDriver"/&gt;<br>
&lt;property name="url" value="jdbc:derby://localhost:1527//work/lms"/&gt;<br>
&lt;property name="username" value="lms"/&gt;<br>
&lt;property name="password" value="secret"/&gt;</p>
</blockquote>
<p dir="auto">&lt;/bean&gt;<br>
&lt;bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&gt;<br>
&lt;property name="dataSource" ref="dataSource"/&gt;<br>
&lt;property name="mappingResources"&gt;<br>
&lt;list&gt;<br>
&lt;value&gt;de/ntec/lms/impl/topology/Company.hbm.xml&lt;/value&gt;<br>
&lt;value&gt;de/ntec/lms/impl/topology/Site.hbm.xml&lt;/value&gt;<br>
&lt;value&gt;de/ntec/lms/impl/topology/Location.hbm.xml&lt;/value&gt;<br>
&lt;value&gt;de/ntec/lms/impl/topology/Rack.hbm.xml&lt;/value&gt;<br>
&lt;value&gt;de/ntec/lms/impl/topology/Cell.hbm.xml&lt;/value&gt;<br>
&lt;value&gt;de/ntec/lms/impl/topology/Place.hbm.xml&lt;/value&gt;<br>
&lt;/list&gt;<br>
&lt;/property&gt;<br>
&lt;property name="hibernateProperties"&gt;<br>
&lt;props&gt;<br>
&lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.DerbyDialect&lt;/prop&gt;<br>
&lt;/props&gt;<br>
&lt;/property&gt;<br>
&lt;/bean&gt;<br>
&lt;bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt;<br>
&lt;property name="sessionFactory" ref="sessionFactory"/&gt;<br>
&lt;/bean&gt;</p>
<p dir="auto">&lt;!-- PERSISTENCE --&gt;<br>
&lt;bean id="placeDao"<br>
class="de.ntec.lms.impl.topology.PlaceDao" init-method="init"&gt;<br>
&lt;property name="sessionFactory" ref="sessionFactory"/&gt;<br>
&lt;property name="beanClass" value="de.ntec.lms.impl.topology.PlaceImpl"/&gt;<br>
&lt;/bean&gt;<br>
&lt;bean id="cellDao"<br>
class="de.ntec.lms.impl.topology.CellDao" init-method="init"&gt;<br>
&lt;property name="sessionFactory" ref="sessionFactory"/&gt;<br>
&lt;property name="beanClass" value="de.ntec.lms.impl.topology.CellImpl"/&gt;<br>
&lt;property name="successorDao" ref="placeDao"/&gt;<br>
&lt;/bean&gt;<br>
&lt;bean id="rackDao"<br>
class="de.ntec.lms.impl.topology.RackDao" init-method="init"&gt;<br>
&lt;property name="sessionFactory" ref="sessionFactory"/&gt;<br>
&lt;property name="beanClass" value="de.ntec.lms.impl.topology.RackImpl"/&gt;<br>
&lt;property name="successorDao" ref="cellDao"/&gt;<br>
&lt;/bean&gt;<br>
&lt;bean id="locationDao"<br>
class="de.ntec.lms.impl.topology.LocationDao" init-method="init"&gt;<br>
&lt;property name="sessionFactory" ref="sessionFactory"/&gt;<br>
&lt;property name="beanClass" value="de.ntec.lms.impl.topology.LocationImpl"/&gt;<br>
&lt;property name="successorDao" ref="rackDao"/&gt;<br>
&lt;/bean&gt;<br>
&lt;bean id="siteDao"<br>
class="de.ntec.lms.impl.topology.SiteDao" init-method="init"&gt;<br>
&lt;property name="sessionFactory" ref="sessionFactory"/&gt;<br>
&lt;property name="beanClass" value="de.ntec.lms.impl.topology.SiteImpl"/&gt;<br>
&lt;property name="successorDao" ref="locationDao"/&gt;<br>
&lt;/bean&gt;<br>
&lt;bean id="companyDao"<br>
class="de.ntec.lms.impl.topology.CompanyDao" init-method="init"&gt;<br>
&lt;property name="sessionFactory" ref="sessionFactory"/&gt;<br>
&lt;property name="beanClass" value="de.ntec.lms.impl.topology.CompanyImpl"/&gt;<br>
&lt;property name="successorDao" ref="siteDao"/&gt;<br>
&lt;/bean&gt;<br>
&lt;bean id="topologyService"<br>
class="de.ntec.lms.impl.topology.TopologyServiceImpl" init-method="init"&gt;<br>
&lt;property name="companyDao" ref="companyDao"/&gt;<br>
&lt;property name="addressFactory" ref="topologyAddressFactory"/&gt;<br>
&lt;/bean&gt;</p>
</blockquote>
<p dir="auto">&lt;/beans&gt;</p>
<p dir="auto">and following log4j configuration</p>
<p dir="auto">&lt;?xml version="1.0" encoding="UTF-8" ?&gt;<br>
&lt;!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"&gt;</p>
<p dir="auto">log4j:configuration<br>
&lt;appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"&gt;<br>
&lt;layout class="org.apache.log4j.PatternLayout"&gt;</p>
<p dir="auto">&lt;param name="ConversionPattern" value="%d{ISO8601} %5p %c%n    %m%n"/&gt;<br>
&lt;/layout&gt;<br>
&lt;/appender&gt;<br>
&lt;logger name="org.springframework" additivity="false"&gt;<br>
&lt;level value="info"/&gt;<br>
&lt;appender-ref ref="CONSOLE"/&gt;<br>
&lt;/logger&gt;<br>
&lt;root&gt;<br>
&lt;priority value="info"/&gt;<br>
&lt;appender-ref ref="CONSOLE"/&gt;<br>
&lt;/root&gt;<br>
&lt;/log4j:configuration&gt;</p>
<p dir="auto">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 &lt;tx:annotation-driven transaction-manager="txManager"/&gt;<br>
tag log level does not affect behavior (even in presence of XML configuration for transactional AOP, e.g.<br>
&lt;bean id="topologyServiceTarget"<br>
class="de.ntec.lms.impl.topology.TopologyServiceImpl" init-method="init"&gt;<br>
&lt;property name="companyDao" ref="companyDao"/&gt;<br>
&lt;property name="addressFactory" ref="topologyAddressFactory"/&gt;<br>
&lt;/bean&gt;</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;bean id=&quot;topologyService&quot;
	  class=&quot;org.springframework.transaction.interceptor.TransactionProxyFactoryBean&quot;&gt;
	&lt;property name=&quot;transactionManager&quot; ref=&quot;txManager&quot;/&gt;
	&lt;property name=&quot;proxyInterfaces&quot; value=&quot;de.ntec.lms.topology.TopologyService&quot;/&gt;
	&lt;property name=&quot;target&quot; ref=&quot;topologyServiceTarget&quot;/&gt;
	&lt;property name=&quot;transactionAttributes&quot;&gt;
		&lt;props&gt;
			&lt;prop key=&quot;*&quot;&gt;PROPAGATION_REQUIRED&lt;/prop&gt;
		&lt;/props&gt;
	&lt;/property&gt;
&lt;/bean&gt;	"><pre class="notranslate"><code class="notranslate">&lt;bean id="topologyService"
	  class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"&gt;
	&lt;property name="transactionManager" ref="txManager"/&gt;
	&lt;property name="proxyInterfaces" value="de.ntec.lms.topology.TopologyService"/&gt;
	&lt;property name="target" ref="topologyServiceTarget"/&gt;
	&lt;property name="transactionAttributes"&gt;
		&lt;props&gt;
			&lt;prop key="*"&gt;PROPAGATION_REQUIRED&lt;/prop&gt;
		&lt;/props&gt;
	&lt;/property&gt;
&lt;/bean&gt;	
</code></pre></div>
<p dir="auto">)</p>
<p dir="auto">junit.framework.AssertionFailedError: Exception in constructor: testDummy (java.lang.ExceptionInInitializerError<br>
at de.ntec.lms.TopologyTest.&lt;init&gt;(TopologyTest.java:18)<br>
at de.ntec.lms.impl.topology.PlacePerformanceTest.&lt;init&gt;(PlacePerformanceTest.java:15)<br>
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)<br>
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)<br>
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)<br>
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)<br>
at junit.framework.TestSuite.createTest(TestSuite.java:131)<br>
at junit.framework.TestSuite.addTestMethod(TestSuite.java:114)<br>
at junit.framework.TestSuite.&lt;init&gt;(TestSuite.java:75)<br>
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.getTest(JUnit3TestLoader.java:102)<br>
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.loadTests(JUnit3TestLoader.java:59)<br>
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)<br>
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)<br>
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)<br>
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)<br>
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<br>
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:432)<br>
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:242)<br>
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)<br>
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:239)<br>
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:155)<br>
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:303)<br>
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:348)<br>
at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:92)<br>
at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:77)<br>
at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:68)<br>
at de.ntec.lms.TestContext.&lt;clinit&gt;(TestContext.java:23)<br>
... 15 more<br>
Caused by: java.lang.NullPointerException<br>
at org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor$TransactionAttributeSourcePointcut.getTransactionAttributeSource(TransactionAttributeSourceAdvisor.java:102)<br>
at org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor$TransactionAttributeSourcePointcut.hashCode(TransactionAttributeSourceAdvisor.java:121)<br>
at java.lang.Object.toString(Object.java:209)<br>
at java.lang.String.valueOf(String.java:2577)<br>
at java.lang.StringBuffer.append(StringBuffer.java:220)<br>
at org.springframework.aop.support.AbstractPointcutAdvisor.toString(AbstractPointcutAdvisor.java:71)<br>
at java.lang.String.valueOf(String.java:2577)<br>
at java.lang.StringBuffer.append(StringBuffer.java:220)<br>
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:383)<br>
... 25 more<br>
)<br>
at junit.framework.Assert.fail(Assert.java:47)<br>
at junit.framework.TestSuite$1.runTest(TestSuite.java:263)<br>
at junit.framework.TestCase.runBare(TestCase.java:127)<br>
at junit.framework.TestResult$1.protect(TestResult.java:106)<br>
at junit.framework.TestResult.runProtected(TestResult.java:124)<br>
at junit.framework.TestResult.run(TestResult.java:109)<br>
at junit.framework.TestCase.run(TestCase.java:118)<br>
at junit.framework.TestSuite.runTest(TestSuite.java:208)<br>
at junit.framework.TestSuite.run(TestSuite.java:203)<br>
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)<br>
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)<br>
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)<br>
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)<br>
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)<br>
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.0 RC3</p>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398069268" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/7102" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/7102/hovercard" href="https://github.com/spring-projects/spring-framework/issues/7102">#7102</a> NPE with TransactionAttributeSourceAdvisor.TransactionAttributeSourcePointcut when debug enabled (<em><strong>"duplicates"</strong></em>)</li>
</ul>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=hpaluch" rel="nofollow">Henryk Paluch</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-344?redirect=false" rel="nofollow">SPR-344</a></strong> and commented</p>
<p dir="auto">There is an problem in JPetStore application.<br>
When a new user attempts to registers itself on:<br>
<a href="http://localhost:8080/jpetstore/shop/newAccount.do" rel="nofollow">http://localhost:8080/jpetstore/shop/newAccount.do</a><br>
there is not handled the case, when entered user id already exists.<br>
For example for User ID: j2ee<br>
on submit error is displayed:</p>
<hr>
<p dir="auto">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')]<br>
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')]<br>
at com.ibatis.db.sqlmap.MappedStatement.executeUpdate(Unknown Source)<br>
at org.springframework.orm.ibatis.SqlMapTemplate$8.doInMappedStatement(SqlMapTemplate.java:218)<br>
at org.springframework.orm.ibatis.SqlMapTemplate.execute(SqlMapTemplate.java:111)<br>
at org.springframework.orm.ibatis.SqlMapTemplate.executeUpdate(SqlMapTemplate.java:216)<br>
at org.springframework.samples.jpetstore.dao.ibatis.SqlMapAccountDao.insertAccount(SqlMapAccountDao.java:24)<br>
at org.springframework.samples.jpetstore.domain.logic.PetStoreImpl.insertAccount(PetStoreImpl.java:74)</p>
<hr>
<p dir="auto">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).</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 1.0.2</p>