Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

user Digest 15 Dec 2009 02:57:24 -0000 Issue 8960

user-digest-help

2009-12-14


Author LoginPost Reply

user Digest 15 Dec 2009 02:57:24 -0000 Issue 8960

Topics (messages 204231 through 204257):

Re: "specified DSN contains an architecture mismatch"
 204231 by: Todd Grigsby

Re: ognl method lookup failure
 204232 by: Dale Newfield

MySQL + JDBC
 204233 by: Todd Grigsby
 204237 by: Neil Aggarwal
 204244 by: Todd Grigsby
 204245 by: Todd Grigsby
 204246 by: Manos Batsis
 204247 by: Todd Grigsby
 204249 by: Gabriel Belingueres
 204254 by: Neil Aggarwal
 204256 by: Todd Grigsby
 204257 by: Todd Grigsby

unicode character is in wrong format
 204234 by: Nguyen Xuan Son
 204235 by: Nguyen Xuan Son
 204236 by: Nguyen Xuan Son
 204239 by: Paul Benedict
 204255 by: Alex Siman

Questions about struts dev mode.
 204238 by: Gustavo Felisberto

Essential Dependencies Only
 204240 by: stanlick
 204243 by: Wes Wannemacher

File I/O in Struts 1.2.x
 204241 by: davargas123
 204242 by: Oscar

Struts 2/JSON/Hibernate/c3p0/Oracle issue
 204248 by: Timothy Orme
 204250 by: Greg Lindholm
 204251 by: Timothy Orme
 204253 by: Timothy Orme

configuring json action
 204252 by: Milos Negovanovic

Administrivia:

---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)

----------------------------------------------------------------------


Attachment: user_204231.ezm (zipped)

The application runs on Oracle, MySQL, or SQL Server, depending on the
distro, and on various versions of these depending on the version and
type of OS. MySQL is our preferred database. We use JDBC to simplify
the connection process.

TG

Wes Wannemacher wrote:
> Why use odbc? Mysql has a top notch jdbc driver.
>
> On 12/11/09, Todd Grigsby <strutsuser@(protected):
>  
>> Yes, thank you, I know that. My question has to do with the
>> architecture mismatch. All the documentation I've seen on this
>> indicates that there is a 32-bit/64-bit issue, but I'll be darned if I
>> know which piece is at fault. Given the versions of the various parts,
>> does anyone have any idea what I need to do to be able to talk to MySQL?
>>
>> TG
>>
>> Martin Gainty wrote:
>>  
>>> you're using InitialContext to lookup a DataSource registered to JNDI
>>> registry
>>>
>>> Martin Gainty
>>>
>>>    
>>>>>  Context context = new InitialContext();
>>>>>  DataSource ds =
>>>>> (DataSource)context.lookup("java:/comp/env/jdbc/odbc/tgecorp");
>>>>>  Connection conn = datasource.getConnection();
>>>>>
>>>>> ...
>>>>>
>>>>> The last line throws an exception with the following message: "The
>>>>> specified DSN contains an architecture mismatch between the Driver and
>>>>> Application."
>>>>>
>>>>>      
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>>  
>
>
>  


Attachment: user_204232.ezm (zipped)
Musachy Barroso wrote:
> I would suggest to put a breakpoint in XWorkMethodAccessor.callMethod
> and see why it is not finding it.

Thanks for the nudge. I finally got a more detailed message ("Method
"isUserSubscribedViaBulletin" failed for object
mumble.model.CommunityClassified) which has as it's cause a
LazyInitializationException. Since I use the OpenSessionInViewFilter,
this must mean that there's something earlier in this action/view that's
breaking the session. I'm not sure of an obvious way to find this
earlier error, but at least now I know that this polymorphic code is not
breaking for one concrete class and not another, but rather simply
breaks for any concrete class if the hibernate session is no longer valid.

-Dale


Attachment: user_204233.ezm (zipped)

Let me simplify the question: Has anyone out there managed to create a
working connection to the latest version of MySQL 64-bit via JDBC from
Struts 2?

TG


Attachment: user_204237.ezm (zipped)
> Let me simplify the question: Has anyone out there managed to
> create a
> working connection to the latest version of MySQL 64-bit via
> JDBC from
> Struts 2?

I am sure many people have. I run 64 bit servers with MySQL
and Struts 2.

What are you seeing?

Neil

--
Neil Aggarwal, (281)846-8957, http://UnmeteredVPS.net
Host your Struts app on a CentOS VPS for only $25/month!
Unmetered bandwidth = no overage charges, 7 day free trial



Attachment: user_204244.ezm (zipped)

Fantastic! The error that I'm getting is,
"org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create
PoolableConnectionFactory ([Microsoft][ODBC Driver Manager] The
specified DSN contains an architecture mismatch between the Driver and
Application." Ever seen that?

TG

Neil Aggarwal wrote:
>> Let me simplify the question: Has anyone out there managed to
>> create a
>> working connection to the latest version of MySQL 64-bit via
>> JDBC from
>> Struts 2?
>>  
>
> I am sure many people have. I run 64 bit servers with MySQL
> and Struts 2.
>
> What are you seeing?
>
> Neil
>
> --
> Neil Aggarwal, (281)846-8957, http://UnmeteredVPS.net
> Host your Struts app on a CentOS VPS for only $25/month!
> Unmetered bandwidth = no overage charges, 7 day free trial
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
>  


Attachment: user_204245.ezm (zipped)


Oh, and a relevant follow-up question: do you use JDBC-ODBC to connect
to MySQL?

TG


Neil Aggarwal wrote:
>> Let me simplify the question: Has anyone out there managed to
>> create a
>> working connection to the latest version of MySQL 64-bit via
>> JDBC from
>> Struts 2?
>>  
>
> I am sure many people have. I run 64 bit servers with MySQL
> and Struts 2.
>
> What are you seeing?
>
> Neil
>
> --
> Neil Aggarwal, (281)846-8957, http://UnmeteredVPS.net
> Host your Struts app on a CentOS VPS for only $25/month!
> Unmetered bandwidth = no overage charges, 7 day free trial
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
>  


Attachment: user_204246.ezm (zipped)
Todd Grigsby wrote:
>
> Fantastic! The error that I'm getting is,
> "org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create
> PoolableConnectionFactory ([Microsoft][ODBC Driver Manager] The
> specified DSN contains an architecture mismatch between the Driver and
> Application." Ever seen that?


My guess is you are using a microsoft ODBC to JDBC driver or something?
Just use the JDBC drivers for MySQL. You can download those and get
docos from MySQL's website.

hth,

Manos


Attachment: user_204247.ezm (zipped)
Manos Batsis wrote:
> Todd Grigsby wrote:
>>
>> Fantastic! The error that I'm getting is,
>> "org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create
>> PoolableConnectionFactory ([Microsoft][ODBC Driver Manager] The
>> specified DSN contains an architecture mismatch between the Driver
>> and Application." Ever seen that?
> My guess is you are using a microsoft ODBC to JDBC driver or
> something? Just use the JDBC drivers for MySQL. You can download those
> and get docos from MySQL's website.

I would use the MySQL connector directly, but I need to use ODBC to
abstract the database connection. MySQL is not the only database we
connect to. The question is, is it possible to go MySQL -> ODBC -> JDBC
-> Struts 2? It was possible under Struts 1.1 on WinXP, and we are
attempting to migrate to Struts 2 (or trying to) on Win7 64-bit.

TG


Attachment: user_204249.ezm (zipped)
What do you mean by "I need to use ODBC to abstract the database connection."??

In most (all?) web containers I know about, there is a standard way of
abstract out the database connection and it is by declaring a
javax.sql.DataSource, which you can get it from JNDI (which is pretty
standard too.)
Declaring the datasource may be app server vendor dependent, but it is
the same mechanism for all database vendors (having a JDBC
drive)...you just declare the fully qualified driver class name, the
username, the password, the connection URL, and the JNDI name.

Also, going to configure an ODBC driver you get the extra complexity
of installing the right version for the OS...I remember a couple of
headaches trying to configure a 32-bit ODBC driver on a 64-bit win2003
server.

Gabriel

2009/12/14 Todd Grigsby <strutsuser@(protected)>:
> Manos Batsis wrote:
>>
>> Todd Grigsby wrote:
>>>
>>> Fantastic!  The error that I'm getting is,
>>> "org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create
>>> PoolableConnectionFactory ([Microsoft][ODBC Driver Manager] The specified
>>> DSN contains an architecture mismatch between the Driver and Application."
>>>  Ever seen that?
>>
>> My guess is you are using a microsoft ODBC to JDBC driver or something?
>> Just use the JDBC drivers for MySQL. You can download those and get docos
>> from MySQL's website.
>
> I would use the MySQL connector directly, but I need to use ODBC to abstract
> the database connection.  MySQL is not the only database we connect to.  The
> question is, is it possible to go MySQL -> ODBC -> JDBC -> Struts 2?  It was
> possible under Struts 1.1 on WinXP, and we are attempting to migrate to
> Struts 2 (or trying to) on Win7 64-bit.
>
> TG
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


Attachment: user_204254.ezm (zipped)
> Oh, and a relevant follow-up question: do you use JDBC-ODBC
> to connect
> to MySQL?

I never used ODBC to talk to MySQL. I am not sure how well
that would work.

Thanks,
 Neil

--
Neil Aggarwal, (281)846-8957, http://UnmeteredVPS.net
Host your MySQL database on a CentOS virtual server for $25/mo
Unmetered bandwidth = no overage charges, 7 day free trial



Attachment: user_204256.ezm (zipped)

Works great, Neil, thanks for asking.

TG


Neil Aggarwal wrote:
>> Oh, and a relevant follow-up question: do you use JDBC-ODBC
>> to connect
>> to MySQL?
>>  
>
> I never used ODBC to talk to MySQL. I am not sure how well
> that would work.
>
> Thanks,
>  Neil
>
> --
> Neil Aggarwal, (281)846-8957, http://UnmeteredVPS.net
> Host your MySQL database on a CentOS virtual server for $25/mo
> Unmetered bandwidth = no overage charges, 7 day free trial
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
>  


Attachment: user_204257.ezm (zipped)


Not that I wanted to get into a debate about the usefulness of ODBC, but
the Java-based web services we have aren't the only things that connect
to these databases, and going through ODBC has been, for the last 10
years, a very nice and consistent way to connect across all our
applications and utilities. We have, at one time or another, supported
all of the following:

  MySQL
  Oracle
  SQL Server
  Informix
  DB2
  mSQL
  Pervasive SQL
  MS Access (pre-Jet)

And a few others, and we have connected to these databases via ODBC all
along the way. Keeping the connection mechanism consistent has made
development work in a number of languages simple. So while I certainly
appreciate everyone's enthusiasm for talking directly to MySQL, I have a
legacy code base that works *REALLY* well through ODBC, and I'd like to
stick with it.

So one more time for the folks at home: Is there anyone out there who
has managed to get MySQL 64-bit to work via ODBC?

TG




Attachment: user_204234.ezm (zipped)
dear all
im using PreparedStatement.setNString(int, String)
to insert the japanese characters into my MySQL database
but the result is all in "?????????" characters

PreparedStatement pstmt = conn.prepareStatement(sql5);
pstmt.setNString(3, item.getTitle());
rs = pstmt.executeUpdate();

do you have any suggestion?

--
=======================================================================
Ritsumeikan University, Asia JinZai Project
Master of Information Science
Nguyen Xuan Son

Add     : Japan, Shiga-Ken, Kusatsu-Shi, Kasayama 3choume 1-18 ShiteiHaimu
Rien, Room 103
Tel/Fax : 81-(0)90-3976 2246
Email   : nr0003xx@(protected)
Mobile  : 81-(0)90-3976 2246       URL : http://www.ritsumei.jp
=======================================================================

Attachment: user_204235.ezm (zipped)
dear all
im using PreparedStatement.setNString(int, String)
to insert the japanese characters into my MySQL database
but the result is all in "?????????" characters

PreparedStatement pstmt = conn.prepareStatement(sql5);
pstmt.setNString(3, item.getTitle());
rs = pstmt.executeUpdate();

do you have any suggestion?

--
=======================================================================
Ritsumeikan University, Asia JinZai Project
Master of Information Science
Nguyen Xuan Son

Add     : Japan, Shiga-Ken, Kusatsu-Shi, Kasayama 3choume 1-18 ShiteiHaimu
Rien, Room 103
Tel/Fax : 81-(0)90-3976 2246
Email   : nr0003xx@(protected)
Mobile  : 81-(0)90-3976 2246       URL : http://www.ritsumei.jp
=======================================================================

Attachment: user_204236.ezm (zipped)
here is the detail of the error's message
java.lang.reflect.InvocationTargetException
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
com.opensymphony.xwork2.DefaultActionInvocation.invokeAction (DefaultActionInvocation.java:441)
com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly (DefaultActionInvocation.java:280)
com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:243)
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept (DefaultWorkflowInterceptor.java:165)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:237)
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept (ValidationInterceptor.java:252)
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept (AnnotationValidationInterceptor.java:68)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:237)

2009/12/14 Nguyen Xuan Son <yamacom@(protected)>

> dear all
> im using PreparedStatement.setNString(int, String)
> to insert the japanese characters into my MySQL database
> but the result is all in "?????????" characters
>
> PreparedStatement pstmt = conn.prepareStatement(sql5);
> pstmt.setNString(3, item.getTitle());
> rs = pstmt.executeUpdate();
>
> do you have any suggestion?
>
> --
> =======================================================================
> Ritsumeikan University, Asia JinZai Project
> Master of Information Science
> Nguyen Xuan Son
>
> Add     : Japan, Shiga-Ken, Kusatsu-Shi, Kasayama 3choume 1-18
> ShiteiHaimu Rien, Room 103
> Tel/Fax : 81-(0)90-3976 2246
> Email   : nr0003xx@(protected)
> Mobile  : 81-(0)90-3976 2246       URL : http://www.ritsumei.jp
> =======================================================================
>



--
=======================================================================
Ritsumeikan University, Asia JinZai Project
Master of Information Science
Nguyen Xuan Son

Add     : Japan, Shiga-Ken, Kusatsu-Shi, Kasayama 3choume 1-18 ShiteiHaimu
Rien, Room 103
Tel/Fax : 81-(0)90-3976 2246
Email   : nr0003xx@(protected)
Mobile  : 81-(0)90-3976 2246       URL : http://www.ritsumei.jp
=======================================================================

Attachment: user_204239.ezm (zipped)
Nguyen,

On 12/13/2009 11:04 PM, Nguyen Xuan Son wrote:
> dear all
> im using PreparedStatement.setNString(int, String)
> to insert the japanese characters into my MySQL database
> but the result is all in "?????????" characters
>
> PreparedStatement pstmt = conn.prepareStatement(sql5);
> pstmt.setNString(3, item.getTitle());
> rs = pstmt.executeUpdate();
>
> do you have any suggestion?
>

Most likely your (1) tables/columns are not using UTF-8 to store data
and (2) neither is your MySQL database connection.

Do a google search to learn how to store international characters in
MySQL and JDBC.

Paul


Attachment: user_204255.ezm (zipped)

Here is the best checklist for Java webdev + UTF-8
http://stackoverflow.com/questions/138948/how-to-get-utf-8-working-in-java-webapps

Nguyen Xuan Son-2 wrote:
>
> dear all
> im using PreparedStatement.setNString(int, String)
> to insert the japanese characters into my MySQL database
> but the result is all in "?????????" characters
>
> PreparedStatement pstmt = conn.prepareStatement(sql5);
> pstmt.setNString(3, item.getTitle());
> rs = pstmt.executeUpdate();
>
> do you have any suggestion?
>
> --
> =======================================================================
> Ritsumeikan University, Asia JinZai Project
> Master of Information Science
> Nguyen Xuan Son
>
> Add     : Japan, Shiga-Ken, Kusatsu-Shi, Kasayama 3choume 1-18
> ShiteiHaimu
> Rien, Room 103
> Tel/Fax : 81-(0)90-3976 2246
> Email   : nr0003xx@(protected)
> Mobile  : 81-(0)90-3976 2246       URL : http://www.ritsumei.jp
> =======================================================================
>
>

--
Sent from the Struts - User mailing list archive at Nabble.com.



Attachment: user_204238.ezm (zipped)
I have added devmode to my struts.xml:



<struts>

  <constant name="struts.devMode" value="true"/>

.

</struts>



If I go to a action that is not maped I get a very detailed error message.
But that is about it.

For example in a jsp I have:



<s:form action="ActsAdd" theme="simple">

          <s:actionerror/>

          <s:actionmessage/>

<s:radio list="denunceOtherId" name="denunceOtheIdTypes"/>

<s:textfield name="name"/>

</s:form>



But the action does not have any getter for the list. If I run the code in
the debugger I see some sort of error being generated, but nothing in the
page.



The other thing is that there is also no setName(String name) in the action.
And I get no information about the missing setter.



Am I missing something?



--

Gustavo Felisberto.

WIT-Software, Lda

Coimbra (Portugal), San Jose (California)

Phone: +351239801030

Web: <http://www.wit-software.com> http://www.wit-software.com




Attachment: user_204240.ezm (zipped)

Greetings and Happy Holidays --

I am sitting down to unwind the Essential Dependencies Only jar
(struts-2.1.8.1-lib.zip) in preparation for the litany of questions the
lawyers are going to ask before accepting the Struts 2.1.8.1 upgrade in
house. Now either I have a different understanding of the word essential,
or this version of our new Struts has really spread her arms. There are
seventy-one jars in the lib folder of the *essential dependencies only jar*
and a quick glance suggests they are *not* all essential. So does essential
!= core or required? Is there a resource where an analysis can be made to
determine compile, testing, run-time dependencies? Untangling this ball of
yarn by hand is going to burn up hours and lead an analyst down many rabbit
holes. Is there a POM that could save the man hours?

Peace,
Scott
--
Sent from the Struts - User mailing list archive at Nabble.com.



Attachment: user_204243.ezm (zipped)
Scott, take a look at the mailreader and blank apps. You can also read
through the struts2-core pom (annotated and easier to read here -
http://jarvana.com/jarvana/inspect-pom/org/apache/struts/struts2-core/2.1.8/struts2-core-2.1.8.pom,
that points to 2.1.8, they haven't indexed 2.1.8.1 yet, but there is
no differences in dependencies).

If you just want to cut to the chase, the "essentials" would be -

struts2-core 2.1.8.1
xwork-core 2.1.6
freemarker 2.3.15
ognl 2.7.3

-Wes

On Mon, Dec 14, 2009 at 10:36 AM, stanlick <stanlick@(protected):
>
> Greetings and Happy Holidays --
>
> I am sitting down to unwind the Essential Dependencies Only jar
> (struts-2.1.8.1-lib.zip) in preparation for the litany of questions the
> lawyers are going to ask before accepting the Struts 2.1.8.1 upgrade in
> house.  Now either I have a different understanding of the word essential,
> or this version of our new Struts has really spread her arms.  There are
> seventy-one jars in the lib folder of the *essential dependencies only jar*
> and a quick glance suggests they are *not* all essential.  So does essential
> != core or required?  Is there a resource where an analysis can be made to
> determine compile, testing, run-time dependencies?  Untangling this ball of
> yarn by hand is going to burn up hours and lead an analyst down many rabbit
> holes.  Is there a POM that could save the man hours?
>
> Peace,
> Scott
> --
> View this message in context: http://old.nabble.com/Essential-Dependencies-Only-tp26779724p26779724.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>



--
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!


Attachment: user_204241.ezm (zipped)

Is it possible to upload a file to a server, process the data as it needs to
be, and then write the file back to the local machine from which it
originally was uploaded all in a single execute method of a single action
class? Or, am I required to have an action for uploading it to the server,
and another for processing, and another for downloading, or something in
between?
--
Sent from the Struts - User mailing list archive at Nabble.com.



Attachment: user_204242.ezm (zipped)
I think that's possible. For example processing an excel file with POI, in
your form you choose the file, then submit form and in the action you
process the excel file with POI libraries, you edit the excel file with
something like adding rows or something like that, then you write the stream
of the excel file at the end of the method and returning null from your
action method, then it will appear in the form the dialog box to download
excel file. That's an example with an excel file, but i think that you can
do the process with another file type.

2009/12/14 davargas123 <davargas123@(protected)>

>
> Is it possible to upload a file to a server, process the data as it needs
> to
> be, and then write the file back to the local machine from which it
> originally was uploaded all in a single execute method of a single action
> class? Or, am I required to have an action for uploading it to the server,
> and another for processing, and another for downloading, or something in
> between?
> --
> View this message in context:
> http://old.nabble.com/File-I-O-in-Struts-1.2.x-tp26779909p26779909.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


--
Oscar

Attachment: user_204248.ezm (zipped)
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


Attachment: user_204250.ezm (zipped)
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@(protected):
> 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@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


Attachment: user_204251.ezm (zipped)
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@(protected):
>  
>> 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@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>>  
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>  


Attachment: user_204253.ezm (zipped)
So changing this around seems to correct it. I'm not sure why though, to
my knowledge it shouldn't have been using a proxy.

public class ChangeProcessAction {
  private StatusService statusService;
  private OrderService orderService;

  private Status status;
  private Integer orderId;
 
 
  public String execute() throws Exception {
     
    status = statusService.findByID("C");
    Order order = orderService.findById(orderId);
    order.setStatus(status);
    orderService.update(order);
   
    return SUCCESS;
  }
 

  public Status getStatus() {
    return status;
  }
}

Didn't work when serializing the Status object.

However:

public class ChangeProcessAction {
  private StatusService statusService;
  private OrderService orderService;

  private String statusName;
  private Integer orderId;
 
 
  public String execute() throws Exception {
   
    Status status;

    status = statusService.findByID("C");
    Order order = orderService.findById(orderId);
    order.setStatus(status);
    orderService.update(order);

    statusName = status.getName();
   
    return SUCCESS;
  }
 

  public String getStatusName() {
    return statusName;
  }
}


Works fine. Maybe I'm wrong, but shouldn't the status be the full object
and not a proxy when I do findById?

Thanks,
-Tim

Timothy Orme wrote:
> 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@(protected):
>>
>>> 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@(protected)
>>> For additional commands, e-mail: user-help@(protected)
>>>
>>>
>>>  
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>  
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>


Attachment: user_204252.ezm (zipped)
Hi,

I am trying to get JSON response from struts2 action.


My struts.xml contains the fallowing:

<struts>
<package name="example" extends="json-default">
  <action name="testjson" class="tutorial.example.JSONAction">
   <result type="json" />
  </action>
</package>
</struts>


Class JSONAction.java is empty at the moment:


package tutorial.example;


import com.opensymphony.xwork2.ActionSupport;


public class JSONAction extends ActionSupport {
  public String execute() throws Exception {
    //setMessage(getText(MESSAGE));
    return SUCCESS;
  }
}


When I try to access JSON action under
http://localhost:8080/tutorial/testjson URL I get the fallowing error
page:


Struts Problem Report

Struts has detected an unhandled exception:
# Messages:  There is no Action mapped for namespace / and action name testjson.


Any suggestions on how to make JSON action work?

Regards
--
Milos Negovanovic
milos.negovanovic@(protected)

©2008 gg3721.com - Jax Systems, LLC, U.S.A.