CMP : finder : id null
kryptontri Dec 1, 2001 8:32 PMProblem:
I have an ejb - AccountEJB deployed - all methods work fine apart from a findByUserName. I have searched the forum and cannot find any similar problems.
StackTrace:
[AccountEJB] TRANSACTION ROLLBACK EXCEPTION:null
Embedded Exception
null; nested exception is:
javax.ejb.EJBException: null
Embedded Exception
null
[AccountEJB] java.lang.NullPointerException
[AccountEJB] at org.jboss.ejb.plugins.jrmp13.server.JRMPContainerInvoker.getEntityCollection(JRMPContainerInv
oker.java:132)
[AccountEJB] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.getEntityCollection(JRMPContainerInvok
er.java:353)
[AccountEJB] at org.jboss.ejb.EntityContainer.find(EntityContainer.java:570)
[AccountEJB] at java.lang.reflect.Method.invoke(Native Method)
[AccountEJB] at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:843)
[AccountEJB] at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterc
eptor.java:231)
[AccountEJB] at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:154
)
[AccountEJB] at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:108)
[AccountEJB] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:135)
[AccountEJB] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:307)
[AccountEJB] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:86)
[AccountEJB] at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:103)
[AccountEJB] at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:106)
[AccountEJB] at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:420)
[AccountEJB] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContainerInvoker.java:3
72)
[AccountEJB] at java.lang.reflect.Method.invoke(Native Method)
[AccountEJB] at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
[AccountEJB] at sun.rmi.transport.Transport$1.run(Unknown Source)
[AccountEJB] at java.security.AccessController.doPrivileged(Native Method)
[AccountEJB] at sun.rmi.transport.Transport.serviceCall(Unknown Source)
[AccountEJB] at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
[AccountEJB] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
[AccountEJB] at java.lang.Thread.run(Unknown Source)
-----------------------------------------------------
Home Interface
/**
* Search account by UserName
*/
public Account findByUserName(String userName)
throws FinderException, RemoteException;
-----------------------------------------------------
AccountEJB Impl
/**
* Accessor method ejbFindByUserName retrieves a single Account by using its username
*
* @param String - The account username to search on
* @return Integer- The account id to load
* @throws RemoteException
* @throws FinderException
*/
public Integer ejbFindByUserName(String userName)
throws FinderException, RemoteException {
if ( log.isDebugEnabled() ) {
log.debug("ejbFindByUserName - " + userName);
}
return null;
}
-------------------------------------------------
Jaws xml
<?xml version="1.0" encoding="UTF-8"?>
java:/HypersonicDS
<type-mapping>Hypersonic SQL</type-mapping>
true
<default-entity>
<create-table>false</create-table>
<remove-table>false</remove-table>
<tuned-updates>false</tuned-updates>
<read-only>false</read-only>
<time-out>300</time-out>
<select-for-update>false</select-for-update>
<pk-constraint>true</pk-constraint>
</default-entity>
<enterprise-beans>
<ejb-name>AccountEJB</ejb-name>
<table-name>Account</table-name>
<create-table>false</create-table>
<cmp-field><field-name>accountId</field-name></cmp-field>
<cmp-field><field-name>accountName</field-name></cmp-field>
<cmp-field><field-name>cardType</field-name></cmp-field>
<cmp-field><field-name>cardNumber</field-name></cmp-field>
<cmp-field><field-name>sortCode</field-name></cmp-field>
<cmp-field><field-name>expiryDate</field-name></cmp-field>
<cmp-field><field-name>creationDate</field-name></cmp-field>
<cmp-field><field-name>lastLogin</field-name></cmp-field>
<cmp-field><field-name>accountDisabled</field-name></cmp-field>
<cmp-field><field-name>userName</field-name></cmp-field>
<cmp-field><field-name>password</field-name></cmp-field>
findByUserName
userName = {0}
<read-ahead>true</read-ahead>
</enterprise-beans>
-----------------------------------------------------
DB schema:
create table Account(
AccountId int not null,
AccountName varchar(255) null,
CardType varchar(30) null,
CardNumber varchar(16) null,
SortCode varchar(8) null,
ExpiryDate varchar(30) null,
CreationDate datetime null,
LastLogin datetime null,
AccountDisabled varchar(10) null,
Username varchar(15) null,
Password varchar(15) null,
constraint PK_Account primary key(AccountId)
)
;
-------------------------------------------------
Summary:
All business methods work e.g setXX etc, findByPrimaryKey work and aswell as findAll ...
but when i invoke findByUserName(String name) there is a failure and i do not know why jboss has a stack trace refering to id. Could this be an id in the cache ?
Many Thanks If you can help