"org.postgresql.jdbc4.Jdbc4PreparedStatement.setQueryTimeout(int) is not yet implemented." Problem

1,078 views
Skip to first unread message

Lu Ying

unread,
Dec 1, 2010, 4:41:05 PM12/1/10
to mybatis-user
Good afternoon,

Does anyone know what may cause this problem?

org.postgresql.jdbc4.Jdbc4PreparedStatement.setQueryTimeout(int) is
not yet implemented.

Thanks a lot !
Lu Ying

--
Using:
. postgresql-8.4-701.jdbc4.jar
. mybatis-spring-1.0.0-RC3
. mybatis-3.0.3
. spring-framework-3.0.5.RELEASE


. Spring configuration file:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

<bean id="placeholderConfig"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name = "location">
<value>WEB-INF/properties/jdbc.properties</value>
</property>

<property name = "systemPropertiesModeName">
<value>SYSTEM_PROPERTIES_MODE_OVERRIDE</value>
</property>
</bean>

<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource" destroy-
method="close">
<property name="driverClassName" value="${driverClassName}" />
<property name="url" value="${url}" />
<property name="username" value="${username}" />
<property name="password" value="${password}" />
</bean>


<bean id="sqlSessionFactory"
class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value ="WEB-INF/classes/
config.xml" />
</bean>

</beans>

Guy Rouillier

unread,
Dec 1, 2010, 7:46:07 PM12/1/10
to mybati...@googlegroups.com
On 12/1/2010 4:41 PM, Lu Ying wrote:
> Good afternoon,
>
> Does anyone know what may cause this problem?
>
> org.postgresql.jdbc4.Jdbc4PreparedStatement.setQueryTimeout(int) is
> not yet implemented.

Error message seems pretty self-explanatory. You are calling a method
that is not yet implemented. I see the following statement on the
PgJDBC project page http://jdbc.postgresql.org/download.html:

"JDK 1.6 - JDBC4. Support for JDBC4 methods is limited. The driver
builds, but the several of the new methods are stubbed out."

Looks like you encountered one of the ones that is stubbed out.

--
Guy Rouillier

Emi Lu

unread,
Dec 2, 2010, 10:18:52 AM12/2/10
to mybati...@googlegroups.com, Guy Rouillier
>> Does anyone know what may cause this problem?
>>
>> org.postgresql.jdbc4.Jdbc4PreparedStatement.setQueryTimeout(int) is
>> not yet implemented.
>
> Error message seems pretty self-explanatory. You are calling a method
> that is not yet implemented. I see the following statement on the PgJDBC
> project page http://jdbc.postgresql.org/download.html:


> "JDK 1.6 - JDBC4. Support for JDBC4 methods is limited. The driver
> builds, but the several of the new methods are stubbed out."
>
> Looks like you encountered one of the ones that is stubbed out.

Thank you for the answer Guy!

For JDK1.6, postgresql8.3, struts2, mybatis3, do you know how to fix
this problem?

Would "JDBC3 Postgresql Driver, Version 9.0-801" fixed the problem?

Thank you,
--
Lu Ying

Emi Lu

unread,
Dec 2, 2010, 11:13:28 AM12/2/10
to mybati...@googlegroups.com
Good morning List,

In spring-config.xml:

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">

I think JDBC4 does not support DBCP?

Do you suggest other spring dataSource that is support by MyBatis please?

In mybatis doc, it does not provide dataSource types/choices that users
can use.

Only specify "<bean id="sqlSessionFactory"

class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />

</bean>" is not good enough.

I would like to know the adv/disadvantages of
<bean id="dataSource" class="1, 2.3...">

It is exactly, id="dataSource" caused the problem I think.

Any suggestions?

Thank you,
Lu Ying

Emi Lu

unread,
Dec 2, 2010, 2:16:08 PM12/2/10
to mybati...@googlegroups.com
Hello List,

I got "java.lang.NoClassDefFoundError:
net/sf/cglib/proxy/MethodInterceptor" Error!

. Spring3.05
. mybatis-spring-1.0.0-RC3
. Struts2
. mybatis3

Could someone help please?

Thank you,
--
Lu Ying

java.lang.NoClassDefFoundError: net/sf/cglib/proxy/MethodInterceptor at
java.lang.ClassLoader.defineClass1(Native Method) at
java.lang.ClassLoader.defineClassCond(ClassLoader.java:632) at
java.lang.ClassLoader.defineClass(ClassLoader.java:616) at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2527)
at
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1010)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1483)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
at
org.apache.ibatis.executor.loader.ResultObjectProxy.createProxy(ResultObjectProxy.java:22)
at
org.apache.ibatis.executor.resultset.FastResultSetHandler.createResultObject(FastResultSetHandler.java:288)
at
org.apache.ibatis.executor.resultset.FastResultSetHandler.getRowValue(FastResultSetHandler.java:188)
at
org.apache.ibatis.executor.resultset.FastResultSetHandler.handleRowValues(FastResultSetHandler.java:145)
at
org.apache.ibatis.executor.resultset.FastResultSetHandler.handleResultSet(FastResultSetHandler.java:121)
at
org.apache.ibatis.executor.resultset.FastResultSetHandler.handleResultSets(FastResultSetHandler.java:98)
at
org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:40)
at
org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:55)
at
org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:41) at
org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:216)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:95)
at
org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:72) at
org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:75)
at
org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:69)
at
org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:40)
at Source) at Source) ... 69 more Caused by:
java.lang.ClassNotFoundException: net.sf.cglib.proxy.MethodInterceptor
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
... 94 more

Simone Tripodi

unread,
Dec 2, 2010, 2:55:42 PM12/2/10
to mybati...@googlegroups.com
Ni Hao!
please make suce the cglib.jar is in the classpath, it should fix that
issue; if you're using apache maven, add the following dependency:

<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.1_3</version>
</dependency>

Hope this helps!
Zai jihan,
Simo

http://people.apache.org/~simonetripodi/
http://www.99soft.org/

Emi Lu

unread,
Dec 2, 2010, 4:14:05 PM12/2/10
to mybati...@googlegroups.com, simone....@gmail.com
Ni Hao!

> please make suce the cglib.jar is in the classpath, it should fix that
> issue; if you're using apache maven, add the following dependency:
>
> <dependency>
> <groupId>cglib</groupId>
> <artifactId>cglib</artifactId>
> <version>2.1_3</version>
> </dependency>

I added cglib.jar and asm.jar. It seems that fixes the problem.

Thank you!
Lu Ying

Guy Rouillier

unread,
Dec 2, 2010, 4:25:46 PM12/2/10
to mybati...@googlegroups.com

Well, the site says to use the JDBC4 driver if you are using JDK 1.6.
Does the message you identify cause your app to fail? That message
sounds like it is just informational; failure to set the query timeout
should not be a critical failure.

If this issue does stop your app from working, I'd suggest asking for
help on the PostgreSQL forums. This would be a driver issue and really
outside of domain of MyBatis.

--
Guy Rouillier

Emi Lu

unread,
Dec 2, 2010, 5:08:20 PM12/2/10
to mybati...@googlegroups.com
Hello List,

A question about <foreach> tag.

JAVA code: String[] check_array_values


xml code:

<if test="check_array_values != null and check_array_values.length>0 ">
columnX::VARCHAR IN
<foreach item="item" index="index" collection="check_array_values"
open="(" separator="," close=")">
#{item}
</foreach>
</if>

I always got an error! Could someone tell me where I put wrong please?

. Does collection accept String[]?
. item = "item" is just a free name right?

Any grammar wrong?

Thank you,
Lu Ying

Simone Tripodi

unread,
Dec 3, 2010, 12:12:45 PM12/3/10
to mybati...@googlegroups.com

haq

unread,
Dec 27, 2010, 10:14:36 AM12/27/10
to mybatis-user
I encountered the same problem. the exception causes my program to
stop. If postgres does not have a jdbc driver implementing this
method, how can I get around this problem with myBatis?

On Dec 2, 4:25 pm, Guy Rouillier <g...@burntmail.com> wrote:
> On 12/2/2010 10:18 AM, Emi Lu wrote:
>
>
>
> >>> Does anyone know what may cause this problem?
>
> >>> org.postgresql.jdbc4.Jdbc4PreparedStatement.setQueryTimeout(int) is
> >>> not yet implemented.
>
> >> Error message seems pretty self-explanatory. You are calling a method
> >> that is not yet implemented. I see the following statement on the PgJDBC
> >> project pagehttp://jdbc.postgresql.org/download.html:

Guy Rouillier

unread,
Dec 28, 2010, 12:30:26 AM12/28/10
to mybati...@googlegroups.com
On 12/27/2010 10:14 AM, haq wrote:
> I encountered the same problem. the exception causes my program to
> stop. If postgres does not have a jdbc driver implementing this
> method, how can I get around this problem with myBatis?

Would someone please provide some sample code that causes this error? I
do not encounter it running the mybatis_contact_manager sample.

--
Guy Rouillier

Larry Meadors

unread,
Dec 28, 2010, 10:14:39 AM12/28/10
to mybati...@googlegroups.com
I've not had this happen either.

What driver are you using? I'm at 8.4-701 (according to maven).

Larry

Andrew Qiu

unread,
Dec 28, 2010, 10:38:52 AM12/28/10
to mybati...@googlegroups.com
I am using postgresql-8.4-701.jdbc4.jar, with mybatis-3.0.4-SNAPSHOT.jar


Here is the partial junit test trace:

org.apache.ibatis.exceptions.PersistenceException:
### Error updating database.  Cause: org.postgresql.util.PSQLException: Method org.postgresql.jdbc4.Jdbc4PreparedStatement.setQueryTimeout(int) is not yet implemented.
### The error may exist in com/axiomainc/db/AssetMapper.xml
### The error may involve com.axiomainc.db.AssetMapper.insert
### The error occurred while executing an update
### SQL: insert into asset values (?, ?,  (select asset_type_id from asset_type  where asset_type.name_key = UPPER(?) ),    ?, ?)
### Cause: org.postgresql.util.PSQLException: Method org.postgresql.jdbc4.Jdbc4PreparedStatement.setQueryTimeout(int) is not yet implemented.
    at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:8)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:120)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:107)
    at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:56)
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:35)
    at $Proxy5.insert(Unknown Source)

Nathan Maves

unread,
Dec 28, 2010, 11:05:21 AM12/28/10
to mybati...@googlegroups.com
we are going to need to see more than that. send us your configuration.

Larry Meadors

unread,
Dec 28, 2010, 12:00:00 PM12/28/10
to mybati...@googlegroups.com
Are you setting a timeout on that statement?

On Tue, Dec 28, 2010 at 8:38 AM, Andrew Qiu <andrewh...@gmail.com> wrote:

Andrew Qiu

unread,
Dec 28, 2010, 4:28:19 PM12/28/10
to mybati...@googlegroups.com
I do not explicitly set the timeout, but here is what is from my configuration.xml:

<configuration>

  <settings>
    <setting name="cacheEnabled" value="true"/>
    <setting name="lazyLoadingEnabled" value="false"/>
    <setting name="multipleResultSetsEnabled" value="true"/>
    <setting name="useColumnLabel" value="true"/>
    <setting name="useGeneratedKeys" value="false"/>
    <setting name="defaultExecutorType" value="SIMPLE"/>
    <setting name="defaultStatementTimeout" value="25000"/>
  </settings>


could this be the reason?

Richard Yee

unread,
Dec 28, 2010, 5:02:15 PM12/28/10
to mybati...@googlegroups.com
Take out "<setting name="defaultStatementTimeout" value="25000"/>" and try it.

-Richard

Larry Meadors

unread,
Dec 28, 2010, 5:12:42 PM12/28/10
to mybati...@googlegroups.com
Well, I'd remove <setting name="defaultStatementTimeout"
value="25000"/>, because your driver doesn't support it. :)

There's not really much we can do with mybatis to deal with this any better.

It's a driver issue, so changing the framework because a driver throws
an exception (inappropriately, IMO) seems like a bad idea.

Larry

Andrew Qiu

unread,
Dec 29, 2010, 10:28:19 AM12/29/10
to mybati...@googlegroups.com
that worked! Thanks!
Reply all
Reply to author
Forward
0 new messages