[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-4178) Seam 2.1.1GA on Glassfish generates an exception depending on where the end-conversation is placed in a pages.xml

Arshad Mahmood (JIRA) jira-events at lists.jboss.org
Fri May 15 14:28:46 EDT 2009

    [ https://jira.jboss.org/jira/browse/JBSEAM-4178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12467855#action_12467855 ] 

Arshad Mahmood commented on JBSEAM-4178:

I have investigated this a bit further and it appears to be caused while calling the @Remove method of the Stateful session bean (the exceptions is as follows);

15 May 2009 19:19:30,232 WARN  Component      : Exception calling stateful session bean default @Remove method: org.jboss.seam.transaction.synchronizations
	at com.sun.ejb.containers.BaseContainer.mapBusinessInterfaceException(BaseContainer.java:1507)
	at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1421)
	at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1316)
	at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:205)
	at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:83)

The @Remove method is an empty method that does nothing and is there because of the requirement to have a @Remove method on all Stateful session beans.

I have had a looking at Naming.java in the seam code that actually gets the InitialContext and stores it as a static. This works OK and I can see that the same instance is being used for all lookups. I have printed out the contents of the InitialContext namespace java:comp/env and I can see that it has the EntityManager in it when it is first called but then as part of @Remove it is infact empty. This is bizarre!! (as I say the instance of the InitialContext is exactly the same because it is a static field held in Naming.java).

If I open new session on the webapp application the entity manager is retrieved OK again (from the **SAME** static instance). Obviously, there is some extra lookup going on inside the InitialContext that comes with Glassfish which doesn't work in @Remove methods or maybe they assumed nobody would be crazy enough to do lookups in that method but they didn't count on Seam Interceptors and EntityManager injection.

Any help with resolving this issue would be much appreciated as I am having to remove all conversations at the moment and make everything session level.

> Seam 2.1.1GA on Glassfish generates an exception depending on where the end-conversation is placed in a pages.xml
> -----------------------------------------------------------------------------------------------------------------
>                 Key: JBSEAM-4178
>                 URL: https://jira.jboss.org/jira/browse/JBSEAM-4178
>             Project: Seam
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.1.1.GA
>         Environment: JD 1.6 Seam 2.1.1.GA Glassfish 2.1
>            Reporter: Arshad Mahmood
> I have an application with an edit page named edit.xhtml, it has a form and submit buttion which executes the following action #{currencyAction.save}. The currencyAction is an EJB Stateful session bean. I am coming across a weird error when the action is execute:-
> If my pages.xml is as follows, everything works as expected (i.e. the bean is saved and I get redirected to the view page).
> 	<!-- page parameters -->
> 	<param name="currencyId" value="#{currencyAction.currencyId}" />	
> 	<!-- join the conversation -->
> 	<begin-conversation join="true" />
> 	<!-- action: persist -->
> 	<navigation from-action="#{currencyAction.save}">
> 		<end-conversation before-redirect="true" />		
> 		<rule if-outcome="persisted">			
> 			<redirect view-id="/settings/currencies/view.xhtml">
> 				<param name="currencyId" value="#{currencyAction.currencyId}" />
> 			</redirect>
> 		</rule>		
> 	</navigation>
> ** BUT **, if I change the end-conversation to be within the if-outcome then I get an exception. I.e. if the pages,xml is changed to
> 	<!-- action: persist -->
> 	<navigation from-action="#{currencyAction.save}">		
> 		<rule if-outcome="persisted">			
> 		    <end-conversation before-redirect="true" />    *** CHANGE HERE ****
> 			<redirect view-id="/settings/currencies/view.xhtml">
> 				<param name="currencyId" value="#{currencyAction.currencyId}" />
> 			</redirect>
> 		</rule>		
> 	</navigation>
> The exception is as follows:-
> [#|2009-05-15T10:08:58.045+0100|INFO|sun-appserver2.1|javax.enterprise.system.container.ejb|_ThreadID=24;_ThreadName=TP-Processor12;|
> javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: java.lang.IllegalArgumentException: EntityManagerFactory not found in JNDI : java:comp/env/smartkidsBSEMF
> java.lang.IllegalArgumentException: EntityManagerFactory not found in JNDI : java:comp/env/smartkidsBSEMF
> 	at org.jboss.seam.persistence.ManagedPersistenceContext.getEntityManagerFactoryFromJndiOrValueBinding(ManagedPersistenceContext.java:245)
> 	at org.jboss.seam.persistence.ManagedPersistenceContext.initEntityManager(ManagedPersistenceContext.java:78)
> 	at org.jboss.seam.persistence.ManagedPersistenceContext.getEntityManager(ManagedPersistenceContext.java:107)
> 	at sun.reflect.GeneratedMethodAccessor423.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> The bean values are persisted to the database, but then this exception is raised.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the seam-issues mailing list