Issue Details (XML | Word | Printable)

Key: APF-887
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Matt Raible
Reporter: Matt Raible
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
AppFuse

Running full-source on a project with dao.framework = jpa results in test failures

Created: 16/Sep/07 05:40 PM   Updated: 04/Apr/08 12:22 AM   Resolved: 16/Sep/07 05:51 PM
Component/s: Service Layer, Tools - AMP
Affects Version/s: 2.0-RC1
Fix Version/s: 2.0 Final


 Description  « Hide
Tests run: 3, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.12
sec <<< FAILURE!
testGetUser(com.mycompany.app.service.UserManagerTest) Time elapsed:
0.022 sec <<< ERROR!
java.lang.IllegalStateException: Property 'transactionManager' must be
set on transaction aspect
at org.springframework.util.Assert.state(Assert.java:353)
at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:261)
at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:219)
at org.springframework.transaction.aspectj.AbstractTransactionAspect.ajc$before$org_springframework_transaction_aspectj_AbstractTransactionAspect$1$2a73e96c(AbstractTransactionAspect.aj:64)
at com.mycompany.app.dao.jpa.UserDaoJpa.loadUserByUsername(UserDaoJpa.java)
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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:296)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:177)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy21.loadUserByUsername(Unknown Source)
at com.mycompany.app.service.impl.UserManagerImpl.getUserByUsername(UserManagerImpl.java:84)
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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:296)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:177)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy29.getUserByUsername(Unknown Source)
at com.mycompany.app.service.UserManagerTest.testGetUser(UserManagerTest.java:25)
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 junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)

Sort Order: Ascending order - Click to sort in descending order
Matt Raible added a comment - 16/Sep/07 05:41 PM
More information: http://forum.springframework.org/showthread.php?p=139502

Seems to be a bug in Spring 2.0.6: http://opensource.atlassian.com/projects/spring/browse/SPR-3817

Workaround is to add the following to applicationContext-service.xml:

  <bean class="org.springframework.transaction.aspectj.AnnotationTransactionAspect" factory-method="aspectOf" dependency-check="none" lazy-init="false">
      <property name="transactionManager" ref="transactionManager"/>
  </bean>

Marcello Teodori added a comment - 19/Mar/08 05:42 AM
is this stiil needed, now that we are using the released Spring 2.5.x?

Matt Raible added a comment - 04/Apr/08 12:22 AM
Here's what I did to test:

1. Created project using:

mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-jsf -DremoteRepositories=http://static.appfuse.org/releases -DarchetypeVersion=2.0.2-SNAPSHOT -DgroupId=com.mycompany.app -DartifactId=myproject

2. cd myproject, vi pom.xml, change <dao.framework> to jpa
3. mvn install

[INFO] [talledLocalContainer] [myproject] ERROR [http-8081-4] MailEngine.send(77) | Could not connect to SMTP host: localhost, port: 25

@#$#@$!! - sudo postfix start; mvn install

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 52 seconds
[INFO] Finished at: Thu Apr 03 23:16:05 MDT 2008
[INFO] Final Memory: 47M/511M
[INFO] ------------------------------------------------------------------------
powers:myproject mraible$

4. mvn appfuse:full-source

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 28 seconds
[INFO] Finished at: Thu Apr 03 23:17:07 MDT 2008
[INFO] Final Memory: 8M/511M
[INFO] ------------------------------------------------------------------------

5. mvn clean install

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 minute 9 seconds
[INFO] Finished at: Thu Apr 03 23:18:55 MDT 2008
[INFO] Final Memory: 47M/511M
[INFO] ------------------------------------------------------------------------

6. vi src/main/resources/applicationContext-service.xml, removed bean reference above

7. mvn clean install

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 minute 4 seconds
[INFO] Finished at: Thu Apr 03 23:20:57 MDT 2008
[INFO] Final Memory: 47M/511M
[INFO] ------------------------------------------------------------------------

To answer you question: No, it doesn't seem like this is still needed. I'll fix it and reference this bug.