Announcement Announcement Module
Collapse
No announcement yet.
spring webflow: No value for key [org.hibernate.impl.SessionFactoryImpl...] Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • spring webflow: No value for key [org.hibernate.impl.SessionFactoryImpl...]

    Hi i am getting no session factory defined..When i enter a non webflow page it works correctly. Here are my settings...

    my ticketReservation.xml is like this .

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <flow xmlns="http://www.springframework.org/schema/webflow"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.springframework.org/schema/webflow
                              http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">
    	    <persistence-context/>
    <!-- some flows --> 
    <var name="ticketPurchaseCommand" class="com.ticket.command.TicketPurchaseCommand"/>
    </flow>
    web.xml
    Code:
     <filter>
      <filter-name>myTicket.sessionInView</filter-name>
      <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
      <init-param>
       <param-name>sessionFactoryBeanName</param-name>
       <param-value>myTickets.sessionFactory</param-value>
      </init-param>
     </filter>
    
    <filter-mapping>
    	  <filter-name>myTicket.sessionInView</filter-name>
               <url-pattern>/*</url-pattern>
    </filter-mapping>
    my applicationContext-persistence.xml
    Code:
    	<bean id="myTicket.transactionManager"
    class="org.springframework.orm.hibernate3.HibernateTransactionManager"
    		autowire="byType" />
    
    	<tx:annotation-driven transaction-manager="myTicket.transactionManager" order="1" />
    
    <!-- session factory -->
    	<bean id="myTicket.sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="configLocations" value="classpath*:hibernate.cfg.xml" />
    		<property name="hibernateProperties">
    			<props>
    				<prop key="hibernate.dialect">${hibernate.dialect}</prop>
    				<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
    				<prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
    				<prop key="hibernate.use_outer_join">${hibernate.use_outer_join}</prop>
    				<prop key="hibernate.connection.pool_size">${hibernate.connection.pool_size}</prop>
    				<prop key="hibernate.cache.region.factory_class">${hibernate.cache.region.factory_class}</prop>
    				<prop key="hibernate.cache.use_query_cache">${hibernate.cache.use_query_cache}</prop>
    				<prop key="hibernate.cache.use_second_level_cache">${hibernate.cache.use_second_level_cache}</prop>
    				<prop key="hibernate.default_batch_fetch_size">${hibernate.default_batch_fetch_size}</prop> 
    				<prop key="hibernate.cache.region.factory_class">org.hibernate.cache.infinispan.InfinispanRegionFactory</prop>
                    <prop key="hibernate.transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</prop>
                    <prop key="hibernate.cache.infinispan.statistics">true</prop>
    				<prop key="hibernate.cache.infinispan.entity.eviction.strategy">LRU</prop>
    				<prop key="hibernate.cache.infinispan.entity.eviction.wake_up_interval">2000</prop>
    				<prop key="hibernate.cache.infinispan.entity.eviction.max_entries">5000</prop>
    				<prop key="hibernate.cache.infinispan.entity.expiration.lifespan">60000</prop>
    				<prop key="hibernate.cache.infinispan.entity.expiration.max_idle">30000</prop>	
    				<prop key="hibernate.cache.infinispan.cfg">infini-min.xml</prop>	
    			</props>
    		</property>
    		<property name="dataSource" ref="myTicket.dataSource" />
    	</bean>
    my spring webflow.xml
    [code]

    my webflow.xml
    Code:
      <flow:flow-executor id="flowExecutor" flow-registry="flowRegistry">
          <flow:flow-execution-listeners>
              <flow:listener ref="securityFlowExecutionListener"/>
              <flow:listener ref="hibernateFlowExecutionListener"/>
          </flow:flow-execution-listeners>
          <flow:flow-execution-repository max-executions="20"/>
      </flow:flow-executor>
    
    <!-- some more stuff -->
      <bean id="hibernateFlowExecutionListener"
    class="org.springframework.webflow.persistence.HibernateFlowExecutionListener">
      	<constructor-arg index="0" ref="myTicket.sessionFactory"/>
      	<constructor-arg index="1" ref="myTicket.transactionManager"/>
      </bean>
    here is my error
    Code:
    java.lang.IllegalStateException: No value for key [org.hibernate.impl.SessionFactoryImpl@2004916b] bound to thread ....
            at org.springframework.transaction.support.TransactionSynchronizationMan
    ager.unbindResource(TransactionSynchronizationManager.java:199)
            at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.do
    FilterInternal(OpenSessionInViewFilter.java:206)
    thanks, what could be wrong?

  • #2
    Also i have a static class utility class that calls service...

    Code:
    public final class TicketUtility {
    
         private TicketUtility () {}
    
         static {
                context = new ClassPathXmlApplicationContext(
                    new String[] { // list of context file. 
                    });
         }
    
        static TicketService getTicketService() {
            TicketrService ticketService = null;
            if (context.getBean("ticketService") instanceof TicketService)
                ticketService = TicketService.class.cast(context.getBean("ticketService"));
            return ticketService;
        }
        
        // more get other service. 
    
        //... more read and write code where its calling ticket service read and write method. 
      // ticket service itself is annotated with @Transactional and etc but not TicketUtility
    }

    Comment


    • #3
      Hallo,
      is this problem solved? I have the same.
      Regards,
      Marc Gorzala

      Comment


      • #4
        The same problem, not solved

        Originally posted by marc.gorzala View Post
        Hallo,
        is this problem solved? I have the same.
        Regards,
        Marc Gorzala
        The same problem we have.
        Not solved. Version 3.1.2.

        Comment

        Working...
        X