Ok, so I changed my web.xml to use the OpenEntityManagerInViewFilter and
restarted the Jetty server with 'mvn jetty:run-war'. The server appears to
start up fine with to exceptions, but when I access 'http://localhost:8080'
in my web browser, I get the following exception:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean
named 'entityManagerFactory' is defined
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:353)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:916)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:243)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at
org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:737)
at
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.lookupEntityManagerFactory(OpenEntityManagerInViewFilter.java:150)
at
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.lookupEntityManagerFactory(OpenEntityManagerInViewFilter.java:133)
at
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:92)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1041)
at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)
at
org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
at
org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
at
org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110)
at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
at
org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
at
org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:135)
at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
at
org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81)
at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
at
org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:217)
at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
Now I'm assuming that I need to define this bean in my
applicationContext.xml, but which class do I use for the entity manager
factory? I didn't find any good examples.
-Jeremiah
Michael Horwitz wrote:
>
> I believe if you are using JPA then the class for the filter should be:
> org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter
>
> There should be a comment to that effect in the web.xml file?
>
> Mike
>
>
> On 6/15/07, jeremiah.lopez <[EMAIL PROTECTED]> wrote:
>>
>>
>> Matt,
>>
>> Yes, I did try that by uncommenting the following segments in web.xml:
>>
>> <filter>
>> <filter-name>lazyLoadingFilter</filter-name>
>>
>> <filter-class>
>> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
>> </filter-class>
>> </filter>
>>
>> and
>>
>> <filter-mapping>
>> <filter-name>lazyLoadingFilter</filter-name>
>> <url-pattern>/*</url-pattern>
>> </filter-mapping>
>>
>> but it didn't seem to do anything. No exceptions; it just did what it
>> did
>> before. Is there something else I'm missing? I should also note that
>> I'm
>> using JPA in my POJOs for defining the relationships, so there isn't a
>> Hibernate mapping file. I do, however, have the mapped classes defined
>> in
>> my hibernate.cfg.xml.
>>
>> Thanks,
>> Jeremiah
>>
>>
>> mraible wrote:
>> >
>> > Have you tried uncommenting the OpenSessionInViewFilter in your
>> web.xml?
>> >
>> > Matt
>> >
>> > On 6/14/07, jeremiah.lopez <[EMAIL PROTECTED]> wrote:
>> >>
>> >> I am using Appfuse 2.0-M5 with Hibernate 3 and JSF. I have a simple
>> >> parent
>> >> child relationship implemented in my POJOs, Team --> Player. A team
>> can
>> >> have many players; a player can only be a member of one team. I have
>> >> design
>> >> the POJOs, unit tests, daos, and managers. All of the unit tests pass
>> >> successfully.
>> >>
>> >> assertTrue(team.getPlayers().size() > 0) passes during test execution.
>> >> This
>> >> test gets writes a Team object to the database and then reads it back
>> to
>> >> make sure everything was written correctly.
>> >>
>> >> The problem I'm having is when I try and inject these objects into a
>> JSF
>> >> page. If I have a table that wants to display the team and the number
>> of
>> >> players on that team, I get an exception because the players object is
>> >> null.
>> >> All of the other details about the team show up in the stack trace,
>> but
>> >> the
>> >> team.getPlayers() is null. So my question is why isn't this getting
>> >> loaded
>> >> in the context of the server, but runs just fine when running unit
>> tests?
>> >> Is there some additional configuration that needs to be done in
>> AppFuse
>> >> to
>> >> make this happen or for parent-child relationships using Hibernate?
>> >>
>> >> Thanks for your help.
>> >>
>> >> -Jeremiah
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Children-not-getting-loaded-on-Jetty-server-tf3924244s2369.html#a11128637
>> >> Sent from the AppFuse - User mailing list archive at Nabble.com.
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >>
>> >>
>> >
>> >
>> > --
>> > http://raibledesigns.com
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Children-not-getting-loaded-on-Jetty-server-tf3924244s2369.html#a11131309
>> Sent from the AppFuse - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/Children-not-getting-loaded-on-Jetty-server-tf3924244s2369.html#a11140674
Sent from the AppFuse - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]