CMP - failed to retrieve data from database - but NO excepti
normanfung Oct 21, 2004 10:58 AMCMP - failed to retrieve data from database - but NO exception..
Hi, I've developed this simple CMP to retrieve user Group information from database. It failed to retrieve data from database but no exception is thrown (Yes, I stepped through the code, nothing happenned). And now I'm kind of stuck without any error message to start debuggin with. So, I'm just asking for general advice/direction...
1. CLIENT side
Here's the Strut's action class ** ie. the CLIENT ** (yes, that's where they retrieve local proxy to CMP directly, as opposed to doing it thru a session bean):
try {
...
...
BasicConfigurator.configure();
logger.debug("PrepareLoginAction invoked");
context = new InitialContext();
Object ref = context.lookup(groupJNDI);
home = (GroupLocalHome)PortableRemoteObject.narrow(ref, GroupLocalHome.class);
******** THAT's MY CMP local proxy: GroupLocal, Nothing is retrieved here by NO EXCEPTION ********
groups=home.findAllGroups();
...
return mapping.findForward("success");
...
} catch(Exception e) {
***** NO EXCEPTION CAUGHT *****
}
2. The CMP GroupBean:
/**
* @author norman_lm_fung@hotmail.com
*
* @ejb.bean
* name="GroupEJB"
* local-jndi-name="ejb/UserGroup"
* display-name="User Group EJB"
* description="User Group EJB"
* cmp-version="2.x"
* type="CMP"
* view-type="local"
* schema="Group"
* reentrant="false"
* primkey-field="UIN"
*
* @ejb.persistence
* table-name="GROUPS"
*
* @ejb.finder
* query="SELECT OBJECT(g) FROM Group AS g"
* signature="java.util.Collection findAllGroups()"
*
* @ejb.interface
* local-class="com.aa.samples.interfaces.GroupLocal"
*
* @ejb.home
* local-class="com.aa.samples.interfaces.GroupLocalHome"
*
* @jboss.persistence
* datasource="java:/jdbc/dev01"
* datasource-mapping="mySQL"
* create-table="False"
* remove-table="False"
* table-name="GROUPS"
*
*/
public abstract class GroupBean implements EntityBean {
protected EntityContext etx;
protected Logger logger =Logger.getLogger(GroupBean.class);
/*
* 1. Implementing Home interface
*/
/**
* @param name
* @ejb.create-method
*/
public Integer ejbCreate(String name, String description) throws CreateException {
BasicConfigurator.configure();
logger.debug("GroupBean.ejbCreate invoked.");
if(name==null) {
throw new CreateException("name null");
}
setName(name);
setDescription(description);
return null;
}
public void ejbPostCreate(String name, String description) throws CreateException {
BasicConfigurator.configure();
logger.debug("GroupBean.ejbPostCreate invoked.");
return;
}
/*
* 2. Persistence methods:
*/
/**
* @ejb.persistent-field
* @ejb.persistence
* column-name="UIN"
* sql-type="INTEGER"
* @ejb.pk-field
* @ejb.interface-method
*/
public abstract Integer getUIN();
/**
* @ejb.interface-method
*/
public abstract void setUIN(Integer UIN);
/**
* @ejb.persistent-field
* @ejb.persistence
* column-name="name"
* sql-type="VARCHAR"
* @ejb.interface-method
*/
public abstract String getName();
/**
* @ejb.interface-method
*/
public abstract void setName(String name);
/**
* @ejb.persistent-field
* @ejb.persistence
* column-name="description"
* sql-type="VARCHAR"
* @ejb.interface-method
*/
public abstract String getDescription();
/**
* @ejb.interface-method
*/
public abstract void setDescription(String description);
/**
* @ejb.persistent-field
* @ejb.persistence
* column-name="isSuspended"
* sql-type="TINYINT"
* @ejb.interface-method
*/
public abstract Boolean getIsSuspended();
/**
* @ejb.interface-method
*/
public abstract void setIsSuspended(Boolean isSuspended);
/*
* 3. Implementing EntityBean interface:
*/
public void ejbRemove() throws RemoveException {
BasicConfigurator.configure();
logger.debug("GroupBean.ejbRemove invoked.");
return;
}
public void ejbLoad() {
BasicConfigurator.configure();
logger.debug("GroupBean.ejbLoad invoked.");
return;
}
public void ejbStore() {
BasicConfigurator.configure();
logger.debug("GroupBean.ejbStore invoked.");
return;
}
public void ejbActivate() {
BasicConfigurator.configure();
logger.debug("GroupBean.ejbActivate invoked.");
return;
}
public void ejbPassivate() {
BasicConfigurator.configure();
logger.debug("GroupBean.ejbPassivate invoked.");
return;
}
public void unsetEntityContext() {
BasicConfigurator.configure();
logger.debug("GroupBean.unsetEntityContext invoked.");
etx= null;
return;
}
public void setEntityContext(EntityContext etx) {
BasicConfigurator.configure();
logger.debug("GroupBean.setEntityContext invoked.");
this.etx= etx;
return;
}
}
Any idea? Thanks in advance!