troubleshooting Question

Getting ClassNotFoundException for external java method stored procedure in weblogic

Avatar of weblogicme
weblogicme asked on
Java App Servers
10 Comments1 Solution714 ViewsLast Modified:
Please I need help in this desperately. Struggling with this NoClassDefFoundError :(

Created a portal web project (sampleWeb) with the following -

package net.local.util.common;

import java.sql.*;

import com.bea.netuix.transformer.openfoundation.util.XPSystem.Out;
import com.pointbase.jdbc.*;


public class DBLog {
	
	
	
	private Connection conn = null;
	private Statement m_stmt;
	private Statement l_stmt;
	private CallableStatement m_callStmt = null;
	
	
public DBLog() {
	
	Out.Write("DBLog constructor called");
	
}

	
	
public void logPreAuth() {
			
		try {
			Out.Write("Inside logPreAuth");
			
			
			
			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();  
			Out.Write("SP created");
			m_callStmt = conn.prepareCall("{ call PBPUBLIC.insLog(?) }");
			m_callStmt.setString(1, "Success!!");
			m_callStmt.execute(); 
			Out.Write("SP executed");
			
		}
		
		
		catch (Exception e) {
		e.printStackTrace();
		}
	
				
	}

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) {
	e.printStackTrace();
		
	}
	
}
	

} 

And created a test.jsp with the following contents -

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"
    import="net.local.util.common.DBLog"
    %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>test</title>
</head>
<body>
<%
DBLog dblog = new DBLog();
dblog.logPreAuth();
 %>
</body>
</html>

Then added pbembedded57.jar into web projects "Add external Jar's Library" and built the project.

When I hit the page, http://localhost:7001/sampleWeb/faces/test.jsp

INFO: Initializing Mojarra (1.2_09-20081212-SNAPSHOT) for context '/sampleWeb'
DBLog constructor called
Inside logPreAuth
SP created
java.sql.SQLException: The external "DBLog::insLog" routine had the following runtime exception "java.lang.ClassNotFoundException: DBLog"
      at com.pointbase.net.netJDBCPrimitives.handleResponse(Unknown Source)
      at com.pointbase.net.netJDBCPrimitives.handlePrimitiveResponse(Unknown Source)
      at com.pointbase.net.netJDBCPreparedStatement.execute(Unknown Source)
      at net.local.util.common.DBLog.logPreAuth(DBLog.java:65)
                   ......

Also FYI, there were following 2 build warnings,
Classpath entry E:/Oracle/Middleware/wlserver_10.3/common/eval/pointbase/lib/pbembedded57.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.        
The import com.pointbase.jdbc is never used      

Then tried adding "net.local.util.common.DBLog" to EXTERNAL NAME as follows,

 EXTERNAL NAME \"net.local.util.common.DBLog::insLog\"  but now I got the error,

DBLog constructor called
Inside logPreAuth
SP created
java.sql.SQLException: The external "net.local.util.common.DBLog::insLog" routine had the following runtime exception "java.lang.ClassNotFoundException: net.local.util.common.DBLog"
      at com.pointbase.net.netJDBCPrimitives.handleResponse(Unknown Source)
                   ......

Then I tried adding the following classpath entry to startPointbase.cmd,
@REM Add PointBase classes to the classpath
SET CLASSPATH=E:\Oracle\Middleware\user_projects\Workspaces\DBLog\sampleWeb\src\net\local\util\common;%POINTBASE_CLASSPATH%;%WEBLOGIC_CLASSPATH%

Now I got the error,

DBLog constructor called
Inside logPreAuth
SP created
java.sql.SQLException: The external "net.local.util.common.DBLog::insLog" routine had the following runtime exception "java.lang.ClassNotFoundException: net.local.util.common.DBLog"
      at com.pointbase.net.netJDBCPrimitives.handleResponse(Unknown Source)
                   ......

I also tried classpath "E:\Oracle\Middleware\user_projects\Workspaces\DBLog\sampleWeb\src" and again same above error.

Also tried adding external class folder in Libraries tab of Java build path. Still same above error.

I will be extremely thankful for any help.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 10 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros