You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Martin Gainty <mg...@hotmail.com> on 2009/05/20 01:58:26 UTC

RE: JSON plugin class loading problem? (Part Deux)

something else
com.opensymphony.webwork.dispatcher.json.JsonObject

     * For example, if an object has a method named <code>"getName"</code>, and
     * if the result of calling <code>object.getName()</code> is <code>"Larry Fine"</code>,
     * then the JSONObject will contain <code>"name": "Larry Fine"</code>.
     *
     * @param bean An object that has getter methods that should be used
     * to make a JSONObject.
     */
    public JSONObject(Object bean) {

the question is getJsonResult created to produce this JSON output?
{"jsonResult":{"trustResources":[{"displayName":"Bull Trout","id":301}]}}
?
Martin 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




From: mgainty@hotmail.com
To: user@struts.apache.org
Subject: RE: JSON plugin class loading problem?
Date: Tue, 19 May 2009 18:35:08 -0400








Jim-
  /**
     * Generates the key to store the bean in the session with.
     */
    private void updateBeanKey() {
        if (this.sessionKey == null) {
            final StringBuffer buff = new StringBuffer();

            buff.append(this.getClass().getName()); //WHAT iS THE CLASSNAME doing here!
            buff.append("_");
            buff.append(this.getTargetBeanName());

            this.compiledSessionKey = buff.toString();
        }
        else {
            this.compiledSessionKey = this.sessionKey;
        }
    }

later on in getTarget
//the mucked value is set to beanKey
            String beanKey = this.compiledSessionKey;

            Object instance = session.get(beanKey);
            if (instance == null) {
                instance = this.newPrototypeInstance();
//too late now its stored in session!
                session.put(beanKey, instance);

                if (LOG.isDebugEnabled()) {
                    LOG.debug("Created instance of '" + this.getTargetBeanName() + "', bound to webWorkSession for '" 
                       + Thread.currentThread().getName() + "' using key '" + beanKey + "'.");
                }
            }
            else if (LOG.isDebugEnabled()) {
                LOG.debug("Found instance of '" + this.getTargetBeanName() + "', bound to webWorkSession for '" 
                       + Thread.currentThread().getName() + "' using key '" + beanKey + "'.");
            }

            return instance;
        }
http://www.opensymphony.com/webwork/wikidocs/Spring%20Session%20Components%20Workarounds.html

I will put this into WebWork JIRA

Good Catch!
Martin Gainty
______________________________________________ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 Ez az
üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
készítése nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és
semmiféle jogi alkalmazhatósága sincs.  Mivel az electronikus üzenetek
könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
ezen üzenet tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> To: user@struts.apache.org
> Subject: JSON plugin class loading problem?
> From: Jim_Greuel@fws.gov
> Date: Tue, 19 May 2009 12:26:27 -0600
> 
> I am using version 0.32 of the JSON plugin with Struts 2.0.11.  It seems 
> to work well except for the fact that the JSON results from my struts 
> action are inconsistent.
> I have annotated my action as follows:
> 
> @Results( {
>         @Result(name = "jsonPopsResult", type = JSONResult.class, value = 
> "", params = {"root", "jsonResult", "noCache", "true"}),
>         @Result(name = "jsonRefugesResult", type = JSONResult.class, value 
> = "", params = {"root", "jsonResult", "noCache", "true"})})
> public class MapQueryAction extends ActionSupport {
> ...
> }
> 
> Sometimes the response generated by the action is (for example)
> 
>         {"trustResources":[{"displayName":"Bull Trout","id":301}]}
> 
> at other times it is
> 
>         {"jsonResult":{"trustResources":[{"displayName":"Bull 
> Trout","id":301}]}}
> 
> Note that the second response has an outer level of wrapping that 
> corresponds to the root parameter in the annotation (the action property 
> to be serialized).
> 
> I think (though am not 100% positive) that the change in behavior happens 
> when I restart my tomcat container, so this smells strongly of a class 
> loading problem.  I've looked for duplicate jars/classes, but have come up 
> empty.  In particular, I have only one json-plugin jar 
> (json-plugin-0.32.jar) in my application's WEB-INF/lib directory.  Has 
> anyone else experienced this kind of problem with the JSON plugin?
> 
> Thanks,
> Jim Greuel

Windows Live™: Keep your life in sync. Check it out.
_________________________________________________________________
Windows Live™: Keep your life in sync.
http://windowslive.com/explore?ocid=TXT_TAGLM_BR_life_in_synch_052009

Re: JSON plugin class loading problem? (Part Deux)

Posted by Musachy Barroso <mu...@gmail.com>.
The OP stated that he is using the JSON plugin, v32, which is this
Struts 2 plugin: http://cwiki.apache.org/S2PLUGINS/json-plugin.html,
not related to xwork in anyway.

musachy

On Tue, May 19, 2009 at 7:58 PM, Martin Gainty <mg...@hotmail.com> wrote:
>
> something else
> com.opensymphony.webwork.dispatcher.json.JsonObject
>
>     * For example, if an object has a method named <code>"getName"</code>, and
>     * if the result of calling <code>object.getName()</code> is <code>"Larry Fine"</code>,
>     * then the JSONObject will contain <code>"name": "Larry Fine"</code>.
>     *
>     * @param bean An object that has getter methods that should be used
>     * to make a JSONObject.
>     */
>    public JSONObject(Object bean) {
>
> the question is getJsonResult created to produce this JSON output?
> {"jsonResult":{"trustResources":[{"displayName":"Bull Trout","id":301}]}}
> ?
> Martin
> ______________________________________________
> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.
>
>
>
>
> From: mgainty@hotmail.com
> To: user@struts.apache.org
> Subject: RE: JSON plugin class loading problem?
> Date: Tue, 19 May 2009 18:35:08 -0400
>
>
>
>
>
>
>
>
> Jim-
>  /**
>     * Generates the key to store the bean in the session with.
>     */
>    private void updateBeanKey() {
>        if (this.sessionKey == null) {
>            final StringBuffer buff = new StringBuffer();
>
>            buff.append(this.getClass().getName()); //WHAT iS THE CLASSNAME doing here!
>            buff.append("_");
>            buff.append(this.getTargetBeanName());
>
>            this.compiledSessionKey = buff.toString();
>        }
>        else {
>            this.compiledSessionKey = this.sessionKey;
>        }
>    }
>
> later on in getTarget
> //the mucked value is set to beanKey
>            String beanKey = this.compiledSessionKey;
>
>            Object instance = session.get(beanKey);
>            if (instance == null) {
>                instance = this.newPrototypeInstance();
> //too late now its stored in session!
>                session.put(beanKey, instance);
>
>                if (LOG.isDebugEnabled()) {
>                    LOG.debug("Created instance of '" + this.getTargetBeanName() + "', bound to webWorkSession for '"
>                       + Thread.currentThread().getName() + "' using key '" + beanKey + "'.");
>                }
>            }
>            else if (LOG.isDebugEnabled()) {
>                LOG.debug("Found instance of '" + this.getTargetBeanName() + "', bound to webWorkSession for '"
>                       + Thread.currentThread().getName() + "' using key '" + beanKey + "'.");
>            }
>
>            return instance;
>        }
> http://www.opensymphony.com/webwork/wikidocs/Spring%20Session%20Components%20Workarounds.html
>
> I will put this into WebWork JIRA
>
> Good Catch!
> Martin Gainty
> ______________________________________________
> Jogi és Bizalmassági kinyilatkoztatás/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>  Ez az
> üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
> jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
> készítése nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és
> semmiféle jogi alkalmazhatósága sincs.  Mivel az electronikus üzenetek
> könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
> ezen üzenet tartalma miatt.
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.
>
>
>
>
>> To: user@struts.apache.org
>> Subject: JSON plugin class loading problem?
>> From: Jim_Greuel@fws.gov
>> Date: Tue, 19 May 2009 12:26:27 -0600
>>
>> I am using version 0.32 of the JSON plugin with Struts 2.0.11.  It seems
>> to work well except for the fact that the JSON results from my struts
>> action are inconsistent.
>> I have annotated my action as follows:
>>
>> @Results( {
>>         @Result(name = "jsonPopsResult", type = JSONResult.class, value =
>> "", params = {"root", "jsonResult", "noCache", "true"}),
>>         @Result(name = "jsonRefugesResult", type = JSONResult.class, value
>> = "", params = {"root", "jsonResult", "noCache", "true"})})
>> public class MapQueryAction extends ActionSupport {
>> ...
>> }
>>
>> Sometimes the response generated by the action is (for example)
>>
>>         {"trustResources":[{"displayName":"Bull Trout","id":301}]}
>>
>> at other times it is
>>
>>         {"jsonResult":{"trustResources":[{"displayName":"Bull
>> Trout","id":301}]}}
>>
>> Note that the second response has an outer level of wrapping that
>> corresponds to the root parameter in the annotation (the action property
>> to be serialized).
>>
>> I think (though am not 100% positive) that the change in behavior happens
>> when I restart my tomcat container, so this smells strongly of a class
>> loading problem.  I've looked for duplicate jars/classes, but have come up
>> empty.  In particular, I have only one json-plugin jar
>> (json-plugin-0.32.jar) in my application's WEB-INF/lib directory.  Has
>> anyone else experienced this kind of problem with the JSON plugin?
>>
>> Thanks,
>> Jim Greuel
>
> Windows Live™: Keep your life in sync. Check it out.
> _________________________________________________________________
> Windows Live™: Keep your life in sync.
> http://windowslive.com/explore?ocid=TXT_TAGLM_BR_life_in_synch_052009



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


RE: JSON plugin class loading problem? (Part Deux)

Posted by Martin Gainty <mg...@hotmail.com>.
he must be passing in JSONResult in one of the params to Action
can we see web.xml struts.xml and struts-default.xml
and struts-config.xml
please display ALL xml files for your project

thanks,
Martin Gainty 
______________________________________________ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 Ez az
üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
készítése nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és
semmiféle jogi alkalmazhatósága sincs.  Mivel az electronikus üzenetek
könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
ezen üzenet tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> From: mgainty@hotmail.com
> To: user@struts.apache.org
> Subject: RE: JSON plugin class loading problem? (Part Deux)
> Date: Tue, 19 May 2009 19:58:26 -0400
> 
> 
> something else
> com.opensymphony.webwork.dispatcher.json.JsonObject
> 
>      * For example, if an object has a method named <code>"getName"</code>, and
>      * if the result of calling <code>object.getName()</code> is <code>"Larry Fine"</code>,
>      * then the JSONObject will contain <code>"name": "Larry Fine"</code>.
>      *
>      * @param bean An object that has getter methods that should be used
>      * to make a JSONObject.
>      */
>     public JSONObject(Object bean) {
> 
> the question is getJsonResult created to produce this JSON output?
> {"jsonResult":{"trustResources":[{"displayName":"Bull Trout","id":301}]}}
> ?
> Martin 
> ______________________________________________ 
> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>  
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.
> 
> 
> 
> 
> From: mgainty@hotmail.com
> To: user@struts.apache.org
> Subject: RE: JSON plugin class loading problem?
> Date: Tue, 19 May 2009 18:35:08 -0400
> 
> 
> 
> 
> 
> 
> 
> 
> Jim-
>   /**
>      * Generates the key to store the bean in the session with.
>      */
>     private void updateBeanKey() {
>         if (this.sessionKey == null) {
>             final StringBuffer buff = new StringBuffer();
> 
>             buff.append(this.getClass().getName()); //WHAT iS THE CLASSNAME doing here!
>             buff.append("_");
>             buff.append(this.getTargetBeanName());
> 
>             this.compiledSessionKey = buff.toString();
>         }
>         else {
>             this.compiledSessionKey = this.sessionKey;
>         }
>     }
> 
> later on in getTarget
> //the mucked value is set to beanKey
>             String beanKey = this.compiledSessionKey;
> 
>             Object instance = session.get(beanKey);
>             if (instance == null) {
>                 instance = this.newPrototypeInstance();
> //too late now its stored in session!
>                 session.put(beanKey, instance);
> 
>                 if (LOG.isDebugEnabled()) {
>                     LOG.debug("Created instance of '" + this.getTargetBeanName() + "', bound to webWorkSession for '" 
>                        + Thread.currentThread().getName() + "' using key '" + beanKey + "'.");
>                 }
>             }
>             else if (LOG.isDebugEnabled()) {
>                 LOG.debug("Found instance of '" + this.getTargetBeanName() + "', bound to webWorkSession for '" 
>                        + Thread.currentThread().getName() + "' using key '" + beanKey + "'.");
>             }
> 
>             return instance;
>         }
> http://www.opensymphony.com/webwork/wikidocs/Spring%20Session%20Components%20Workarounds.html
> 
> I will put this into WebWork JIRA
> 
> Good Catch!
> Martin Gainty
> ______________________________________________ 
> Jogi és Bizalmassági kinyilatkoztatás/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>  Ez az
> üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
> jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
> készítése nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és
> semmiféle jogi alkalmazhatósága sincs.  Mivel az electronikus üzenetek
> könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
> ezen üzenet tartalma miatt.
> 
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.
> 
> 
> 
> 
> > To: user@struts.apache.org
> > Subject: JSON plugin class loading problem?
> > From: Jim_Greuel@fws.gov
> > Date: Tue, 19 May 2009 12:26:27 -0600
> > 
> > I am using version 0.32 of the JSON plugin with Struts 2.0.11.  It seems 
> > to work well except for the fact that the JSON results from my struts 
> > action are inconsistent.
> > I have annotated my action as follows:
> > 
> > @Results( {
> >         @Result(name = "jsonPopsResult", type = JSONResult.class, value = 
> > "", params = {"root", "jsonResult", "noCache", "true"}),
> >         @Result(name = "jsonRefugesResult", type = JSONResult.class, value 
> > = "", params = {"root", "jsonResult", "noCache", "true"})})
> > public class MapQueryAction extends ActionSupport {
> > ...
> > }
> > 
> > Sometimes the response generated by the action is (for example)
> > 
> >         {"trustResources":[{"displayName":"Bull Trout","id":301}]}
> > 
> > at other times it is
> > 
> >         {"jsonResult":{"trustResources":[{"displayName":"Bull 
> > Trout","id":301}]}}
> > 
> > Note that the second response has an outer level of wrapping that 
> > corresponds to the root parameter in the annotation (the action property 
> > to be serialized).
> > 
> > I think (though am not 100% positive) that the change in behavior happens 
> > when I restart my tomcat container, so this smells strongly of a class 
> > loading problem.  I've looked for duplicate jars/classes, but have come up 
> > empty.  In particular, I have only one json-plugin jar 
> > (json-plugin-0.32.jar) in my application's WEB-INF/lib directory.  Has 
> > anyone else experienced this kind of problem with the JSON plugin?
> > 
> > Thanks,
> > Jim Greuel
> 
> Windows Live™: Keep your life in sync. Check it out.
> _________________________________________________________________
> Windows Live™: Keep your life in sync.
> http://windowslive.com/explore?ocid=TXT_TAGLM_BR_life_in_synch_052009

_________________________________________________________________
Windows Live™: Keep your life in sync.
http://windowslive.com/explore?ocid=TXT_TAGLM_BR_life_in_synch_052009