Here you are:
---
package de.axone.shop.context;
import java.util.Locale;
import javax.ejb.Local;
import de.axone.shop.client.Client;
import de.axone.shop.selector.SelectorQuery;
import de.axone.shop.shop.Shop;
import de.axone.shop.user.User;
@Local
public interface Context {
public void create();
public void destroy();
public Client getClient();
public Shop getShop();
public User getUser();
public Locale getLocale();
public SelectorQuery getSelectorQuery();
}
---
package de.axone.shop.context;
import java.util.Locale;
import javax.ejb.Remove;
import javax.ejb.Stateful;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.Destroy;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import de.axone.shop.client.Client;
import de.axone.shop.selector.SelectorQuery;
import de.axone.shop.selector.SelectorQueryImpl;
import de.axone.shop.shop.Shop;
import de.axone.shop.user.User;
@Stateful
@Scope(ScopeType.EVENT)
@Name("shopContext")
class ContextImpl implements Context {
public ContextImpl(){}
Client client;
Locale locale;
Shop shop;
User user;
@Create
public void create() {
}
@Destroy
@Remove
public void destroy() {
}
@Override
public Client getClient() {
return client;
}
@Override
public Shop getShop() {
return shop;
}
@Override
public User getUser() {
return user;
}
@Override
public Locale getLocale() {
return locale;
}
protected SelectorQueryImpl cachedSelectorQuery;
@Override
public SelectorQuery getSelectorQuery() {
if( cachedSelectorQuery == null ) {
cachedSelectorQuery = new SelectorQueryImpl();
if( client != null )
cachedSelectorQuery.setItem( "client",
client.getName() );
if( shop != null )
cachedSelectorQuery.setItem( "shop",
shop.getName() );
if( user != null )
cachedSelectorQuery.setItem( "user",
user.getName() );
if( user != null )
cachedSelectorQuery.setItem( "user.no",
user.getNo() );
if( locale != null )
cachedSelectorQuery.setItem( "language",
locale.getLanguage() );
if( locale != null )
cachedSelectorQuery.setItem( "country",
locale.getCountry()
.toUpperCase() );
}
return cachedSelectorQuery;
}
@Override
public String toString() {
return getSelectorQuery().toString();
}
}
---
And the complete stack trace:
12:02:23,750 WARN [org.jboss.seam.Component] Exception calling stateful
session bean default @Remove method: shopContext
java.lang.RuntimeException: exception invoking: destroy
at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:134)
at org.jboss.seam.Component.callComponentMethod(Component.java:1957)
at org.jboss.seam.Component.callDefaultRemoveMethod(Component.java:1868)
at org.jboss.seam.Component.destroy(Component.java:1227)
at org.jboss.seam.contexts.Contexts.destroy(Contexts.java:251)
at
org.jboss.seam.contexts.Contexts.flushAndDestroyContexts(Contexts.java:394)
at
org.jboss.seam.contexts.FacesLifecycle.endRequest(FacesLifecycle.java:83)
at
org.jboss.seam.jsf.SeamPhaseListener.afterRender(SeamPhaseListener.java:515)
at
org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:230)
at
org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:184)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:280)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:87)
at
org.jboss.seam.servlet.SeamFilter$Fi