Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Every time a new instance is created for a SFSB on jboss 5.1

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using jboss 5.1 and have written a SFSB - BillItemsListFacadBean which i am trying to invoke from a SLSB - BillFacadBean. The basic purpose of this SFSB is to store list of billitems that were selected as part of generating a document .No database calls involved in the SFSB. It has got 2 simple methods updateDeliveryMemoSelectionList and fetchDeliveryMemoSelectionList .updateDeliveryMemoSelectionList updates the instance variable arrCummulativeDMSelectionList , which is a list and fetchDeliveryMemoSelectionList returns this to the calling program. I am using the below code in a struts action class to update the instance variable of the SFSB

BillItemsListFacadBeanInterface billItemsListFacadBean = null;
billItemsListFacadBean = (BillItemsListFacadBeanInterface) new InitialContext().lookup("inticraftEAR/BillItemsListFacadBean/local");
}catch(NamingException name){
throw new ECSystemException(name.getMessage(),BillCreationAction.class.getName(),METHOD_NAME);
ArrayList<String> arrCheckedItems = new ArrayList<String>();
StringTokenizer billitemString = new StringTokenizer(request.getParameter("dmCheckBoxSelectionList_Hidden"),",");
String billitem_id = billitemString.nextToken();
ArrayList<String> arrUnCheckedItems = new ArrayList<String>();
StringTokenizer billitemString2 = new StringTokenizer(request.getParameter("dmCheckBoxUnSelectionList_Hidden"),",");
String billitem_id = billitemString2.nextToken();
billItemsListFacadBean.updateDeliveryMemoSelectionList(arrCheckedItems, arrUnCheckedItems);

After this now when i try to access this variable in BillFacadBean(SLSB) using the below code the value of the instance variable(arrCummulativeDMSelectionList) of the SFSB is null and hence the method
fetchDeliveryMemoSelectionList returns an empty arraylist.

BillItemsListFacadBeanInterface billItemsListFacadBean = null;
billItemsListFacadBean = (BillItemsListFacadBeanInterface) new InitialContext().lookup("inticraftEAR/BillItemsListFacadBean/local");
}catch(NamingException name){
throw new ECSystemException(name.getMessage(),BillFacadBean.class.getName(),METHOD_NAME);
if(null != billItemsListFacadBean){
arrSelectedBillItems = billItemsListFacadBean.fetchDeliveryMemoSelectionList();

Code of SFSB BillItemsListFacadBean is as below:

package com.inticraft.facad;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.ejb.PostActivate;
import javax.ejb.PrePassivate;
import javax.ejb.Remove;
import javax.ejb.Stateful;
import javax.interceptor.Interceptors;

import com.inticraft.ejbutil.CommitAndCloseInterceptor;
import com.inticraft.ejbutil.LoggingInterceptor;
import com.inticraft.exceptions.ECException;

* Session Bean implementation class BillItemsListFacadBean
public class BillItemsListFacadBean implements BillItemsListFacadBeanInterface {
private List <String> arrCummulativeDMSelectionList;
private String first_element;
* Default constructor.
public BillItemsListFacadBean() {
// TODO Auto-generated constructor stub

public void openConnection(){


public void cleanup() {


public void closeDM() throws ECException{
arrCummulativeDMSelectionList = null;

public void updateDeliveryMemoSelectionList(ArrayList<String> arrSelectedItems , ArrayList<String>arrUnSelectedItems) throws ECException {
arrCummulativeDMSelectionList = new ArrayList<String>();
//Step1 iterate through the unselecteditems and remove from the cummulative list if any entry matches
Iterator <String>it1 = arrUnSelectedItems.iterator();
String unSelectedItem = (String);
Iterator <String>it2 = arrSelectedItems.iterator();
String selectedItem = (String);
first_element = selectedItem;

public ArrayList<String> fetchDeliveryMemoSelectionList() throws ECException {
if(null == arrCummulativeDMSelectionList){
return new ArrayList();
return new ArrayList(arrCummulativeDMSelectionList);



I am not understaning , why is this variable value null always ie the STATE IS NOT BEING MAINTAINED. Also another thing that i observed was in the jobss jmx console , every time this SFSB was accessed the count got incrmented by 1 , which is making me think , every time this bean is called a new instance of the bean is created , instead of returning the already created instance. I am going nuts over this . any help is greatly appreciated. Thanks a ton in advance and also please let me know if you would need any other information.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic