aspose file tools*
The moose likes JDBC and the fly likes AbstractMethodError while  doing prepareCall() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "AbstractMethodError while  doing prepareCall()" Watch "AbstractMethodError while  doing prepareCall()" New topic
Author

AbstractMethodError while doing prepareCall()

Praveen Dharmavaram
Ranch Hand

Joined: Nov 05, 2002
Posts: 59
Hi,
I am getting an AbstractMethodError while trying to
prepareCall(String).Is it some thing wrong with my code. Here is the sample
Code
****************************************************************************
**
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");
Context ctx = null;
try {
ctx = new InitialContext(ht);
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
DataSource ds = null;
try {
ds = (DataSource) ctx.lookup("jdbc/ABC");
} catch (NamingException e1) {
e1.printStackTrace();
}
Connection conn = null;
try {
conn = ds.getConnection(userName, password);
} catch (SQLException e2) {
e2.printStackTrace();
}
System.out.println("Got connection : " + conn);
StringBuffer buf = new StringBuffer();
buf.append("Call Get_Sub(");
for (int i = 1; i < 10; i++) {
buf.append("?,");
}
buf.append("?)");
CallableStatement callStatement = null;
try {
callStatement = conn.prepareCall(buf.toString()); //Get an exception
} catch (SQLException e3) {
e3.printStackTrace();
}
for (int i = 1; i < 10; i++) {
// Register all parameters
try {
callStatement.registerOutParameter(i, java.sql.Types.CHAR);
} catch (SQLException e4) {
e4.printStackTrace();
}
}
try {
callStatement.setString(1, "1234567890");
callStatement.setString(2, " ");
} catch (SQLException e4) {
e4.printStackTrace();
}
try {
callStatement.execute();
} catch (SQLException e) {
e.printStackTrace();
}
String returnCode = null;
// get the return code
try {
returnCode = callStatement.getString(3).trim();
System.out.println("(12) return code= " + returnCode + ";");
} catch (SQLException e) {
}
****************************************************************************
**
The Exception i get is
****************************************************************************
**
[8/11/03 10:58:47:594 EDT] 34128743 WSRdbDataSour u JDBC Driver version is
07.02.0007
[8/11/03 10:58:47:906 EDT] 34128743 SystemOut O Got connection :
com.ibm.ws.rsadapter.jdbc.WSJdbcConnection@1d358756
[8/11/03 10:58:48:609 EDT] 34128743 ServletInstan E SRVE0100E: Did not
realize init() exception thrown by servlet TestServlet:
javax.servlet.ServletException:
COM/ibm/db2/jdbc/app/DB2Connection.prepareCall
at
com.ibm.ws.webcontainer.servlet.StrictServletInstance.doInit(StrictServletIn
stance.java:99)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._init(StrictLifecycle
Servlet.java:147)
at
com.ibm.ws.webcontainer.servlet.PreInitializedServletState.init(StrictLifecy
cleServlet.java:270)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.init(StrictLifecycleS
ervlet.java:113)
at
com.ibm.ws.webcontainer.servlet.ServletInstance.init(ServletInstance.java:18
9)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at
com.ibm.ws.webcontainer.webapp.WebAppServletManager.addServlet(WebAppServlet
Manager.java:870)
at
com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadServlet(WebAppServle
tManager.java:224)
at
com.ibm.ws.webcontainer.webapp.WebAppServletManager.getServletReference(WebA
ppServletManager.java:455)
at
com.ibm.ws.webcontainer.webapp.WebApp.getServletReference(WebApp.java:646)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcherInfo.calculateInfo(Web
AppRequestDispatcherInfo.java:172)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcherInfo.<init>(WebAppRequ
estDispatcherInfo.java:59)
at
com.ibm.ws.webcontainer.webapp.WebApp.getRequestDispatcher(WebApp.java:1455)
at
com.ibm.ws.webcontainer.webapp.WebApp.getRequestDispatcher(WebApp.java:1414)
at
com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker
.java:197)
at
com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(C
achedInvocation.java:71)
at
com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletReq
uestProcessor.java:182)
at
com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListene
r.java:334)
at
com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.jav
a:56)
at
com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:610)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:431)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)
---- Begin backtrace for Nested Throwables
java.lang.AbstractMethodError:
COM/ibm/db2/jdbc/app/DB2Connection.prepareCall
at
com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareCall(WSJdbcConnection.java
:1295)
at
com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareCall(WSJdbcConnection.java
:1260)
at com.ibm.annap.test.TestServlet.init(TestServlet.java:108)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at
com.ibm.ws.webcontainer.servlet.StrictServletInstance.doInit(StrictServletIn
stance.java:82)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._init(StrictLifecycle
Servlet.java:147)
at
com.ibm.ws.webcontainer.servlet.PreInitializedServletState.init(StrictLifecy
cleServlet.java:270)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.init(StrictLifecycleS
ervlet.java:113)
at
com.ibm.ws.webcontainer.servlet.ServletInstance.init(ServletInstance.java:18
9)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at
com.ibm.ws.webcontainer.webapp.WebAppServletManager.addServlet(WebAppServlet
Manager.java:870)
at
com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadServlet(WebAppServle
tManager.java:224)
at
com.ibm.ws.webcontainer.webapp.WebAppServletManager.getServletReference(WebA
ppServletManager.java:455)
at
com.ibm.ws.webcontainer.webapp.WebApp.getServletReference(WebApp.java:646)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcherInfo.calculateInfo(Web
AppRequestDispatcherInfo.java:172)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcherInfo.<init>(WebAppRequ
estDispatcherInfo.java:59)
at
com.ibm.ws.webcontainer.webapp.WebApp.getRequestDispatcher(WebApp.java:1455)
at
com.ibm.ws.webcontainer.webapp.WebApp.getRequestDispatcher(WebApp.java:1414)
at
com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker
.java:197)
at
com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(C
achedInvocation.java:71)
at
com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletReq
uestProcessor.java:182)
at
com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListene
r.java:334)
at
com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.jav
a:56)
at
com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:610)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:431)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)
[8/11/03 10:58:48:906 EDT] 34128743 WebGroup E SRVE0020E: [Servlet
Error]-[TestServlet]: Failed to load servlet: java.lang.AbstractMethodError:
COM/ibm/db2/jdbc/app/DB2Connection.prepareCall
at
com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareCall(WSJdbcConnection.java
:1295)
at
com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareCall(WSJdbcConnection.java
:1260)
at com.ibm.annap.test.TestServlet.init(TestServlet.java:108)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at
com.ibm.ws.webcontainer.servlet.StrictServletInstance.doInit(StrictServletIn
stance.java:82)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._init(StrictLifecycle
Servlet.java:147)
at
com.ibm.ws.webcontainer.servlet.PreInitializedServletState.init(StrictLifecy
cleServlet.java:270)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.init(StrictLifecycleS
ervlet.java:113)
at
com.ibm.ws.webcontainer.servlet.ServletInstance.init(ServletInstance.java:18
9)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at
com.ibm.ws.webcontainer.webapp.WebAppServletManager.addServlet(WebAppServlet
Manager.java:870)
at
com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadServlet(WebAppServle
tManager.java:224)
at
com.ibm.ws.webcontainer.webapp.WebAppServletManager.getServletReference(WebA
ppServletManager.java:455)
at
com.ibm.ws.webcontainer.webapp.WebApp.getServletReference(WebApp.java:646)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcherInfo.calculateInfo(Web
AppRequestDispatcherInfo.java:172)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcherInfo.<init>(WebAppRequ
estDispatcherInfo.java:59)
at
com.ibm.ws.webcontainer.webapp.WebApp.getRequestDispatcher(WebApp.java:1455)
at
com.ibm.ws.webcontainer.webapp.WebApp.getRequestDispatcher(WebApp.java:1414)
at
com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker
.java:197)
at
com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(C
achedInvocation.java:71)
at
com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletReq
uestProcessor.java:182)
at
com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListene
r.java:334)
at
com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.jav
a:56)
at
com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:610)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:431)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)
[8/11/03 10:58:49:219 EDT] 34128743 WebGroup E SRVE0026E: [Servlet
Error]-[TestServlet]: java.lang.AbstractMethodError:
COM/ibm/db2/jdbc/app/DB2Connection.prepareCall
at
com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareCall(WSJdbcConnection.java
:1295)
at
com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareCall(WSJdbcConnection.java
:1260)
at com.ibm.annap.test.TestServlet.init(TestServlet.java:108)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at
com.ibm.ws.webcontainer.servlet.StrictServletInstance.doInit(StrictServletIn
stance.java:82)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._init(StrictLifecycle
Servlet.java:147)
at
com.ibm.ws.webcontainer.servlet.PreInitializedServletState.init(StrictLifecy
cleServlet.java:270)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.init(StrictLifecycleS
ervlet.java:113)
at
com.ibm.ws.webcontainer.servlet.ServletInstance.init(ServletInstance.java:18
9)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at
com.ibm.ws.webcontainer.webapp.WebAppServletManager.addServlet(WebAppServlet
Manager.java:870)
at
com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadServlet(WebAppServle
tManager.java:224)
at
com.ibm.ws.webcontainer.webapp.WebAppServletManager.getServletReference(WebA
ppServletManager.java:455)
at
com.ibm.ws.webcontainer.webapp.WebApp.getServletReference(WebApp.java:646)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcherInfo.calculateInfo(Web
AppRequestDispatcherInfo.java:172)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcherInfo.<init>(WebAppRequ
estDispatcherInfo.java:59)
at
com.ibm.ws.webcontainer.webapp.WebApp.getRequestDispatcher(WebApp.java:1455)
at
com.ibm.ws.webcontainer.webapp.WebApp.getRequestDispatcher(WebApp.java:1414)
at
com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker
.java:197)
at
com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(C
achedInvocation.java:71)
at
com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletReq
uestProcessor.java:182)
at
com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListene
r.java:334)
at
com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.jav
a:56)
at
com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:610)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:431)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)
****************************************************************************
**
Saritha Sarla
Greenhorn

Joined: Oct 23, 2003
Posts: 6
Hello,
Can you tell me how you have solved the problem. I am also encoutering the same problem.

Thanks
Saritha
Anna Jean
Greenhorn

Joined: Dec 23, 2003
Posts: 8
Saritha,

Make sure you run the batch file in the same directory as the db2java.zip file. It should be under SQLLIB/java12 I believe. The batch file is called usejdbc<X>.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: AbstractMethodError while doing prepareCall()