Re: How can this abstract method error happen?

Поиск
Список
Период
Сортировка
От Pawel Veselov
Тема Re: How can this abstract method error happen?
Дата
Msg-id CAMnJ+BdF_EXchy_M8wfL92Zm2Oqnu__UALAaSdz-vrgRkiNb3A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: How can this abstract method error happen?  (Lachezar Dobrev <l.dobrev@gmail.com>)
Список pgsql-jdbc

Hi.

This is my bad, sorry. I managed to be investigating on one system, where the exception was happening on another. The actual system did have a postgresql-9.1-903.jdbc3.jar in the classpath, hence the problem. So, the answer to my original questions would be : Driver will never create connection/statement objects of lesser JDBC version than what it's compiled for (as Dave said), and, look better and you will find an older JDBC Postgres driver in your classpath.

Tracing the code, it looks like it absolutely doesn't matter whether any proxies are used to wrap the statement/connection obejcts. The proxy you are seeing in the stack trace actually comes from Postgres driver, the pooled connection object uses those. If the problem was with any of the wrappers, the "AbstractMethodError", or an unrecognized method exception would have been thrown from the wrapper, and not from Postgres object. All the wrappers will have to, at the end, reference an actual statement/connection object produced by the driver.

The version of JDBC used by core Java is also, IMHO, not important. Driver will create whatever it considers "latest", since JDBC API is backward-compatible, "extra" methods shouldn't cause any kind of issues. My code assumes, and is compiled against, JDBC4, otherwise it wouldn't be possible to call Statement.isClosed() which only exists in JDBC4.

Again, thank you, and sorry for the commotion.


On Wed, Jan 15, 2014 at 2:42 AM, Lachezar Dobrev <l.dobrev@gmail.com> wrote:
Did you by chance include the PostgreSQL JDBC Driver with your application?

The stack trace shows that the call passes through a Proxy class in
some kind of cache. It seems to be Glassfish, which version?

And did you try with a newer version of the JDBC Driver? 902 is a
pinch older than the latest for 9.1 which is 903.

Also note, that JDBC 4 is noted as incomplete.

Also which JDBC version driver are you using? Which Java version?

2014/1/14 Pawel Veselov <pawel.veselov@gmail.com>:
> Hi.
>
> I'm getting an abstract method error problem with Postgres JDBC (top of
> exception trace:http://pastebin.com/xsDKSdiE). There isn't a stable way to
> reproduce this that I found. The driver is 9.1-902.
>
> I don't quite understand how this can even happen. Looks like all the all
> statement object are created by the connection object, and all connection
> objects are created by the Driver. Driver always creates connection version
> 4, and that connection always creates statements version 4, so it should
> always implement isClosed(). I never ever used any earlier drivers (so I
> don't think there is C/P mess up, but I grepped my class path too).
>
> Can anything else ever create a connection object, which can be of earlier
> version?
>
> Thank you.

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Lachezar Dobrev
Дата:
Сообщение: Re: How can this abstract method error happen?
Следующее
От: Jeremy Whiting
Дата:
Сообщение: Performance improvement proposal. Removal of toLowerCase calls.