[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-1108) Loosen restrictions around @PersistenceContext
by Michael Youngstrom (JIRA)
Loosen restrictions around @PersistenceContext
----------------------------------------------
Key: JBSEAM-1108
URL: http://jira.jboss.com/jira/browse/JBSEAM-1108
Project: JBoss Seam
Issue Type: Bug
Affects Versions: 1.2.0.GA
Reporter: Michael Youngstrom
Fix For: 1.3.0.BETA1
Spring can utilize the @PersistenceContext annotation in a bean to auto inject an EntityManager. However, if you create a Spring bean with @PersistenceContext on one of its fields and make it a Seam component Seam assumes that's invalid and throws an exception. It would be nice if Seam could loosen validation of the @PersistenceContext to better accommodate unconventional uses.
Caused by:
java.lang.IllegalArgumentException: @PersistenceContext may only be used on session bean or message driven bean components: userService
at org.jboss.seam.Component.initMembers(Component.java:663)
at org.jboss.seam.Component.<init>(Component.java:253)
at org.jboss.seam.Component.<init>(Component.java:203)
at org.jboss.seam.ioc.IoCComponent.<init>(IoCComponent.java:56)
at org.jboss.seam.ioc.spring.SpringComponent.<init>(SpringComponent.java:152)
at org.jboss.seam.ioc.spring.SpringComponent.addSpringComponent(SpringComponent.java:82)
at org.jboss.seam.ioc.spring.SeamNamespaceHandler$SeamComponentBeanDefinitionDecorator.decorate(SeamNamespaceHandler.java:186)
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.decorate(NamespaceHandlerSupport.java:106)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.decorateIfRequired(BeanDefinitionParserDelegate.java:1142)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.decorateBeanDefinitionIfRequired(BeanDefinitionParserDelegate.java:1132)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.processBeanDefinition(DefaultBeanDefinitionDocumentReader.java:237)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:151)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:130)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:90)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:458)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:353)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:280)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:131)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:147)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:100)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:298)
at org.jboss.seam.ioc.spring.ContextLoader.startupContextLoader(ContextLoader.java:59)
at org.jboss.seam.ioc.spring.ContextLoader.create(ContextLoader.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:123)
at org.jboss.seam.Component.callComponentMethod(Component.java:1834)
at org.jboss.seam.Component.callCreateMethod(Component.java:1757)
at org.jboss.seam.Component.newInstance(Component.java:1746)
at org.jboss.seam.contexts.Lifecycle.startup(Lifecycle.java:175)
at org.jboss.seam.contexts.Lifecycle.endInitialization(Lifecycle.java:145)
at org.jboss.seam.init.Initialization.init(Initialization.java:504)
at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:33)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 7 months
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-1076) @Synchronized does not work for any Spring managed Seam components
by Michael Youngstrom (JIRA)
@Synchronized does not work for any Spring managed Seam components
------------------------------------------------------------------
Key: JBSEAM-1076
URL: http://jira.jboss.com/jira/browse/JBSEAM-1076
Project: JBoss Seam
Issue Type: Bug
Components: Spring
Affects Versions: 1.2.0.GA
Reporter: Michael Youngstrom
Fix For: 1.2.1.GA
@Synchronized cannot be used with any spring managed seam components created using <seam:component/>. The reason is if spring is managing the scope of the seam component (singleton, prototype, custom) then the spring integration will make the Component scope STATELESS so that seam will defer to spring everytime it requests an instance of the object.
There is a check in the component constructor that @Synchronized cannot be used with STATELESS components. It would be nice if this check could be removed to better support non standard use of the STATELESS scope like the Spring integration and perhaps the microcontainer integration.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 7 months