facebook

[Closed] NoSuchBeanDefinitionException

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #260056 Reply

    mimi_grebici
    Member

    Hi

    I have the following exception when I want to start my application :

    org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘sessionFactory’ is defined
    org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:352)
    org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:671)
    org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
    org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:151)
    org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:559)
    org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.lookupSessionFactory(OpenSessionInViewFilter.java:223)
    org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.lookupSessionFactory(OpenSessionInViewFilter.java:207)
    org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:146)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

    But at the server start, I see that the context is created, the mapping objects and DAO objects are instanciated!!

    So I dont know why there is an exception about the sessionFactory?

    thanks

    Mimi

    #260062 Reply

    mimi_grebici
    Member

    I found the error !!!

    it was because of the sessionFilter that I used !!

    this was the sessionFilter configuration in web.xml :

    <filter>
            <filter-name>sessionFilter</filter-name>
            <filter-class>
                org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
            </filter-class>
             <init-param>
                <param-name>singleSession</param-name>
                <param-value>false</param-value>
            </init-param>
        </filter>
        <filter-mapping>
            <filter-name>sessionFilter</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>

    But I dont understand why this filter cause problem, so what is its role?

    Thank you

    #260151 Reply

    Haris Peco
    Member

    mimi_grebici,

    For description ‘Open session in View’ see http://www.hibernate.org/43.html
    Spring have own implementation ofr this pattern – check spring documentation

    Best
    Peco

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: [Closed] NoSuchBeanDefinitionException

You must be logged in to post in the forum log in