Forums Register Login

AbstractMethodError: setBlob/setBinaryStream

+Pie Number of slices to send: Send
Hey everyone,

I have a template file which I'm trying to upload into a database using setBlob or setBinaryStream but I'm getting the following error:

####<May 28, 2015 1:41:57 PM EDT> <Error> <HTTP> <server-name-redacted> <msp_bpmsp_qas_01_m00> <[ACTIVE] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1432834917685> <BEA-101017> <[weblogic.servlet.internal.WebAppServletContext@85c0ec3 - appName: 'katet_qa', name: 'katet_qa.war', context-path: '/katet_qa', spec-version: '2.5'] Root cause of ServletException.
java.lang.AbstractMethodError: setBlob
at weblogic.jdbc.wrapper.PreparedStatement.setBlob(PreparedStatement.java:1005)
at com.redacted.citrix.ssp.dao.KatetDaoImpl.uploadReport(KatetDaoImpl.java:1694)
at com.redacted.citrix.ssp.services.FileOpsImpl.generateDownload(FileOpsImpl.java:823)
at com.credacted.citrix.ssp.controller.JSONController.display(JSONController.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:175)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:446)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:434)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:821)
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:292)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:176)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3498)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
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)
>

The database version is Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production.
I'm using a Weblogic Server, version WebLogic Server Version: 10.3.0.0
The driver class name for the datasource is weblogic.jdbcx.oracle.OracleDataSource
Edit: Initiailly, my application was using Java 1.5. I updated it to 1.6 to be consistent with the version of Weblogic server I'm using, but that didn't resolve the issue.

Initially, I had ojdbc14.jar included in my application and I used the setBlob method as seen below for the prepared statement.



That returned the error I copied at the top. I then changed

ps.setBlob(1, is);

to

ps.setBinaryStream(1,is);

which yielded the same "AbstractMethodError", just for setBinaryStream instead of setBlob.

Finally, I replaced ojdbc14.jar with ojdbc6.jar in my application and tried setBlob again, but got the same error.

I'm just at a loss. There's so many moving parts here, and I'm confused about what versions matter, between the database, the drivers, the jars, and I have no idea how to make them correlate. Any ideas? Thanks all!
+Pie Number of slices to send: Send
Not sure if this may help you... Did you try to create a simpler piece of working code outside weblogic environment? I mean a simple test class with only the main method where you try to work with blob fields. At runtime an AbstratMethodError may be thrown only if some bytecode inconsistency is found, so I wonder if you are not facing any weird classloader issue. This is why I suggest you to start with a simple example.
+Pie Number of slices to send: Send
I haven't done any tests outside of a weblogic environment, but in a separate dev environment on a slightly newer (10.3.6) version of Weblogic, it does work...different version of weblogic, differnet drivers, etc., but I dont have control over the QA environment that's giving me this issue.
+Pie Number of slices to send: Send
 

Ryan Kostrzewa wrote:I haven't done any tests outside of a weblogic environment, but in a separate dev environment on a slightly newer (10.3.6) version of Weblogic, it does work...different version of weblogic, differnet drivers, etc., but I dont have control over the QA environment that's giving me this issue.


I can only guess that the problem is not in the target database, but something related to java runtime and a class version mismatch involved with driver classes you are using. For example, why did you include ojdbc jar file in your application? You should obtain a connection from the data source so that Weblogic instantiates it for you, without worrying about the actual concrete Connection implementation and version you are using.
+Pie Number of slices to send: Send
Yeah, it actually occurred to me that that didn't make sense, so I took ojdbc6 out of my application now entirely. Generically speaking, how would you go about debugging this?
+Pie Number of slices to send: Send
Actually, let me take a step back here - I get what you're saying about a mismatch between the driver and the JRE....but since both are set on the server, and I don't have control of the server, does that mean I'm essentially powerless to solve this problem? I'd need to be able to change the driver the server is using or the JRE version, right?
+Pie Number of slices to send: Send
 

Ryan Kostrzewa wrote:Actually, let me take a step back here - I get what you're saying about a mismatch between the driver and the JRE....but since both are set on the server, and I don't have control of the server, does that mean I'm essentially powerless to solve this problem? I'd need to be able to change the driver the server is using or the JRE version, right?


More or less, yes. If on a different configuration your code works, I think that the issues is related to some detail you are not aware of and you cannot change - it would definitely better ask your Weblogic QA manager and ask for his or her help, showing your test case. I don't think that you can debug something - this error is somehow out of programmer's control, it just happen because there is a low level problem. Maybe is the way you build your code (with Netbeans, for example, sometimes happens to get a Uncompilable source code (or similar) , and I need to clean up the cache), maybe the problem is elsewhere.
I added a flag to your post hoping to attract more readers...
+Pie Number of slices to send: Send
Thank ya sir! Yeah, it's an interesting problem. I'll definitely talk to the team that owns that server and see if they've had to deal with this in the past. I wonder if there's any alternate way to upload files into the db but I'd like to be consistent and I've been using prepared statements for non-blob stuff all over my code already.
+Pie Number of slices to send: Send
I've never used hibernate but I've read it's an alternative to jdbc. would it be possible to set that up, or would it fail for similar reasons? I'm assuming it doesn't use jdbc drivers right?
+Pie Number of slices to send: Send
No. Hibernate uses JDBC extensively, hiding the details for you,so if your issue is really a configuration problem I don't think that replacing jdbc class with hibernate may help.
+Pie Number of slices to send: Send
Ah. Rats :/
1
+Pie Number of slices to send: Send
Let me take a (very) wild shot on this one.

The method in your codeis added in Java 1.6 and you'll get an AbstractMethodError. According to its javadoc this error is thrown when an application tries to call an abstract method. Normally, this error is caught by the compiler; this error can only occur at run time if the definition of some class has incompatibly changed since the currently executing method was last compiled. So it seems the WebLogic server uses an older version of jdbc which doesn't define this method signature.

Changing to methodwon't help you either, because it's also added in Java 1.6 and thus the resulting error will be the same (as you experienced).

If you have the actual length of the InputStream you are using, you could try using this method insteadMake sure to use an int variable as third parameter, because there's also an overloaded version using a long parameter for the length (which was also added in Java 1.6).

If that one fails as well, it might be worth to have a look at which methods are defined in the implementing class of the PreparedStatement interface using reflection. Something like this could do the jobIf you know which methods are defined, you know which one will be the best method for the job

Hope it helps!
Kind regards,
Roel
+Pie Number of slices to send: Send
Roel's answer seems very well detailed and I think he's right. Ryan, are you actually using two different JRE runtimes (one for development, the other for QA or production) in your work ?
+Pie Number of slices to send: Send
This question seems to be posted as well in Oracle's Java Database Connectivity (JDBC) community (and a similar suggestion is made). Always BeForthrightWhenCrossPostingToOtherSites!
I'm gonna teach you a lesson! Start by looking at this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 2364 times.
Similar Threads
Internal Server Error due to NullPointerException while running the app.
NoClassDefFoundError
Does anyone know what this error means?
struts2 error
error in jsp when using tags to loop.
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 07:06:02.