Announcement Announcement Module
Collapse
No announcement yet.
@Transactional is not creating a transaction while using JPA (JTA Implementation) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • @Transactional is not creating a transaction while using JPA (JTA Implementation)

    Hello Guys,

    I see that JPA wont commt the data into DB if it is not part of a transaction. So i am trying to make the save method in my service class to be part of a transaction.

    I am using the @Transactional annotation on the save method in my service class. But i get the error saying that a "Transaction is Required. There is no active transaction"

    Here is the my service method

    Code:
    @Transactional(propagation = Propagation.REQUIRED)
    public void saveConcept(AeroConceptHeader concept){
    		AeroConceptBudget conceptBudget = new AeroConceptBudget();
    		ConceptComment conceptComment = new ConceptComment();
    		ConceptEnvironment conceptEnvironment = new ConceptEnvironment();
    		Set<AeroConceptBudget> aeroConceptBudgets = new HashSet<AeroConceptBudget>();
    		Set<ConceptComment> conceptComments = new HashSet<ConceptComment>();
    		
    		if(concept!=null){
    			BigDecimal nextCncpId = aeroConceptDao.getNextCncpId();
    			
    			aeroConceptBudgets = concept.getAeroConceptBudgets();
    			if(aeroConceptBudgets!=null && aeroConceptBudgets.size() > 0){
    				Iterator<AeroConceptBudget> itr = aeroConceptBudgets.iterator();
    				while(itr.hasNext()){
    					conceptBudget = itr.next();
    					conceptBudget.setCncpId(nextCncpId.intValue());
    					conceptBudget.setBdgtSeqNum(aeroConceptDao.getNextbdgtSeqNum().intValue());
    				}
    			}
    			
    			conceptComments = concept.getConceptComments();
    			if(conceptComments!=null && conceptComments.size() > 0){
    				Iterator<ConceptComment> itr1 = conceptComments.iterator();
    				while(itr1.hasNext()){
    					conceptComment = itr1.next();
    					conceptComment.setCncpId(nextCncpId.intValue());
    				}
    			}
    			
    			conceptEnvironment = concept.getConceptEnvironment();
    			if(conceptEnvironment!=null){
    			conceptEnvironment.setCncpId(nextCncpId.intValue());
    			}
    			
    			concept.setCncpID(nextCncpId.intValue());
    			concept.setAeroConceptBudgets(aeroConceptBudgets);
    			concept.setConceptComments(conceptComments);
    			concept.setConceptEnvironment(conceptEnvironment);
    			
    			aeroConceptDao.saveNewConcept(concept);
    		}
    	}
    Here is my Persistence.xml

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence xmlns="http://java.sun.com/xml/ns/persistence"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
    	version="1.0">
    	
    	<persistence-unit name="aeroPunit" transaction-type="JTA">
    		<provider>org.hibernate.ejb.HibernatePersistence</provider>
    		<jta-data-source>java:jdbc/oracleDS</jta-data-source>
    	<class>gov.michigan.mdot.aeropm.airport.domain.AirportDetails</class>
        <class>gov.michigan.mdot.aeropm.proj.domain.AeroConceptHeader</class>
        <class>gov.michigan.mdot.aeropm.proj.domain.AeroConceptBudget</class>
        <class>gov.michigan.mdot.aeropm.proj.domain.ConceptComment</class>
        <class>gov.michigan.mdot.aeropm.proj.domain.ConceptEnvironment</class>
        <class>gov.michigan.mdot.aeropm.admin.domain.Lookup</class>
        <class>gov.michigan.mdot.aeropm.admin.domain.StatusByRole</class>
        <class>gov.michigan.mdot.aeropm.admin.domain.WorkCategory</class>
        <class>gov.michigan.mdot.aeropm.admin.domain.WorkTypeByJobType</class>
        
        
    		<properties>
    		<property name="hibernate.hbm2ddl.auto" value="validate" />
    			<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
    			<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
    			<property name="hibernate.hbm2ddl.auto" value="update" />
    			<property name="hibernate.show_sql" value="true" />
    			<property name="hibernate.format_sql" value="true" />
    			<property name="hibernate.default_schema" value="MAP" />
    			<property name="jboss.entity.manager.factory.jndi.name" value="jdbc/oracleDS" />
    			<property name="transactionManager" value="transactionManager" />
    		</properties>
    	</persistence-unit>
    </persistence>
    Here is the config from appln context file where i have included the entityManagerFactory and transactionManager.

    Code:
    <tx:annotation-driven transaction-manager="transactionManager"/>
    	
    	<bean id="entityManagerFactory"
    
    		class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    
    		<property name="persistenceUnitName" value="aeroPunit" />
    		
    
    	</bean>
    
    	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
    		<property name="entityManagerFactory" ref="entityManagerFactory" /> 
    	</bean>
    I have tried everything but it doesnt seem to be working.

    Note: Instead of @service for my service class i instead used the xmol declarion for all my dao's and service classes (as i came to know there is a bug where @Transactional and @Service doesnt work together).

    Please let me know what am i doing wrong here. Let me know if you need more info.

    Would really appreciate your help.
    Last edited by kuttie; Jul 14th, 2011, 08:35 AM.

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

    You are using JTA so use a JTATransactionManager instead of a JpaTransactionManager... I suggest a read of the tx chapter of the reference guide.

    Comment


    • #3
      I am sorry abt that. This is the first time i am posting on this forum. I fixed it now. I think i did try using jta transaction manager. The error in that case was something like "A JTA Entitymanager cannot use getTransaction() method". But let me try again.

      Comment


      • #4
        I changed the JpaTransactionManager to JTATransactionManager.
        Code:
        <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
        	 <property name="transactionManagerName" value="java:/TransactionManager"/>
        </bean>
        
        Now when i do the 
        getJpaTemplate().flush(); in the dao class i get this error
        
        org.springframework.dao.InvalidDataAccessApiUsageException: no transaction is in progress; nested exception is javax.persistence.TransactionRequiredException: no transaction is in progress
        I feel that @Transactional is not making any difference. Is there a other way to check if @Transactional is working or not ?

        Comment


        • #5
          For JTA you have to use a JTA transaction implementation. Spring's JTA Transactionmanager is "only" a relaying component between the transactionals aspects in your business service (via @Transactional or tx:advice) and a JTA transaction implementation, which does the "real" transactional communication with the resources e.g. a database.

          Which JTA transaction implementation you use depends on where you want to run your services. Opt a) is inside an Jee server, which comes with its own JTA transaction implementation. See your server documentation under which jndi name they expose their JTA transaction manager. Opt b) is you run outside a jee server, some call it "standalone mode". For that you have to choose a standalone JTA transaction manager, e.g. the open source projects Atomikos or Bitronix.

          JPATransactionManager is simpler - no extra JTA transaction manager implementation - but has the disadvantage afaik that you can handle only one resource per transaction manager.

          Comment


          • #6
            I am using my Services on the JBOSS 5.1 Server. And the location of the JTA transaction manager for JBOSS is java:/TransactionManager (which is what i have written in my appln context xml above).

            The thing i dont understand is when you say "You need to use JTA transaction Implementation. Spring JTA transaction manager is just a relaying component" what exact change do you want me to do in my config ? Do we need to have Spring JTA Transaction MAnager and a default JTA transaction manager ? Please bear with me as i am new to JTA.

            Could you point me which part of my config is wrong ?

            Comment


            • #7
              Can you post the full stacktrace, or check yourself if there is a TransactionAdvice/Interceptor in the stacktrace... If it isn't your transaction isn't applied.

              Do you use component scanning to detect your components if so make sure you aren't detecting your components twice!

              Comment


              • #8
                Hello Marten,

                I havent used any @Service or @Repository annotations on my service classes (due to this issue https://jira.springsource.org/browse/SPR-5082). I used

                @Transactional on Service Methods. I have configured the beans in the xml as shown below (did not include all the beans).

                I have just used the <context:annotation-config /> to autowire the entitymanagerfactory into my DAO classes. And also used <tx:annotation-driven

                transaction-manager="transactionManager"/>.

                Code:
                <?xml version="1.0" encoding="UTF-8" standalone="no"?>
                <beans xmlns="http://www.springframework.org/schema/beans"
                    xmlns:context="http://www.springframework.org/schema/context"
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                 
                xmlns:tx="http://www.springframework.org/schema/tx"
                    xsi:schemaLocation="http://www.springframework.org/schema/beans
                            http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                            http://www.springframework.org/schema/tx
                            http://www.springframework.org/schema/tx/spring-tx-3.0.xsd 
                            http://www.springframework.org/schema/context
                            http://www.springframework.org/schema/context/spring-context-3.0.xsd">
                 
                    <context:annotation-config />
                    <tx:annotation-driven transaction-manager="transactionManager"/>
                 
                    <bean id="conceptService" 
                 
                class="gov.michigan.mdot.aeropm.proj.service.impl.ConceptServiceImpl">
                        <property name="adminService"><ref bean="adminService"/></property>
                        <property name="airportDetailsService"><ref 
                 
                bean="airportDetailsService"/></property>
                        <property name="conceptValidationService"><ref 
                 
                bean="conceptValidationService"/></property>
                        <property name="aeroConceptDao"><ref bean="aeroConceptDAO"/></property>
                    </bean>
                <bean id="entityManagerFactory" 
                 
                class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
                        <property name="persistenceUnitName" value="aeroPunit" />
                    </bean>
                 
                    <bean id="transactionManager" 
                 
                class="org.springframework.transaction.jta.JtaTransactionManager">
                         <property name="transactionManagerName" value="java:/TransactionManager"/>
                    </bean>
                </beans>

                I donot see any exception stacktrace printed in the logs but when i debug to the point where i do jpaTemplate.flush() i see the following error

                Code:
                "org.springframework.dao.InvalidDataAccessApiUsageException: no transaction is in progress; nested exception is 
                 
                javax.persistence.TransactionRequiredException: no transaction is in progress".
                And regarding the TransactionInterceptor i see the following when the server starts (as expected). But I dont see it again while the service method gets hit (service method has the @Transactional annotation)

                Code:
                "2011-07-15 10:00:40,662 INFO  [org.springframework.beans.factory.support.DefaultListableBeanFactory] (main) Pre-instantiating singletons in 
                 
                org.springframework.beans.factory.support.DefaultListableBeanFactory@11bf9b: defining beans 
                 
                [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,
                 
                org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.sprin
                 
                gframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.
                 
                annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config
                 
                .internalTransactionAdvisor,conceptService,conceptValidationService,airportDetailsService,adminService,lookupService,workCategoryService,workTypeByJobTypeSer
                 
                vice,finSysByJobTypeService,finSysPercentService,aeroTransferDateService,aeroMeetingDateService,conceptRollOverService,statusByRoleService,codeLookUpService,
                 
                airportDetailsDAO,aeroConceptDAO,lookupDAO,workCategoryDAO,workTypeByJobTypeDAO,finSysByJobTypeDAO,finSysPercentDAO,aeroTransferDateDAO,aeroMeetingDateDAO,co
                 
                nceptRollOverDAO,statusByRoleDAO,entityManagerFactory,transactionManager]; root of factory hierarchy"
                And is the issue i pointed out (https://jira.springsource.org/browse/SPR-5082) still not fixed ?

                Comment


                • #9
                  I asked for the full stacktrace please post it (the one you get when calling flush). The fact that the interceptor is there doesn't mean it gets applied! Next to that have you tried with the LocalEntityManagerFactory instead of the LocalContainerEntityManagerFactory (the LocalContainer one is basically used when you want to configure the full EntityManagerFactory by spring but that doesn't really apply in your case).

                  Also you shouldn't be using JpaTemplate/JpaDaoSupport (for the same reason you shouldn't use HibernateTemplate/HibernateDaoSupport).

                  Regarding the issue you pointed to I never ran into that but that shouldn't really matter... And just to be sure you are using the service configured in your application context aren't you, you aren't creating a new one? Also JBoss is quite eager on parsing annotations (@PersistenceUnit/PersistenceContext etc) so it can be a bit of a pain to get it to work (if you use the standard JSR annotations the pain gets even worse).

                  Comment


                  • #10
                    I will get back to you with the complete stack trace on monday.And i did try with the LocalEntityManagerFactory but with no success.

                    And yes i am using the service configured in the appln context which is the conceptService bean in this case. And i will also try removing the jpaTemplate/JpaDaoSupport and use the entity manager directly. (Could you tell me what is the issue in using jpaTemplate/JpaDaoSupport ?)

                    I would also try attaching the service class , dao class and the complete appln context and persistence xml's on Monday.

                    Thanks for your time.
                    Last edited by kuttie; Jul 16th, 2011, 09:58 AM.

                    Comment


                    • #11
                      Well there is no issue but the fact is that it isn't recommended anymore (since about 2007) so why not go with the recommended solution which is basically a plain JPA based dao. If you use the EntityManager (and not the EntityManagerFactory) spring will inject a threadsafe one (it acts as a proxy for the current thread bound EntityManager). It is all explained in the reference guide.

                      Comment


                      • #12
                        I have removed the jpaDaoSupport and jpatemplate and using the entitymanager directly.
                        Here is the complete stack trace when i hit the flush().

                        Code:
                        10:23:57,031 ERROR [STDERR] javax.persistence.TransactionRequiredException: no transaction is in progress
                        10:23:57,031 ERROR [STDERR] 	at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:301)
                        10:23:57,031 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                        10:23:57,047 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                        10:23:57,047 ERROR [STDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                        10:23:57,047 ERROR [STDERR] 	at java.lang.reflect.Method.invoke(Method.java:597)
                        10:23:57,047 ERROR [STDERR] 	at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:365)
                        10:23:57,047 ERROR [STDERR] 	at $Proxy366.flush(Unknown Source)
                        10:23:57,078 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                        10:23:57,078 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                        10:23:57,078 ERROR [STDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                        10:23:57,078 ERROR [STDERR] 	at java.lang.reflect.Method.invoke(Method.java:597)
                        10:23:57,078 ERROR [STDERR] 	at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:240)
                        10:23:57,078 ERROR [STDERR] 	at $Proxy342.flush(Unknown Source)
                        10:23:57,078 ERROR [STDERR] 	at gov.michigan.mdot.aeropm.proj.dao.impl.JpaAeroConceptDAO.saveNewConcept(JpaAeroConceptDAO.java:60)
                        10:23:57,078 ERROR [STDERR] 	at gov.michigan.mdot.aeropm.proj.service.impl.ConceptServiceImpl.saveConcept(ConceptServiceImpl.java:427)
                        10:23:57,078 ERROR [STDERR] 	at gov.michigan.mdot.aeropm.proj.service.impl.ConceptServiceImpl.saveNewConcept(ConceptServiceImpl.java:289)
                        10:23:57,094 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                        10:23:57,094 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                        10:23:57,094 ERROR [STDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                        10:23:57,094 ERROR [STDERR] 	at java.lang.reflect.Method.invoke(Method.java:597)
                        10:23:57,094 ERROR [STDERR] 	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
                        10:23:57,094 ERROR [STDERR] 	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196)
                        10:23:57,094 ERROR [STDERR] 	at $Proxy343.saveNewConcept(Unknown Source)
                        10:23:57,094 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                        10:23:57,094 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                        10:23:57,094 ERROR [STDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                        10:23:57,094 ERROR [STDERR] 	at java.lang.reflect.Method.invoke(Method.java:597)
                        10:23:57,094 ERROR [STDERR] 	at flex.messaging.services.remoting.adapters.JavaAdapter.invoke(JavaAdapter.java:418)
                        10:23:57,094 ERROR [STDERR] 	at flex.messaging.services.RemotingService.serviceMessage(RemotingService.java:183)
                        10:23:57,094 ERROR [STDERR] 	at flex.messaging.MessageBroker.routeMessageToService(MessageBroker.java:1400)
                        10:23:57,094 ERROR [STDERR] 	at flex.messaging.endpoints.AbstractEndpoint.serviceMessage(AbstractEndpoint.java:1005)
                        10:23:57,109 ERROR [STDERR] 	at flex.messaging.endpoints.AbstractEndpoint$$FastClassByCGLIB$$1a3ef066.invoke(<generated>)
                        10:23:57,109 ERROR [STDERR] 	at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
                        10:23:57,109 ERROR [STDERR] 	at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)
                        10:23:57,109 ERROR [STDERR] 	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
                        10:23:57,109 ERROR [STDERR] 	at org.springframework.flex.core.MessageInterceptionAdvice.invoke(MessageInterceptionAdvice.java:66)
                        10:23:57,109 ERROR [STDERR] 	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
                        10:23:57,109 ERROR [STDERR] 	at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:124)
                        10:23:57,109 ERROR [STDERR] 	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
                        10:23:57,109 ERROR [STDERR] 	at org.springframework.aop.framework.Cglib2AopProxy$FixedChainStaticTargetInterceptor.intercept(Cglib2AopProxy.java:572)
                        10:23:57,125 ERROR [STDERR] 	at flex.messaging.endpoints.AMFEndpoint$$EnhancerByCGLIB$$e2545232.serviceMessage(<generated>)
                        10:23:57,125 ERROR [STDERR] 	at flex.messaging.endpoints.amf.MessageBrokerFilter.invoke(MessageBrokerFilter.java:103)
                        10:23:57,125 ERROR [STDERR] 	at flex.messaging.endpoints.amf.LegacyFilter.invoke(LegacyFilter.java:158)
                        10:23:57,125 ERROR [STDERR] 	at flex.messaging.endpoints.amf.SessionFilter.invoke(SessionFilter.java:44)
                        10:23:57,125 ERROR [STDERR] 	at flex.messaging.endpoints.amf.BatchProcessFilter.invoke(BatchProcessFilter.java:67)
                        10:23:57,125 ERROR [STDERR] 	at flex.messaging.endpoints.amf.SerializationFilter.invoke(SerializationFilter.java:166)
                        10:23:57,125 ERROR [STDERR] 	at flex.messaging.endpoints.BaseHTTPEndpoint.service(BaseHTTPEndpoint.java:291)
                        10:23:57,125 ERROR [STDERR] 	at flex.messaging.endpoints.AMFEndpoint$$EnhancerByCGLIB$$e2545232.service(<generated>)
                        10:23:57,125 ERROR [STDERR] 	at org.springframework.flex.servlet.MessageBrokerHandlerAdapter.handle(MessageBrokerHandlerAdapter.java:108)
                        10:23:57,125 ERROR [STDERR] 	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:774)
                        10:23:57,125 ERROR [STDERR] 	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
                        10:23:57,125 ERROR [STDERR] 	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
                        10:23:57,125 ERROR [STDERR] 	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
                        10:23:57,125 ERROR [STDERR] 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
                        10:23:57,125 ERROR [STDERR] 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
                        10:23:57,125 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                        10:23:57,140 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                        10:23:57,140 ERROR [STDERR] 	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                        10:23:57,140 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                        10:23:57,140 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                        10:23:57,140 ERROR [STDERR] 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
                        10:23:57,140 ERROR [STDERR] 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                        10:23:57,140 ERROR [STDERR] 	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:183)
                        10:23:57,140 ERROR [STDERR] 	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95)
                        10:23:57,140 ERROR [STDERR] 	at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
                        10:23:57,140 ERROR [STDERR] 	at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
                        10:23:57,140 ERROR [STDERR] 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                        10:23:57,140 ERROR [STDERR] 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                        10:23:57,140 ERROR [STDERR] 	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
                        10:23:57,140 ERROR [STDERR] 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                        10:23:57,140 ERROR [STDERR] 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
                        10:23:57,156 ERROR [STDERR] 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
                        10:23:57,156 ERROR [STDERR] 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
                        10:23:57,156 ERROR [STDERR] 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:451)
                        10:23:57,156 ERROR [STDERR] 	at java.lang.Thread.run(Thread.java:619)
                        And you asked me if my components are detected twice earlier. What i see on server startup is my Entity Classes(@Entity) are being detected twice (Not the beans defined in the application context though). Is this something i need to look into ?

                        I am attaching the 4 files (dao,service impl,appln Context xml, persistence xml). The mtnod in the service file i am looking into is saveConcept() which has a @Transactional annotation.
                        Last edited by kuttie; Jul 18th, 2011, 10:40 AM.

                        Comment


                        • #13
                          What I see in the stacktrace is no Transactional stuff, hence you will get no transactions applied... So you either are operating on a different instance of your service or your service is in another package then your tx advice.

                          The @Entities you see twice because (this is a bit of a guess) JBoss is also instantiating an EntityManager.

                          The mtnod in the service file i am looking into is saveConcept() which has a @Transactional annotation.
                          That isn't going to work, the method you call is the saveNewConcept method THAT should be the transactional method. I suggest a read on proxy based aop (as explained in the spring reference guide) which basically states that you cannot intercept INTERNAL method calls (those do not pass through the proxy).

                          I do not (yet) see any of the files you mention.
                          Last edited by Marten Deinum; Jul 18th, 2011, 10:49 AM.

                          Comment


                          • #14
                            What is the package for the tx advice ?

                            Comment


                            • #15
                              I am trying to figure out how to add attachments to this thread. Could you please tell me ?

                              Comment

                              Working...
                              X