Click to See Complete Forum and Search --> : CMP - failed to retrieve data from database - but NO exception..


THY02K
October 21st, 2004, 11:05 AM
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;
}

}

This may help...

23:15:41,553 INFO [RequestProcessor] Processing a 'POST' for path '/prepareLoginAction'
23:15:48,368 INFO [STDOUT] 461330 [http-0.0.0.0-8080-Processor25] DEBUG com.aa.samples.actions.PrepareLoginAction - PrepareLoginAction invoked
ERROR: invalid console appender config detected, console stream is looping23:15:53,559 INFO [STDOUT] 466521 [http-0.0.0.0-8080-Processor25] DEBUG com.aa.samples.beans.GroupBean - GroupBean.setEntityContext invoked.
23:15:53,561 INFO [STDOUT] 466521 [http-0.0.0.0-8080-Processor25] DEBUG com.aa.samples.beans.GroupBean - GroupBean.setEntityContext invoked.
23:15:53,566 INFO [STDOUT] 466528 [http-0.0.0.0-8080-Processor25] DEBUG org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.GroupEJB#findAllGroups - Executing SQL: SELECT t0_g.UIN FROM GROUPEJB t0_g
23:15:53,568 INFO [STDOUT] 466528 [http-0.0.0.0-8080-Processor25] DEBUG org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.GroupEJB#findAllGroups - Executing SQL: SELECT t0_g.UIN FROM GROUPEJB t0_g

... nothing related to JDBC/exceptions...

Any idea? Thanks in advance!

cjard
October 22nd, 2004, 08:28 PM
if youre certain that no sql exceptions are arising, then you can try your app on another pc..?