3 Replies Latest reply on Mar 15, 2002 6:12 AM by rilux

    NullPointerException when accessing PostgreSQL database

    rilux

      Hello,

      I'm pretty new at this so forgive me if this is a silly question. I have a Postgres database set up and JBoss sees it/can connect to it but I can't read from or write to it. When I tried to get the first record (which is there) I get this huge exception (see below).

      Misconfiguration? The Postgres User I set up has all permissions granted to it.

      Thanks

      Rilux

      [ERROR,PersonEJB] TRANSACTION ROLLBACK EXCEPTION:
      javax.transaction.TransactionRolledbackException: Load failed; nested exception is:
      java.lang.NullPointerException; nested exception is:
      java.rmi.ServerException: Load failed; nested exception is:
      java.lang.NullPointerException
      java.rmi.ServerException: Load failed; nested exception is:
      java.lang.NullPointerException
      java.lang.NullPointerException
      at org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.getResultObject(JDBCCommand.java:500)
      at org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.loadOneEntity(JDBCLoadEntityCommand.java:219)
      at org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.handleResult(JDBCLoadEntityCommand.java:176)
      at org.jboss.ejb.plugins.jaws.jdbc.JDBCQueryCommand.executeStatementAndHandleResult(JDBCQueryCommand.java:59)
      at org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.jdbcExecute(JDBCCommand.java:156)
      at org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:147)
      at org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.loadEntity(JAWSPersistenceManager.java:156)
      at org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity(CMPPersistenceManager.java:362)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:287)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:197)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:125)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:138)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:347)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:100)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:127)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:170)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:428)
      at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:410)
      at java.lang.reflect.Method.invoke(Native Method)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241)
      at sun.rmi.transport.Transport$1.run(Transport.java:152)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:148)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:465)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:706)
      at java.lang.Thread.run(Thread.java:484)

        • 1. Re: NullPointerException when accessing PostgreSQL database
          dsundstrom

          I'm not really a JAWS expert, but I'll ask the basic questions.

          Did you set the type-mapping in your jaws.xml file?

          Did you set the data-source (?) in you jaws.xml file?

          • 2. Re: NullPointerException when accessing PostgreSQL database
            rilux

            Yes and yes to both questions.

            The database is specified in jboss.jcml. There are no errors that I can see in deploying the EJB or starting JBoss so I'm at a bit of a loss.

            Is there any detailed docs on configuring JAWS anywhere?

            Rilux

            • 3. Re: NullPointerException when accessing PostgreSQL database
              rilux

              OK, fixed it.

              This is what happened...

              When I first wrote and tried deploying the EJB Jboss was complaining that it didn't have the
              attributes MIN_VALUE, MAX_VALUE and TYPE in the deployment descripter so I put them in. I was
              rather confused by this because I haven't seen it in the documentation or books I've read anywhere
              Still, nevermind.

              So, anyway, when I went to connect it to the database the bean deployed OK. JBoss was able to see
              the database fine, etc. but I got the null pointer exceptions. By now I'm getting confused and
              frustrated as this is my final year project for Uni I'm working on. Just as an experiment I removed
              the MIN_VALUE, etc stuff and redeployed the EJB. It deployed with no problems. THen I ran my test
              program and it worked! YAY!

              But I'm still none the wiser why JBoss wanted MIN_VALUE, MAX_VALUE and TYPE CMP fields. Can anyone
              enlighten me?

              Rilux