You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Baldur Norddahl <bb...@inaphone.com> on 2005/04/07 15:35:58 UTC
class cast exception
Hi,
In some of our projects we are haunted by a strange class cast
exception. I suspect it is a class loader issue. Just after restarting
the application server everything works fine, and it may continue to
work fine for hours or days. Until suddenly it stops working with this
kind of errors:
2005-04-07 14:39:15,564 [TP-Processor112] ERROR
com.ibatis.db.sqlmap.MappedStatement - Error executing
'getGameIdByContentId' in 'com/xentive/shopdb/webshop.xml'. Check the
Parameter Map (or inline parameters). Check the 'value' property.
Cause: java.lang.ClassCastException: java.lang.String
java.lang.ClassCastException: java.lang.String
at
com.ibatis.db.sqlmap.MappedStatement.runQueryForObject(Unknown Source)
at
com.ibatis.db.sqlmap.MappedStatement.executeQueryForObject(Unknown Source)
at
com.ibatis.db.sqlmap.MappedStatement.executeQueryForObject(Unknown Source)
at com.ibatis.db.sqlmap.SqlMap.executeQueryForObject(Unknown Source)
at com.xentive.shopdb.OrderHandler.doGet(OrderHandler.java:123)
The statement looks like this:
<mapped-statement name="getGameIdByContentId"
result-class="java.lang.String">
select game_id as value from webshop.game where id=#value#
</mapped-statement>
And the code that invokes it:
String gameId =
SqlConfig.webshop.executeQueryForObject("getGameIdByContentId",contentid.toString()).toString();
Restarting the application server always fixes the problem for a while.
Usually we can "fix" the problem applications by converting everything
to strings. That did not work in this case though.
We are using:
postgresql 7.4.3
tomcat 5.0.27
jdk 1.5.0
The datasource is a global shared pool:
<datasource
factory-class="com.ibatis.db.sqlmap.datasource.JndiDataSourceFactory"
name="webshop" default="true">
<property name="DBFullJndiContext" value="java:comp/env/jdbc/db"/>
</datasource>
I hope somebody got an idea for me how I can go about fixing this.
Thanks,
Baldur