Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: BeanNameAutoProxy failed but not TransactionProxyFactoryBean

  1. #1
    Join Date
    Oct 2005
    Posts
    23

    Default BeanNameAutoProxy failed but not TransactionProxyFactoryBean

    I am using Beannameautoproxycreator for managing transaction. The log file says that " No Hibernate Session bound to thread, and
    configuration does not allow creation of non-transactional one here"

    But if i use TransactionProxyFactoryBean things are fine.

    <bean id="matchAOWMethodsTxInterceptor" class="org.springframework.transaction.interceptor .TransactionInterceptor">
    <property name="transactionManager">
    <ref local="aowTxManager"/>
    </property>

    <property name="transactionAttributeSource">
    <value>
    com.uprr.app.aow.service.spring.aowadmin.Registrat ionImpl.get*=PROPAGATION_REQUIRED,readOnly
    com.uprr.app.aow.service.spring.aowadmin.Organizat ionImpl.get*=PROPAGATION_REQUIRED,readOnly
    com.uprr.app.aow.service.spring.aowadmin.Registrat ionImpl.create*=PROPAGATION_REQUIRED
    com.uprr.app.aow.service.spring.aowadmin.Organizat ionImpl.rename*=PROPAGATION_REQUIRED
    com.uprr.app.aow.service.spring.aowadmin.Organizat ionImpl.change*=PROPAGATION_REQUIRED
    com.uprr.app.aow.service.spring.aowadmin.Organizat ionImpl.add*=PROPAGATION_REQUIRED
    com.uprr.app.aow.service.spring.aowadmin.AdminSear chUtilsImpl.*=PROPAGATION_REQUIRED,readOnly
    </value>
    </property>

    </bean>


    <bean id="autoProxyCreator" class="org.springframework.aop.framework.autoproxy .BeanNameAutoProxyCreator">
    <property name="interceptorNames">
    <list>
    <idref local="matchAOWMethodsTxInterceptor"/>
    <!-- <idref bean="hibInterceptor"/> -->
    </list>
    </property>
    <property name="beanNames">
    <list>
    <idref local="AowAdminSearchUtils"/>
    <idref local="AowAdminOrganization"/>
    <idref local="AowAdminRegistration"/>
    </list>
    </property>
    </bean>

  2. #2
    Join Date
    Sep 2005
    Posts
    26

    Default

    Can you check out if the names under transactionAttributeSource are correct ?
    You can check out if a transaction is starting for your method by enabling logging for org.springframework.transaction on DEBUG level and look in resulting log if a transaction is started by the transaction interceptor. If no transaction is started you should see something like "Don't need to create transaction for"

  3. #3
    Join Date
    Oct 2005
    Posts
    23

    Default

    I don't know how to enable logging for transaction. Can you help me in debugging. But this same code is working for TranscationProxyFactoryBean

    I am using wls TM. Is this a bug in Spring?

    <bean id="aowTxManager" class="org.springframework.transaction.jta.WebLogi cJtaTransactionManager">
    <property name="jndiTemplate">
    <ref bean="jndiTemplate"/>
    </property>
    </bean>


    Here is output from log file.



    - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)13:49:15,970 INFO SettingsFactory:125 - Automatic flush during beforeCompletion(): disabled
    13:49:15,970 INFO SettingsFactory:129 - Automatic session close at end of transaction: disabled
    13:49:15,970 INFO SettingsFactory:136 - JDBC batch size: 15
    13:49:15,970 INFO SettingsFactory:139 - JDBC batch updates for versioned data: disabled
    13:49:15,970 INFO SettingsFactory:144 - Scrollable result sets: enabled
    13:49:15,970 INFO SettingsFactory:152 - JDBC3 getGeneratedKeys(): disabled
    13:49:15,970 INFO SettingsFactory:160 - Connection release mode: null
    13:49:15,970 INFO SettingsFactory:187 - Default batch fetch size: 1
    13:49:15,970 INFO SettingsFactory:191 - Generate SQL with comments: disabled
    13:49:15,970 INFO SettingsFactory:195 - Order SQL updates by primary key: disabled
    13:49:15,970 INFO SettingsFactory:338 - Query translator: org.hibernate.hql.classic.ClassicQueryTranslatorFa ctory
    13:49:15,985 INFO SettingsFactory:203 - Query language substitutions: {}
    13:49:15,985 INFO SettingsFactory:209 - Second-level cache: enabled
    13:49:15,985 INFO SettingsFactory:213 - Query cache: disabled
    13:49:15,985 INFO SettingsFactory:325 - Cache provider: org.hibernate.cache.EhCacheProvider
    13:49:15,985 INFO SettingsFactory:228 - Optimize cache for minimal puts: disabled
    13:49:15,985 INFO SettingsFactory:237 - Structured second-level cache entries: disabled
    13:49:16,001 INFO SettingsFactory:257 - Echoing all SQL to stdout
    13:49:16,001 INFO SettingsFactory:264 - Statistics: enabled
    13:49:16,001 INFO SettingsFactory:268 - Deleted entity synthetic identifier rollback: disabled
    13:49:16,001 INFO SettingsFactory:283 - Default entity-mode: POJO
    13:49:16,063 INFO SessionFactoryImpl:157 - building session factory
    13:49:16,079 WARN Configurator:126 - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/C:/dev/eclipse/workspace/Design/lib/ehcache-1.1.jar!/ehcache-failsafe.xml
    13:49:16,766 INFO SessionFactoryObjectFactory:82 - Not binding factory to JNDI, no JNDI name configured
    13:49:16,766 INFO SessionFactoryImpl:432 - Checking 0 named queries
    org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here

  4. #4
    Join Date
    Sep 2005
    Posts
    26

    Default

    Instead of using the full name of the implementing class as for example
    com.uprr.app.aow.service.spring.aowadmin.Registrat ionImpl.get* use the full name of the interface implemented by your RegistrationImpl class. (e.g. com.uprr.app.aow.service.spring.aowadmin.Registrat ion.get*)

  5. #5
    Join Date
    Oct 2005
    Posts
    23

    Default

    No it's not even working. Have you tryied it? Is it working for you when you use AutpProxy to manage Transcations?

  6. #6
    Join Date
    Aug 2004
    Location
    San Mateo, CA
    Posts
    1,265

    Default

    Get a reference to one of the objects that should be proxied and try casting it to Advised to see if it is in fact proxied. If not you may have an error on the bean names.

    Try using * for the method names to check whether you have an error on method name matches.

    However, if you're using WebLogicJtaTransactionManager, which you should be if you want WLS global tx mgt, you need to ensure that Hibernate is configured to use JTA.
    Rod Johnson - GM, SpringSource Division, VMware
    http://www.springsource.com
    Spring From the Source

  7. #7
    Join Date
    Oct 2005
    Posts
    23

    Default

    Instead of specifying the method name, changed it to * like this

    com.uprr.app.aow.service.spring.aowadmin.OrganizationImpl.*=PROPAGATION_REQUIRED,readOnly

    Also included

    <prop key="transaction.manager_lookup_class">org.hiberna te.transaction.WeblogicTransactionManagerLookup</prop>

    <prop key="transaction.factory_class">org.hibernate.tran saction.JTATransactionFactory</prop>


    still no luck getting "No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here"

  8. #8
    Join Date
    Aug 2004
    Location
    San Mateo, CA
    Posts
    1,265

    Default

    Did you check if the class was proxied? Try casting to Advised and please post the output of toProxyConfigString() on the Advised instance.
    Rod Johnson - GM, SpringSource Division, VMware
    http://www.springsource.com
    Spring From the Source

  9. #9
    Join Date
    Oct 2005
    Posts
    23

    Default

    Tryied following code and output is below

    ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext .xml");
    Advised organizationService = (Advised) ctx.getBean("AowAdminOrganization");
    System.out.println(organizationService.toProxyConf igString());


    Output:

    1 interfaces=[com.uprr.app.aow.service.spring.aowadmin.IOrganiza tion]; 3 advisors=[{PointcutAdvisor: pointcut [Pointcut.TRUE], advice [org.springframework.transaction.interceptor.Transa ctionInterceptor@1a3bc8c]},{PointcutAdvisor: pointcut [Pointcut.TRUE], advice [org.springframework.aop.interceptor.DebugIntercept or@af914c]},{PointcutAdvisor: pointcut [Pointcut.TRUE], advice [org.springframework.aop.interceptor.TraceIntercept or@6c2a78]}]; targetSource=[SingletonTargetSource for target: com.uprr.app.aow.service.spring.aowadmin.Organizat ionImpl@15863e4]; proxyTargetClass=false; optimize=false; exposeProxy=false; opaque=false; frozen=false; aopProxyFactory=org.springframework.aop.framework. DefaultAopProxyFactory@6270b; advisorChainFactory=org.springframework.aop.framew ork.HashMapCachingAdvisorChainFactory@1ed54a0

  10. #10
    Join Date
    Oct 2005
    Posts
    23

    Default

    Can I try changing the attribute from required to not supported?

Similar Threads

  1. Context initialization failed
    By kanonmicke in forum Container
    Replies: 7
    Last Post: Sep 29th, 2005, 12:35 AM
  2. Replies: 13
    Last Post: Jul 28th, 2005, 04:19 AM
  3. Replies: 3
    Last Post: Mar 4th, 2005, 04:50 AM
  4. Replies: 2
    Last Post: Nov 24th, 2004, 02:34 AM
  5. Replies: 3
    Last Post: Nov 8th, 2004, 07:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •