1

I'm using classes12.jar for connection pooling in our application. There is a screen which, on clicking, redirects to an error page.

When I checked the server logs I got the exception shown below. The error is coming from our db connection manager (PAYTFDbBase.java).

This class contains getConnection() returns a connection object and calls getConnDetails() where the parameters are read. These two methods are listed below.

It used to occur like once in a blue moon and when it comes infra team restarts the server and the issue is gone.

But but recently it has been occurring much more frequently.

I've checked classes12.jar is inside WEB-INF\lib folder.

All other upload screens work going through the same connection manager is working correctly

 java.lang.NoClassDefFoundError:
    oracle/jdbc/pool/OracleConnectionCacheImpl  at
    com.arch.PAYTFDbBase.getConnDetails(PAYTFDbBase.java:787)
        at
    com.arch.PAYTFDbBase.getConnection(PAYTFDbBase.java:180)
        at
    com.reports.client.PAYLIQUIDUploadJavaBean.getRecords(PAYLIQUIDUploadJavaBean.java:72)
        at
    jsp_servlet._core.__payliquiduploadfiles._jspService(__payliquiduploadfiles.java:334)
        at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)    at
    weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
        at
    weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
        at
    weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
        at
    weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:184)
        at
    weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3732)
        at
    weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
        at
    weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at
    weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
        at
    weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)
        at
    weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
        at
    weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)  at
    weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

here is connection manager class method which are used for getting connection object.

protected Connection getConnection()
{
    if(con == null || con.isClosed())
    {
        con = getConnDetails();
        con.setAutoCommit(false);
    }
    return con;
    SQLException se;
    se;
    printIt((new StringBuilder("SQLException in getConnection() :")).append(se).toString());
    return con;
}
protected Connection getConnDetails()
{
    try
    {
        InitialContext ic = new InitialContext();
        DataSource ds = (DataSource)ic.lookup("jdbc/OracleCoreDS");
        con = ds.getConnection();
    }
    catch(Exception exception) { }
    if(con != null)
        break MISSING_BLOCK_LABEL_264;
    boolean data1;
    if(encriptFlag.equalsIgnoreCase("Y"))
        data1 = getEncrypData();
    else
        data1 = getPropData();
    try
    {
        cpds = new OracleConnectionPoolDataSource();
        cpds.setDriverType("thin");
        cpds.setNetworkProtocol("tcp");
        cpds.setServerName(mcName);
        cpds.setDatabaseName(sid);
        cpds.setPortNumber(Integer.parseInt(port));
        cpds.setUser(UserName);
        cpds.setPassword(pwd);
        ocacheimpl = new OracleConnectionCacheImpl(cpds);
        ocacheimpl.setMaxLimit(8);
        ocacheimpl.setMinLimit(1);
        ocacheimpl.setCacheScheme(1);
    }
    catch(SQLException sqlEx)
    {
        printIt((new StringBuilder("PAYTFDbBase  SQLException getConnDetails():")).append(sqlEx).toString());
    }
    catch(Exception ex)
    {
        printIt((new StringBuilder(":2:PAYTFDbBase  Exception getConnDetails():")).append(ex).toString());
    }
    return ocacheimpl.getConnection();
    Exception sqlex;
    sqlex;
    printIt((new StringBuilder("PAYTFDbBase Exception in connection():")).append(sqlex).toString());
    return con;
}
shinjw
  • 3,329
  • 3
  • 21
  • 42
  • Are you sure that you have the Oracle JDBC jar in your classpath/lib – shinjw May 12 '15 at 05:08
  • yes i checked. i could find classes12.jar over there in WEB-INF\lib folder – Murthi Navin Reddy May 12 '15 at 05:10
  • [This link] (http://stackoverflow.com/questions/5065974/caused-by-java-lang-classnotfoundexception-oracle-jdbc-oracledriver) may help you and make sure your jar files are not corrupted. – Wundwin Born May 12 '15 at 05:30
  • You could try to call Class.forName("oracle.jdbc.pool.OracleConnectionCacheImpl") before its first usage to ensure that the class is loaded. – user May 12 '15 at 05:40
  • Have you tried rebuilding and restarting. Sometimes this can occur when a class file was tampered with – shinjw May 12 '15 at 05:50
  • @WundwinBorn how come i know jar is corrupted. i checked and extracted. seems to be fine. if it is corrupted, how come it is working some times and some times not?? – Murthi Navin Reddy May 12 '15 at 05:53
  • @shinjw issue is no production. As i mentioned. Restarting the server resolves the problem. but it comes again sometime. I need the root cause of this inconsistent behavior. – Murthi Navin Reddy May 12 '15 at 05:54
  • But it is specific to a certain screen? Do you see any sqlexception prior to this nodef – shinjw May 12 '15 at 06:00
  • @shinjw no i don't see any. no traces available. I need to know does classes12.jar needs any additional jars?? – Murthi Navin Reddy May 12 '15 at 06:21
  • i have checked jar is not corrupted according to below link http://stackoverflow.com/questions/20152195/how-to-check-if-a-jar-file-is-valid – Murthi Navin Reddy May 12 '15 at 06:22
  • @shinjw specific to screens in the sense, this error is thrown on one particular screen. all other screen has never got this error though connection manager class and methods are same for all screens. – Murthi Navin Reddy May 12 '15 at 06:30

0 Answers0