]
Michael Youngstrom commented on JBSEAM-1636:
--------------------------------------------
Ok, I think I figured out the infinite loop. Your Session @Create is being called before
the session is actually finished creating. The DelegatingVariableResolver then checks the
faces variables first before checking spring which creates a new session and then calls
your @Create again.
Seam itself should probably be doing something to help inhibit infinite loop Session
scoped @Create calls.
For the time being though all we need to do is get the spring variable resolver to check
spring before it checks JSF. Perhaps my SpringELResovler does this? Try replacing the
DelegatingVariableResolver in faces-config with:
<el-resolver>org.jboss.seam.ioc.spring.SpringELResolver</el-resolver>
Maybe JSF will resolve my ELResolver before the Session resolver.
Cannot inject Spring-bound HibernateSessionFactory to Seam-managed
Hibernate Session
------------------------------------------------------------------------------------
Key: JBSEAM-1636
URL:
http://jira.jboss.com/jira/browse/JBSEAM-1636
Project: JBoss Seam
Issue Type: Bug
Components: Spring
Environment: Tomcat 6.0.13, Spring 2.0.6, Seam CVS 08072007
Reporter: Przemyslaw Jaskierski
Assigned To: Michael Youngstrom
Priority: Minor
Attachments: seamComponentNamespaceStackTrace.txt.zip,
springELResolverStackTrace.txt.zip, springStartedFromSeam.txt.zip
Filling this PR as requested by Mike.
For a full story please read related topic. As you requested I tried to reproduce
environment from my previous unsuccessful attempts. It's a little bit frustrating but
after assembling it once again now Spring EL resolver seams to working somewhat in some
aspects. But let's try to report step by step.
1. Spring-EL approach: Spring-bound session factory, referenced in components, Spring EL
resolver put into faces-config. There are two cases:
1.a. I have Seam-session-scoped bean that in @Create tries to get Hibernate session and
retrieve some information from RDBMS. I have abstracted Seam-managed-hibernate-session
access, and this additional layer simply invokes
Component.instance(NAME_OF_SEAM_MANAGED_HIBERNATE_SESSION_COMPONENT_DECLARED_IN_COMPONENTSXML)
instead of relying in @In. This layer is completely pluggable and allows to select
HibernateSession manager (Seam, Spring OSIV, custom one for Test) and inject it into data
access layer.
Ok, so this @Create call renders a bunch of extremely huge stacktreace (WORKED in
Microncontainer/Seam 1.3 combo flawlessly). You can see these stracktraces in
springELResolverStackTrace.txt.zip file.
1.b. Every following HibernateSession access seams to WORK now (I swear It didn't
:(). Strange... Anyway I cannot use it because of 1.a.
1.1 components.xml
<persistence:managed-hibernate-session
name="seamManagedHibernateSession" auto-create="true"
session-factory="#{hibernateSessionFactory}"/>
<transaction:hibernate-transaction
session="#{seamManagedHibernateSession}"/>
2. Spring namespace approach: Spring-bound session factory, referenced in components.xml,
<seam:component> added to Factory definition in application context:
<bean id="pecpHibernateSessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"
scope="prototype">
<seam:component class="org.hibernate.impl.SessionFactoryImpl"/>
<property name="dataSource" ref="dataSource" />
<property name="configLocation"
value="classpath:conf/hibernate/hibernate.cfg.xml" />
<property name="configurationClass"
value="org.hibernate.cfg.AnnotationConfiguration"/>
<property name="namingStrategy">
<bean
class="egd.persistence.hibernate.extensions.UnderscoreAwareNamingStrategy"/>
</property>
</bean>
Spring listener put AFTER Seam listener in web.xml. App contexts configured from Spring
listener. Result: java.lang.IllegalStateException: No active application scope. See
seamComponentNamespaceStackTrace.txt.zip.
2.1. components.xml like in 1.1.
3. <spring:context-loader> approach. Everything like in point 2., but Spring
listener removed from web.xml.
Result: "Seam cannot wrap JDK proxied IoC beans. Please use CGLib or Javassist
proxying instead" - stracktrace in
springStartedFromSeam.txt.zip
3.1. components.xml
<core:init transaction-management-enabled="true"
debug="true"/>
<core:manager conversation-timeout="120000"
concurrent-request-timeout="500"
conversation-id-parameter="k"/>
<spring:context-loader config-locations="classpath:conf/spring/core.xml,
classpath:conf/spring/persistence-common.xml,
classpath:conf/spring/persistence-hibernate.xml,
classpath:conf/spring/statistics.xml"/>
<persistence:managed-hibernate-session
name="seamManagedHibernateSession" auto-create="true"
session-factory="#{hibernateSessionFactory}"/>
<transaction:hibernate-transaction
session="#{seamManagedHibernateSession}"/>
That's all info I can get about this. Having a model example of such integration that
I was struggling with would be a quite nice POC.
Now I need to get back to code, because I lost a lot of time lately :). Will happy live
with my current workaround for a while :).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: