aspose file tools*
The moose likes JDBC and the fly likes Runtime exception java.lang.ClassNotFoundException on executing Stored Proc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Runtime exception java.lang.ClassNotFoundException on executing Stored Proc " Watch "Runtime exception java.lang.ClassNotFoundException on executing Stored Proc " New topic
Author

Runtime exception java.lang.ClassNotFoundException on executing Stored Proc

Gopikrishna Gopal
Greenhorn

Joined: Sep 08, 2011
Posts: 26
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"



Please let me know how to solve this.

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

I googled and found a PointBase tutorial. And it said
The tutorial wrote:In order for the database to access this external java method, the class SampleExternalMethods must be included in the database CLASSPATH. For PointBase Server, it must be in the Server CLASSPATH, but not in the Client CLASSPATH.


So presumably your DbLog class isn't in the database's classpath.
Gopikrishna Gopal
Greenhorn

Joined: Sep 08, 2011
Posts: 26
I set the classpath as follows in both the below files,

--commEnv.cmd
set POINTBASE_CLASSPATH=%POINTBASE_HOME%\lib\pbembedded57.jar;%POINTBASE_CLIENT_CLASSPATH%;C:\bea\user_projects\workspaces\WhatsNext\WhatsNextUtility\build\classes\net\verizon\whatsnext\util\common\DbLog.class

--setDomainEnv.cmd
set CLASSPATH=%PRE_CLASSPATH%;%WEBLOGIC_CLASSPATH%;%POST_CLASSPATH%;%WLP_POST_CLASSPATH%;%WL_HOME%\common\eval\pointbase\lib\pbembedded57.jar;C:\bea\user_projects\workspaces\WhatsNext\WhatsNextUtility\build\classes\net\verizon\whatsnext\util\common\DbLog.class

As you can see, I setted classpath for both pbembedded57.jar as well as my DbLog path.
But still I am getting the below error,

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

But I can see INSLOG listed under procedures in Pointbase. Please suggest what could be the problem.
Gopikrishna Gopal
Greenhorn

Joined: Sep 08, 2011
Posts: 26
I setted the classpath in commEnv.cmd as follows,
set POINTBASE_HOME=%WL_HOME%\common\eval\pointbase
set POINTBASE_CLIENT_CLASSPATH=%POINTBASE_HOME%\lib\pbclient57.jar
set POINTBASE_CLASSPATH=%POINTBASE_HOME%\lib\pbembedded57.jar;%POINTBASE_CLIENT_CLASSPATH%;C:\bea\user_projects\workspaces\work1\utility\build\classes
set POINTBASE_TOOLS=%POINTBASE_HOME%\lib\pbtools57.jar

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

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

Error 500--Internal Server Error
java.lang.NoClassDefFoundError: Could not initialize class net.local.util.common.DbLog

Please find the code below,

--RequestFilter.java



--DbLog.java
Gopikrishna Gopal
Greenhorn

Joined: Sep 08, 2011
Posts: 26
any idea please?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8



So your DBLog class is actually in a package. But Pointbase is looking for DBLog, not for net.local.util.common.DbLog. When I looked at the Pointbase tutorial I was really surprised that they seemed to be illustrating the use of a class in the default package, which is a bad practice these days. But perhaps there's some other place where you're supposed to tell Pointbase what package your class is in?
Gopikrishna Gopal
Greenhorn

Joined: Sep 08, 2011
Posts: 26
hmm yeah seems Pointbase is struggling to find DbLog class. Maybe I will try to create another class without package with insLog method and see if any luck?
Gopikrishna Gopal
Greenhorn

Joined: Sep 08, 2011
Posts: 26

I was not able to create a new class(with insLog method) without package name, since I need to import that class using package name in DbLog class.
So that was not possible.

Strange.. Any other possibilities?
Gopikrishna Gopal
Greenhorn

Joined: Sep 08, 2011
Posts: 26
I read the pointbase documentation at, http://docs.oracle.com/cd/E19518-01/817-7464/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?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

Apparently you haven't tried the obvious, namely putting the fully qualified class name into your EXTERNAL NAME clause.
Gopikrishna Gopal
Greenhorn

Joined: Sep 08, 2011
Posts: 26
Paul Clapham wrote:Apparently you haven't tried the obvious, namely putting the fully qualified class name into your EXTERNAL NAME clause.


You mean like this?
EXTERNAL NAME \"net.local.util.common.DbLog::insLog\"
I guess I tried like this too.
Or you mean to say something else?
Gopikrishna Gopal
Greenhorn

Joined: Sep 08, 2011
Posts: 26
Paul Clapham wrote:Apparently you haven't tried the obvious, namely putting the fully qualified class name into your EXTERNAL NAME clause.


I tried like this too,

EXTERNAL NAME \"net.local.util.common.DbLog::insLog\"

But still getting,

java.sql.SQLException: The external "net.verizon.whatsnext.util.common.DBLog::insLog" routine had the following runtime exception "java.lang.ClassNotFoundException: net.verizon.whatsnext.util.common.DBLog"
Gopikrishna Gopal
Greenhorn

Joined: Sep 08, 2011
Posts: 26
I even tried another new method as follows but that too failed.

I created a jar file DBLog.jar with DBLog class residing in the package (net.local.util.common)

Then added this jar file into the shared library of web project that is calling the method logPreAuth of DBLog class.



Then setted the Pointbase class path in startPointBase.cmd as follows,

@REM Add PointBase classes to the classpath
SET CLASSPATH=C:\bea\user_projects\workspaces\Work1\DBLog.jar;%POINTBASE_CLASSPATH%;%WEBLOGIC_CLASSPATH%

Restarted the admin server and published and, when I hit the page, getting the below error this time,

Error 500--Internal Server Error
java.lang.NoClassDefFoundError: net/local/util/common/DBLog
at net.local.webapp.RequestFilter.doFilter(RequestFilter.java:80)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at com.bea.portal.tools.servlet.http.HttpContextFilter.doFilter(HttpContextFilter.java:60)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at com.bea.p13n.servlets.PortalServletFilter.doFilter(PortalServletFilter.java:336)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at com.bea.jsptools.servlet.PagedResultServiceFilter.doFilter(PagedResultServiceFilter.java:82)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3502)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2186)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2092)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)


Whats wrong?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Runtime exception java.lang.ClassNotFoundException on executing Stored Proc