The classic one is that your db record contains a null value in one of its attribute and that your are using a primitive attribute in your entity bean (int instead of Integer, double instead of Double...). That would cause a NPE in this case. /Lennart
----- Original Message ----- From: Eric Anderson <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, October 04, 2001 8:57 AM Subject: [JBoss-user] CMP getter exception > Hi all, > I'm getting a mysterious exception with JBoss 2.4.1a and a fairly simple CMP bean. > The bean is called "User" and references the "Users" table in an Oracle server. > The code that causes the exception looks like this: > > UserHome uhome = (UserHome)PortableRemoteObject.narrow (ref, UserHome.class); > User User1 = uhome.findByPrimaryKey(new Long(1)); > System.out.println(User1.getPassword()); > > The exception is thrown when getPassword() is called. This should return a String, >and the corresponding column in the table is of type VARCHAR2(10). > Below is the stack trace: > > [J2EE Deployer Default] J2EE application: >file:/opt/JBoss-2.4.1_Tomcat-3.2.3/jboss/deploy/VLBeans.jar is deployed. > [JAWS] Exists command executing: SELECT COUNT(*) FROM USERS WHERE objid=? > [JAWS] Set parameter: idx=1, jdbcType=BIGINT, value=1 > [EntityLockInterceptor] Begin invoke, key=1 > [User] Activated bean User with id = 1 > [EntityInstanceInterceptor] Begin invoke, key=1 > [EntitySynchronizationInterceptor] invoke called for ctx >org.jboss.ejb.EntityEnterpriseContext@e344b02, tx=TransactionImpl:XidImpl >[FormatId=257, GlobalId=catamount.ultracode.com//1, BranchQual=] > [JAWS] Load command executing: SELECT >USERS.objid,USERS.user_priv_type,USERS.user_id,USERS.password,USERS.first_name,USERS.privilage_allowed,USERS.state,USERS.account_id,USERS.phone,USERS.audio_priv,USERS.qa,USERS.street,USERS.street2,USERS.phoneretrievalpin,USERS.login_allowed,USERS.email,USERS.country,USERS.user_num,USERS.city,USERS.last_name,USERS.zip,USERS.priority,USERS.middle_name,USERS.fax,USERS.phone_lines,USERS.title > FROM USERS WHERE objid=? > [JAWS] Set parameter: idx=1, jdbcType=BIGINT, value=1 > [EntitySynchronizationInterceptor] loadEntity Exception, clear tx for >ctx=org.jboss.ejb.EntityEnterpriseContext@e344b02, tx=TransactionImpl:XidImpl >[FormatId=257, GlobalId=catamount.ultracode.com//1, BranchQual=] > [EntityInstanceInterceptor] Ending invoke, exceptionThrown, >ctx=org.jboss.ejb.EntityEnterpriseContext@e344b02 > [EntityInstanceInterceptor] End invoke, key=1, >ctx=org.jboss.ejb.EntityEnterpriseContext@e344b02 > [EntityLockInterceptor] End invoke, key=1 > [User] TRANSACTION ROLLBACK EXCEPTION:Load failed; nested exception is: > java.lang.NullPointerException; nested exception is: > java.rmi.ServerException: Load failed; nested exception is: > java.lang.NullPointerException > [User] java.rmi.ServerException: Load failed; nested exception is: > [User] java.lang.NullPointerException > [User] java.lang.NullPointerException > [User] at java.lang.reflect.Field.set(Native Method) > [User] at >org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.setCMPFieldValue(JDBCCommand.java:655) > [User] at >org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.loadOneEntity(JDBCLoadEntityCommand.java:217) > [User] at >org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.handleResult(JDBCLoadEntityCommand.java:176) > [User] at >org.jboss.ejb.plugins.jaws.jdbc.JDBCQueryCommand.executeStatementAndHandleResult(JDBCQueryCommand.java:59) > [User] at >org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.jdbcExecute(JDBCCommand.java:160) > [User] at >org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:147) > [User] at >org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.loadEntity(JAWSPersistenceManager.java:156) > [User] at >org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity(CMPPersistenceManager.java:362) > [User] at >org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:286) > [User] at >org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:208) > [User] at >org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:136) > [User] at >org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:133) > [User] at >org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:307) > [User] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:99) > [User] at >org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:128) > [User] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:195) > [User] at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:427) > [User] at >org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:393) > [User] at java.lang.reflect.Method.invoke(Native Method) > [User] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:242) > [User] at sun.rmi.transport.Transport$1.run(Transport.java:155) > [User] at java.security.AccessController.doPrivileged(Native Method) > [User] at sun.rmi.transport.Transport.serviceCall(Transport.java:152) > [User] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:462) > > I was wondering if this might have something to do with there being no VARCHAR2 >mapping in standardjaws.xml? > > Eric Anderson > > > > > _______________________________________________ > JBoss-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-user _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
