Discussions

EJB programming & troubleshooting: EXCEPTION_ACCESS_VIOLATION !!! Urgent

  1. EXCEPTION_ACCESS_VIOLATION !!! Urgent (1 messages)

    Hi I am using , Oracle 8i , WLS 6.0sp2 in win 2000 .
    My Entity bean have a finder method as bellow ...
    ===========================================================
    public Enumeration ejbFindLoanByAppUserID(String pUserId) throws RemoteException,FinderException
       {
          Vector lKeys = new Vector();
          PersonalLoanPK lPk = null;
          String query = "select LOAN_ID from p1_personal_loan_hdr where APPLICATION_USER_ID = ? ";
          try
          {
             conn = this.getConnection();
             pstmt=conn.prepareStatement(query);
             rs = pstmt.executeQuery();
             pstmt.setString(1,pUserId);
             while( rs.next() )
             {
                lPk = new PersonalLoanPK( rs.getInt("LOAN_ID"));
                lKeys.addElement(lPk);
             }
          }
          catch(SQLException sqle)
          {
             System.out.println("SQL Exception occured during ejbFindAllEmployee()");
             System.out.println("SQL Exception is :- " + sqle.toString() );
             throw new FinderException();
          }
          finally
          {
             try
             {
                rs.close();
                pstmt.close();
                conn.close();
             }
             catch(SQLException sqle)
             {
                System.out.println("SQL Exception occured during ejbFindLoanByAppUserID(String pUserId) when closing Connection");
                System.out.println("SQL Exception is :- " + sqle.toString() );
             }
          }
          return lKeys.elements();
       }
    ===========================================================
    ejbCreate() method which is using ( connection ) from same connection pool is working fine ...

    But as call the above mentioned finder methos from a jsp page , it is giving

    EXCEPTION_ACCESS_VIOLATION exception has been detected in native code outside

    Please help me out ...

    Thanks in advance

    Ashim Chakraborty
  2. Is the code fragment accurate? If so then you're executing the query before setting the search key. Try
       pstmt.setString(1,pUserId);
       rs = pstmt.executeQuery();