Announcement Announcement Module
Collapse
No announcement yet.
Transaction MGMT Using Spring AOP Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Transaction MGMT Using Spring AOP

    Hi,

    I'm using Springs version 2.0 with ACEGI Security 1.0.6 vesrion....I'm trying to use Spring Trxn Mgmt...but i'm not able too... asn i get the Below Stack Trace.....

    Given is the Configuration in the applicationContext.xml for the Transaction Management....

    pls...help

    <!-- Tranx Management -->

    <bean id="hibernatetransactionManager" class="org.springframework.orm.hibernate3.Hibernat eTransactionManager">
    <property name="sessionFactory" ref="sessionFactory"/>
    </bean>

    <bean id="jdbctransactionManager" class="org.springframework.jdbc.datasource.DataSou rceTransactionManager">
    <property name="dataSource" ref="dataSource"/>
    </bean>

    <!-- enable the configuration of transactional behavior based on annotations -->

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

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

    <tx:advice transaction-manager="hibernatetransactionManager" id="txAdvice">
    <tx:attributes>

    <tx:method name="add*" propagation="REQUIRED" />
    <tx:method name="delete*" propagation="SUPPORTS"
    read-only="true"/>
    </tx:attributes>
    </tx:advice>

    <!-- this is the service object that we want to make transactional -->
    <bean id="qbankdaointerface" class="com.globarena.onlineexams.manager.dao.inter faces.QuestionBankWizardDAOInterface"/>

    <aop:aspectj-autoproxy />

    <aop:config>
    <aopointcut id="qbankdaoOperation" expression="execution(* com.globarena.onlineexams.manager.dao.*.*(..))"/>
    <aop:advisor advice-ref="txAdvice" pointcut-ref="qbankdaoOperation"/>
    </aop:config>


    Stack Trace:

    INFO] [2009-09-23 @ 17:20:23] [main|DefaultListableBeanFactory] Destroying singletons in {org.springframework.beans.factory.support.Default ListableBeanFactory defining beans [filterChainProxy,ajaxHttpSessionContextIntegration Filter,sessionRegistry,logoutFilter,authentication ProcessingFilter,securityContextHolderAwareRequest Filter,rememberMeProcessingFilter,anonymousProcess ingFilter,basicProcessingFilter,basicProcessingFil terEntryPoint,switchUserProcessingFilter,exception TranslationFilter,filterInvocationInterceptor,role Voter,rememberMeServices,authenticationManager,con currentSessionController,daoAuthenticationProvider ,passwordEncoder,saltSource,userDetailsService,ehc ache,cacheManager,loggerListener,propertyConfigure r,dataSource,businesslogicbean,beanTarget,loginadv isor,theTracingBeforeAdvice,sessionFactory,adminRe gDao,managerRegDao,studentRegDao,approverRegDao,le anerReportsDAO,groupLearnersDAO,proctorRegDao,comm onConfig,roleDao,qbankdao,qbankupdationdao,qpaperd ao,exampaperdao,utilitiesClass,hibernatetransactio nManager,jdbctransactionManager,org.springframewor k.aop.config.internalAutoProxyCreator,org.springfr amework.transaction.interceptor.TransactionAttribu teSourceAdvisor,org.springframework.transaction.in terceptor.TransactionAttributeSourceAdvisor#1,txAd vice,qbankdaointerface,qbankdaoOperation,org.sprin gframework.aop.aspectj.AspectJPointcutAdvisor]; root of BeanFactory hierarchy}
    [INFO] [2009-09-23 @ 17:20:24] [main|LocalSessionFactoryBean] Closing Hibernate SessionFactory
    [INFO] [2009-09-23 @ 17:20:24] [main|SessionFactoryImpl] closing
    [ERROR] [2009-09-23 @ 17:20:24] [main|ContextLoader] Context initialization failed
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sessionRegistry' defined in ServletContext resource [/WEB-INF/applicationContext-acegi-security.xml]: Initialization of bean failed; nested exception is java.util.regex.PatternSyntaxException: Dangling meta character '*' near index 0
    *
    ^
    Caused by:
    java.util.regex.PatternSyntaxException: Dangling meta character '*' near index 0
    *
    ^
    at java.util.regex.Pattern.error(Pattern.java:1650)
    at java.util.regex.Pattern.sequence(Pattern.java:1787 )
    at java.util.regex.Pattern.expr(Pattern.java:1687)
    at java.util.regex.Pattern.compile(Pattern.java:1397)
    at java.util.regex.Pattern.<init>(Pattern.java:1124)
    at java.util.regex.Pattern.compile(Pattern.java:817)
    at org.springframework.aop.support.JdkRegexpMethodPoi ntcut.compilePatterns(JdkRegexpMethodPointcut.java :95)
    at org.springframework.aop.support.JdkRegexpMethodPoi ntcut.initPatternRepresentation(JdkRegexpMethodPoi ntcut.java:60)
    at org.springframework.aop.support.AbstractRegexpMeth odPointcut.setPatterns(AbstractRegexpMethodPointcu t.java:80)
    at org.springframework.aop.support.RegexpMethodPointc utAdvisor.getPointcut(RegexpMethodPointcutAdvisor. java:152)
    at org.springframework.aop.support.AopUtils.canApply( AopUtils.java:231)
    at org.springframework.aop.support.AopUtils.findAdvis orsThatCanApply(AopUtils.java:256)
    at org.springframework.aop.framework.autoproxy.Abstra ctAdvisorAutoProxyCreator.findEligibleAdvisors(Abs tractAdvisorAutoProxyCreator.java:68)
    at org.springframework.aop.framework.autoproxy.Abstra ctAdvisorAutoProxyCreator.getAdvicesAndAdvisorsFor Bean(AbstractAdvisorAutoProxyCreator.java:54)
    at org.springframework.aop.framework.autoproxy.Abstra ctAutoProxyCreator.postProcessAfterInitialization( AbstractAutoProxyCreator.java:247)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyBeanPostProcessors AfterInitialization(AbstractAutowireCapableBeanFac tory.java:311)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1038)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:420)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 45)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:141)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:242)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:156)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.getBeansOfType(DefaultListableB eanFactory.java:238)
    at org.springframework.context.support.AbstractApplic ationContext.getBeansOfType(AbstractApplicationCon text.java:697)
    at org.springframework.context.support.AbstractApplic ationContext.registerListeners(AbstractApplication Context.java:521)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:345)
    at org.springframework.web.context.support.AbstractRe freshableWebApplicationContext.refresh(AbstractRef reshableWebApplicationContext.java:156)
    at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:246)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:184)
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 49)
    at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:3830)
    at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4337)
    at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:791)
    at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:771)
    at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:525)
    at org.apache.catalina.startup.HostConfig.deployDescr iptor(HostConfig.java:626)
    at org.apache.catalina.startup.HostConfig.deployDescr iptors(HostConfig.java:553)
    at org.apache.catalina.startup.HostConfig.deployApps( HostConfig.java:488)
    at org.apache.catalina.startup.HostConfig.start(HostC onfig.java:1138)
    at org.apache.catalina.startup.HostConfig.lifecycleEv ent(HostConfig.java:311)
    at org.apache.catalina.util.LifecycleSupport.fireLife cycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1053)
    at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:719)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(Sta ndardService.java:516)
    at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalin a.java:566)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:288)
    at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:413)

  • #2
    use [ code][/code ] tags when posting code that way it remains readable!!!!

    Please modify post.

    At a first glance your configuration is wrong on multiple levels.

    1) 2 tx:annotation-driven elements
    2) 2!!! transactions managers
    3) 1 and 2 don't work together
    4) xml declaration for transactions

    So what do you want to use???

    Also judging from your stacktrace it hasnothing to do with transactions but with a crappy regular expression somewhere in your security configuration.

    Code:
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sessionRegistry' defined in ServletContext resource [/WEB-INF/applicationContext-acegi-security.xml]: Initialization of bean failed; nested exception is java.util.regex.PatternSyntaxException: Dangling meta character '*' near index 0
    Last edited by Marten Deinum; Sep 23rd, 2009, 09:14 AM.

    Comment

    Working...
    X