struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Orme <to...@genome.med.harvard.edu>
Subject Re: Struts 2/JSON/Hibernate/c3p0/Oracle issue
Date Mon, 14 Dec 2009 21:25:32 GMT
Ill give this a whirl, and you're probably right, but this used to work 
while using DBCP. Any idea as to why this would be broken in c3p0? I 
tried to do some digging under the hood but couldn't find sources the 
classes that were breaking.

Thanks,
-Tim

Greg Lindholm wrote:
> Wild guess.... you are trying to serialize (with JSON plugin) a
> Hibernate proxy object.
> Maybe your object has a reference to another lazy loaded object or collection.
>
> Using reflection on a proxy object is usually a bad idea.
>
> You may need to clone the object (to get a real one) first before
> serializing it with JSON.
>
>
> Greg
>
> On Mon, Dec 14, 2009 at 3:45 PM, Timothy Orme
> <torme@genome.med.harvard.edu> wrote:
>   
>> Hello,
>>
>>   I just recently switched to c3p0 and it fixed some other issues I was
>> having with dbcp, but another has arisen.
>>   It seems to be a combination of using the c3p0 data source along with the
>> JSON plugin. Here's my (slightly shortened) stacktrace:
>>
>> Caused by: org.apache.struts2.json.JSONException:
>> org.apache.struts2.json.JSONException:
>> org.apache.struts2.json.JSONException:
>> java.lang.reflect.InvocationTargetException
>> at org.apache.struts2.json.JSONWriter.bean(JSONWriter.java:243)
>> at org.apache.struts2.json.JSONWriter.process(JSONWriter.java:165)
>> at org.apache.struts2.json.JSONWriter.value(JSONWriter.java:131)
>> at org.apache.struts2.json.JSONWriter.add(JSONWriter.java:329)
>> at org.apache.struts2.json.JSONWriter.bean(JSONWriter.java:228)
>> ... 91 more
>> Caused by: org.apache.struts2.json.JSONException:
>> org.apache.struts2.json.JSONException:
>> java.lang.reflect.InvocationTargetException
>> at org.apache.struts2.json.JSONWriter.bean(JSONWriter.java:243)
>> at org.apache.struts2.json.JSONWriter.process(JSONWriter.java:165)
>> at org.apache.struts2.json.JSONWriter.value(JSONWriter.java:131)
>> at org.apache.struts2.json.JSONWriter.add(JSONWriter.java:329)
>> at org.apache.struts2.json.JSONWriter.bean(JSONWriter.java:228)
>> ... 95 more
>> Caused by: org.apache.struts2.json.JSONException:
>> java.lang.reflect.InvocationTargetException
>> at org.apache.struts2.json.JSONWriter.bean(JSONWriter.java:243)
>> at org.apache.struts2.json.JSONWriter.process(JSONWriter.java:165)
>> at org.apache.struts2.json.JSONWriter.value(JSONWriter.java:131)
>> at org.apache.struts2.json.JSONWriter.add(JSONWriter.java:329)
>> at org.apache.struts2.json.JSONWriter.bean(JSONWriter.java:228)
>> ... 99 more
>> Caused by: java.lang.reflect.InvocationTargetException
>> 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.apache.struts2.json.JSONWriter.bean(JSONWriter.java:227)
>> ... 103 more
>> Caused by: java.sql.SQLException: Unsupported feature: getCursorName
>> at
>> oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
>> at
>> oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
>> at oracle.jdbc.driver.BaseResultSet.getCursorName(BaseResultSet.java:37)
>> at
>> com.mchange.v2.c3p0.impl.NewProxyResultSet.getCursorName(NewProxyResultSet.java:545)
>> ... 108 more
>>
>> I'm runing c3p0-0.9.1.2, struts 2.1.8.1 and its corresponding json plugin,
>> Oracle 10, and Hibernate 3.3.1.GA
>>
>> Heres my datasource in spring. Just using the defaults:
>>
>>   <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
>>       <property name="driverClass" value="${database.driver}" />
>>       <property name="jdbcUrl" value="${database.connectionString}" />
>>       <property name="user" value="${database.username}" />
>>       <property name="password" value="${database.password}" />
>>   </bean>
>>
>> Should note that other pages seem to work fine and lazy load as well. Just
>> this json action is giving me problems. If you need more info let me know.
>>
>> Thanks!
>> -Tim
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message