Results 1 to 4 of 4
  1. #1
    gopikrish81 is offline Member
    Join Date
    Sep 2011
    Posts
    6
    Rep Power
    0

    Unhappy Runtime exception java.lang.ClassNotFoundException on executing Stored Proc

    I am getting the below error when I try to execute a stored proc in Pointbase from weblogic.

    java.sql.SQLException: The external "DbLog::insLog" routine had the following runtime exception "java.lang.ClassNotFoundException: DbLog"

    So I setted the classpath in commEnv.cmd as follows,

    set POINTBASE_HOME=%WL_HOME%\common\eval\pointbase
    set POINTBASE_CLIENT_CLASSPATH=%POINTBASE_HOME%\lib\pb client57.jar
    set POINTBASE_CLASSPATH=%POINTBASE_HOME%\lib\pbembedde d57.jar;%POINTBASE_CLIENT_CLASSPATH%;C:\bea\user_p rojects\workspaces\work1\utility\build\classes
    set POINTBASE_TOOLS=%POINTBASE_HOME%\lib\pbtools57.jar

    My DbLog class is in the path, C:\bea\user_projects\workspaces\Work1\util\build\c lasses\net\local\util\common FYI, net\local\util\common is the package structure.

    But when I try to execute the page which calls RequestFilter.java, I am getting the following error,

    java.lang.NoClassDefFoundError: org/apache/log4j/Logger
    ...
    Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
    ...

    And when I refresh the page,

    java.lang.NoClassDefFoundError: Could not initialize class net.verizon.whatsnext.util.common.DbLog


    So before setting classpath, atleast it was going inside DbLog. Now its not at all instantiating DbLog class.

    --RequestFilter.java

    Java Code:
      import net.local.util.common.DbLog;   
    
        public final class RequestFilter {   
    
        public void log() {   
    
        DbLog dblog = new DbLog();   
        dblog.logPreAuth();   
        }   
        }
    --DbLog.java

    Java Code:
    package net.local.util.common;   
    
        import java.sql.*;   
        import org.apache.log4j.Logger;   
        import com.pointbase.jdbc.*;   
    
    
        public class DbLog {   
    
    
            private static final Logger logger = Logger.getLogger(DbLog.class);   
            private static boolean DEBUGGING = logger.isDebugEnabled();   
            private Connection conn = null;   
            private Statement m_stmt;   
            private Statement l_stmt;   
            private CallableStatement m_callStmt = null;   
            //static ResultSet l_rs = null;
    
     public DbLog() {   
    
            logger.info("DbLog constructor called");   
            init();   
    
        }   
    
        public void init() {   
            logger.info("DbLog init called");   
        }   
    
    
    
    
        public void logPreAuth() {   
    
                try {   
                    logger.info("Inside logPreAuth method");   
    
    
    
                    String I_URL = "jdbc:pointbase:server://localhost:9093/weblogic_eval";   
                    Class.forName("com.pointbase.jdbc.jdbcUniversalDriver").newInstance();   
                    //Class.forName("com.pointbase.jdbc.jdbcDataSource");   
                    conn = DriverManager.getConnection(I_URL, "PBPUBLIC", "PBPUBLIC");   
    
                String SQL_CREATE_PROC = "CREATE PROCEDURE insLog(IN P1 VARCHAR(30))"  
                        + " LANGUAGE JAVA"  
                        + " SPECIFIC insLog"  
                        + " DETERMINISTIC"  
                        + " NO SQL"  
                        + " EXTERNAL NAME \"DbLog::insLog\""  
                        + " PARAMETER STYLE SQL";    
    
    
                    m_stmt = conn.createStatement();   
                    m_stmt.executeUpdate(SQL_CREATE_PROC);   
                    m_stmt.close();     
                    m_callStmt = conn.prepareCall("{ call PBPUBLIC.insLog(?) }");   
                    m_callStmt.setString(1, "Success!!");   
                    m_callStmt.execute();    
    
                }   
    
    
                catch (Exception e) {   
                    logger.error("Error in logPreAuth method" + e);   
                }   
    
    
            }   
    
        public void insLog(String test)   
        {   
            try {   
    
                l_stmt = conn.createStatement();   
                l_stmt.execute("Insert into logs values('" + test + "')");   
                l_stmt.close();   
                conn.close();   
            }   
            catch (Exception e) {   
    
            }   
    
        }   
        }
    Please help !

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,006
    Rep Power
    20

    Default Re: Runtime exception java.lang.ClassNotFoundException on executing Stored Proc

    Since you have got quite a lot of help over at OTN do you not think it might be an idea to provide a link to the thread there?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    gopikrish81 is offline Member
    Join Date
    Sep 2011
    Posts
    6
    Rep Power
    0

    Default Re: Runtime exception java.lang.ClassNotFoundException on executing Stored Proc

    Please find the entire code at https://forums.oracle.com/forums/thr...55663&tstart=0

    Please suggest. Thanks

  4. #4
    gopikrish81 is offline Member
    Join Date
    Sep 2011
    Posts
    6
    Rep Power
    0

    Default Re: Runtime exception java.lang.ClassNotFoundException on executing Stored Proc

    I read the pointbase documentation at, http://docs.oracle.com/cd/E19518-01/...4/817-7464.pdf

    And it says,

    In order for the database to access this external Java method, the class SampleExternalMethods
    must be included in the database CLASSPATH. For PointBase Embedded - Server Option, it
    must be in the Server CLASSPATH, but not in the Client CLASSPATH.

    The java method can be static or non-static. If it is non-static, connection object will be
    established during function invocation, so a non-static member variable of java.sql.connection
    and a constructor having parameter java.sql.connection needs to be implemented. If it is static,
    the method is called directly and no connection object will be established during function
    invocation.

    I setted the POINTBASE_CLASSPATH as mentioned in my previous posts but of no use. Did i miss anything?
    Should I create a constructor with a connection parameter? But it says, if java method is static, then no connection object will be established during function invocation. Does this mean, no constructor with connection parameter is needed for static java method too?
    Last edited by gopikrish81; 03-08-2012 at 09:01 PM.

Similar Threads

  1. java.lang.ClassNotFoundException
    By djgovins in forum Java Servlet
    Replies: 4
    Last Post: 07-25-2011, 11:54 AM
  2. Replies: 8
    Last Post: 11-04-2010, 01:46 PM
  3. Replies: 1
    Last Post: 11-20-2009, 07:58 PM
  4. Replies: 0
    Last Post: 02-28-2009, 11:16 AM
  5. java.lang.ClassNotFoundException
    By ravian in forum New To Java
    Replies: 1
    Last Post: 01-07-2008, 10:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •