[seam-issues] [JBoss JIRA] Issue Comment Edited: (SEAMPERSIST-53) Injected EntityManager can not be invoked in java se

Mark Bell (JIRA) jira-events at lists.jboss.org
Sun Jun 19 15:40:23 EDT 2011


    [ https://issues.jboss.org/browse/SEAMPERSIST-53?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12609617#comment-12609617 ] 

Mark Bell edited comment on SEAMPERSIST-53 at 6/19/11 3:39 PM:
---------------------------------------------------------------

This also appears to be a problem when running in Tomcat 7.0.12 with Weld 1.1.1 with fireRequestListenersOnForwards enabled in tomcat.

During a logout procedure like this:

public String logout() {
	identity.logout();	
	FacesContext.getCurrentInstance().getExternalContext().invalidateSession();		
	return "logout";
}

There is a corresponding navigation rule in face-config.xml to respond to the this call.  This can also be triggered by a session timeout.

The same exception as reported in this bug always appears in the logs with a slightly different root cause (so this may be a separate bug), it appears that when you have a SessionScoped PersistanceContext and invalidate the Session the Session gets destroyed before seam-persistence cleans up so when it trys to join the transaction the scope has closed and the transaction is gone.  At least that what I get out of it.

Removing the @RequestScoped annotation from EntityTransaction resolved the issue with no side effects thus far.

      was (Author: mbell697):
    This also appears to be a problem when running in Tomcat 7.0.12 with Weld 1.1.1 with fireRequestListenersOnForwards enabled in tomcat.

During a logout procedure like this:

public String logout() {
	identity.logout();	
	FacesContext.getCurrentInstance().getExternalContext().invalidateSession();		
	return "logout";
}

There is a corresponding navigation rule in face-config.xml to respond to the this call.

The same exception always appears in the logs, removing the @RequestScoped annotation from EntityTransaction resolved the issue with no side effects thus far.
  
> Injected EntityManager can not be invoked in java se 
> -----------------------------------------------------
>
>                 Key: SEAMPERSIST-53
>                 URL: https://issues.jboss.org/browse/SEAMPERSIST-53
>             Project: Seam Persistence
>          Issue Type: Bug
>    Affects Versions: 3.0.0.Final
>         Environment: weld-se-1.1.1,seam-persistence 3.0.0 and 3.0.1-SNAPSHOT
>            Reporter: Liu Jianhong
>
> When call entityManager.toString(), entityManager.persist() addn so on ,it produces WELD-001303 error:
> Exception in thread "main" org.jboss.weld.context.ContextNotActiveException: WELD-001303 No active contexts for scope type javax.enterprise.context.RequestScoped
> 	at org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:664)
> 	at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:77)
> 	at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:87)
> 	at org.jboss.seam.transaction.org$jboss$weld$bean-classpath-ManagedBean-org$jboss$seam$transaction$EntityTransaction$@javax$enterprise$context$RequestScoped()@org$jboss$seam$config$xml$core$XmlConfiguredBean()@org$jboss$seam$transaction$DefaultTransaction()${org$jboss$seam$transaction$EntityTransaction$entityManager$@javax$inject$Inject()$$org$jboss$seam$transaction$EntityTransaction$persistenceProvider$@javax$inject$Inject()$$org$jboss$seam$transaction$EntityTransaction$init$@javax$inject$Inject()$(org$jboss$seam$transaction$Synchronizations)$}_$$_WeldClientProxy.isActive(org$jboss$weld$bean-classpath-ManagedBean-org$jboss$seam$transaction$EntityTransaction$@javax$enterprise$context$RequestScoped()@org$jboss$seam$config$xml$core$XmlConfiguredBean()@org$jboss$seam$transaction$DefaultTransaction()${org$jboss$seam$transaction$EntityTransaction$entityManager$@javax$inject$Inject()$$org$jboss$seam$transaction$EntityTransaction$persistenceProvider$@javax$inject$Inject()$$org$jboss$seam$transaction$EntityTransaction$init$@javax$inject$Inject()$(org$jboss$seam$transaction$Synchronizations)$}_$$_WeldClientProxy.java)
> 	at org.jboss.seam.persistence.ManagedPersistenceContextProxyHandler.joinTransaction(ManagedPersistenceContextProxyHandler.java:126)
> 	at org.jboss.seam.persistence.ManagedPersistenceContextProxyHandler.invoke(ManagedPersistenceContextProxyHandler.java:114)
> 	at $Proxy36.toString(Unknown Source)
> 	at java.lang.String.valueOf(String.java:2826)
> 	at java.io.PrintStream.println(PrintStream.java:771)
> 	at test.UserFacet.save(UserFacet.java:27)
> 	at test.Main.main(Main.java:17)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the seam-issues mailing list