我被分配到的项目使用xml文件创建aop配置。
1部分:
我的xml文件中配置的aop是:
<aop:config>
<aop:advisor advice-ref="txAdvice" pointcut="execution(public * com.RR..manager..*.*(..)) &&
!execution(public * com.RR.DD.manager.IMan.isNonProductionEnvironment(..)) &&
!execution(public * com.RR.DD.manager.IMan.isProductionEnvironment(..))" />
<aop:advisor advice-ref="txAdvice" pointcut="execution(public * com.highradius..manager..*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut="execution(public * com.scraper.correspondence..manager..*.*(..))" />
</aop:config>
有人能解释一下这里做了什么。我知道切点的作用但在这里我无法弄清楚那些&#34;&amp; amp&#34;意味着整个事情让我感到困惑。
2部分:
我探索这个的原因也是因为我得到了&#34; javax.persistence.TransactionRequiredException:没有正在进行的交易&#34;例外:
javax.persistence.TransactionRequiredException: no transaction is in progress
at org.hibernate.internal.SessionImpl.checkTransactionNeeded(SessionImpl.java:3466) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1426) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1422) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
at org.springframework.orm.hibernate5.SessionFactoryUtils.flush(SessionFactoryUtils.java:144) ~[spring-orm-4.3.15.RELEASE.jar:4.3.15.RELEASE]
at org.springframework.orm.hibernate5.SpringSessionSynchronization.beforeCommit(SpringSessionSynchronization.java:95) ~[spring-orm-4.3.15.RELEASE.jar:4.3.15.RELEASE]
at org.springframework.transaction.support.TransactionSynchronizationUtils.triggerBeforeCommit(TransactionSynchronizationUtils.java:95) ~[spring-tx-4.3.15.RELEASE.jar:4.3.15.RELEASE]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCommit(AbstractPlatformTransactionManager.java:936) ~[spring-tx-4.3.15.RELEASE.jar:4.3.15.RELEASE]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:748) ~[spring-tx-4.3.15.RELEASE.jar:4.3.15.RELEASE]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:734) ~[spring-tx-4.3.15.RELEASE.jar:4.3.15.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:518) ~[spring-tx-4.3.15.RELEASE.jar:4.3.15.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:292) ~[spring-tx-4.3.15.RELEASE.jar:4.3.15.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.3.15.RELEASE.jar:4.3.15.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.15.RELEASE.jar:4.3.15.RELEASE]
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.3.15.RELEASE.jar:4.3.15.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.15.RELEASE.jar:4.3.15.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) ~[spring-aop-4.3.15.RELEASE.jar:4.3.15.RELEASE]
at com.sun.proxy.$Proxy148.isTriggerEmailForNonProdEnvironment(Unknown Source) ~[?:?]
at com.scraper.EmailManagement.filterEmailAddress(EmailManagement.java:525) ~[agent_base-18.6.0-SNAPSHOT-falconfit.jar:?]
at com.scraper.EmailManagement.sendMailWithTemplateAndCc(EmailManagement.java:637) ~[agent_base-18.6.0-SNAPSHOT-falconfit.jar:?]
at com.highradius.eci.agentframework.executor.impl.ECIStandardJobExecutor.sendJobStatusMailNotifiation(ECIStandardJobExecutor.java:823) ~[eci_framework-18.6.0-SNAPSHOT-falconfit.jar:?]
at com.highradius.eci.agentframework.executor.impl.ECIStandardJobExecutor.executeJob(ECIStandardJobExecutor.java:458) ~[eci_framework-18.6.0-SNAPSHOT-falconfit.jar:?]
at com.highradius.eci.agentframework.ECIStandardAction.run(ECIStandardAction.java:89) ~[eci_framework-18.6.0-SNAPSHOT-falconfit.jar:?]
at com.scraper.ScheduledAgentLauncher.immediatelyLaunchScheduledAgent(ScheduledAgentLauncher.java:365) ~[agent_base-18.6.0-SNAPSHOT-falconfit.jar:?]
at com.scraper.WrapperAgentAction.run(WrapperAgentAction.java:182) ~[agent_base-18.6.0-SNAPSHOT-falconfit.jar:?]
at sun.reflect.GeneratedMethodAccessor3068.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_101]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_101]
at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:265) ~[spring-core-4.3.15.RELEASE.jar:4.3.15.RELEASE]
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:257) ~[spring-context-support-4.3.15.RELEASE.jar:4.3.15.RELEASE]
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:75) ~[spring-context-support-4.3.15.RELEASE.jar:4.3.15.RELEASE]
at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ~[quartz-2.2.3.jar:?]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) ~[quartz-2.2.3.jar:?]
异常&#34; com.sun.proxy。$ Proxy148.isTriggerEmailForNonProdEnvironment(未知来源)〜[?:?]&#34;是关于函数&#34; isTriggerEmailForNonProdEnvironment&#34;在Iman接口声明并由ImanImpl类定义。
任何部分的帮助都会得到满足。
答案 0 :(得分:0)
第1部分的解决方案:
Xml编辑不理解'&amp;'运算符,以便让XMl编辑器了解我们在您的情况下使用&
&&
表示'&amp;&amp;' 。
第2部分的解决方案: 请在xml中添加以下代码,以便在使用@Transactional注释时,可以参考此内容。
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="myEntitymangrfctry" />
</bean>
<tx:annotation-driven />