Results 1 to 1 of 1
  1. #1
    Lars is offline Member
    Join Date
    Feb 2013
    Rep Power

    Default Conversation with SFSB

    In the past I implemented conversations using Servlets and manually adding / removing e.g. a Cart/Trolley object to the HttpSession object. Now I tried to implement it using JSF, Backing Bean and a Stateful EJB which is supposed to hold the data. However, that doesn work. The SFSB is created and destroyed for each request. It gives a "JBAS014101: Failed to find SFSB instance with session ID ... in cache" and later on a NPE.

    How is that possible? The Backing Bean is conversationScoped and the SFSB dependant since otherwise the @Remove-method couldn't be called.

    How would I implement a conversation using a SFSB? I attach the project code to this post (e.g. a "mvn clean install jboss-as:deploy" will deploy it to jboss)

    Backing Bean

    Java Code:
    public class BookingBean implements Serializable {
    	private static final long serialVersionUID = 4961548908512317407L;
    	@Inject Conversation conversation;
    	@Inject Trolley trolley;
    	List<TableData> tableDataList = null;
    	public void init() {
    		tableDataList = new ArrayList<TableData>();
    		tableDataList.add(new TableData("table","12345"));
    	public List<TableData> getTableData() {
    		return tableDataList;
    	public List<TableData> getTrolleyContent() {
    		List<TableData> retList = new ArrayList<TableData>();
    		for (Map.Entry<String, String> entry : trolley.getOrderMap().entrySet()) {
    			retList.add(new TableData(entry.getKey(), entry.getValue()));
    		return retList;
    	public String updateOrder(TableData tableData) {
    		if (conversation.isTransient()) {
    		return null;
    	public void cancel() {
    		if (!conversation.isTransient()) {
    	public String submit() {
    		if (!conversation.isTransient()) {
    		return null;
    Java Code:
    public class Trolley {
    	Map<String, String> orderMap = null;
    	public void initMap() {
    		orderMap = new HashMap<String, String>();
        public void cleanup(){"Trolley object destroyed");
    	public void updateTrolley(TableData tableData) {
    		orderMap.put(tableData.getName(), tableData.getNumber());
    	public Map<String, String> getOrderMap() {
    		return orderMap;
    	public void orderInfoMaterial() {"Submitting order");
    Attached Files Attached Files
    Last edited by Lars; 02-26-2013 at 03:24 PM. Reason: A lot of blank lines have been entered by default. Edited to remove them.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts