On 20/01/2010, Memmesheimer, Christoph <[email protected]> wrote: > Additional Note: I tried to set a Variable with a BeanShell Script > (vars.put("TEST", "value123") and take it as input for a Java Request > Parameter in the GUI (name="blubb", value="${TEST}"). This works as long as > TEST holds a String Value - if you use an Object (vars.putObject) it will not > work anymore, instead the hole Java Request gets ignored by JMeter.
It won't be ignored, but perhaps it may fail to run, in which case there will be a message in the JMeter log file. > Am not sure if this is mentioned in the documentation ? But perhaps I > overlooked this one.. I expect there is a ClassCastException or similar happening here. JMeter variables are normally treated as Strings. You can save arbitrary objects in them, but then of course you need to treat them accordingly when retrieving them. > Thanks, > Christoph > > > -----Ursprüngliche Nachricht----- > Von: Memmesheimer, Christoph [mailto:[email protected]] > > Gesendet: Mittwoch, 20. Januar 2010 13:50 > > An: JMeter Users List > Betreff: AW: How to pass Objects between Java Samplers > > Addional Note: The workaround works only when a "user defined variable" with > "CODEVAR" is added to the threadgroup.. - don't ask me why. > > > -----Ursprüngliche Nachricht----- > Von: Memmesheimer, Christoph [mailto:[email protected]] > Gesendet: Mittwoch, 20. Januar 2010 13:26 > An: JMeter Users List > Betreff: AW: How to pass Objects between Java Samplers > > Hi, > well i want to test some EJBs and i want to share the JAAS Context for the > Java Requests.. but i could not find an example which shows how to fill a > jmeter variable from within a Java Request (only how to push the jmeter vars > as input parameter - with ${..}). > > Might it be correct that the most common way u can write values into jmeter > variables is to use beanshell scripts ? > > Well I searched the Java API for myself and tried to use the static methods > from JMeterContext to create new JMeter Vars.. it works.. but it doesn't feel > right :/ - is there a better way ? > > My Workaround: > _____________________________________ > Java Request 1 (write Var) > > org.apache.jmeter.threads.JMeterContext jmetercontext = > org.apache.jmeter.threads.JMeterContextService.getContext(); > JMeterVariables vars = jmetercontext.getVariables(); > int a = new Integer(1); > vars.putObject("CODEVAR", a); > jmetercontext.setVariables(vars); > > _____________________________________ > Java Request 2 (read Var) > > org.apache.jmeter.threads.JMeterContext jmetercontext = > org.apache.jmeter.threads.JMeterContextService.getContext(); > JMeterVariables vars = jmetercontext.getVariables(); > > Object a = vars.getObject("CODEVAR"); > System.out.println("CODEVAR class:" + a.getClass().getName()); > _____________________________________ > > -> tried to use CODEVAR as parameter for the Java Request 2 > JavaSamplerContext (with ${CODEVAR} in the GUI) but that doesn't work > > > @sebb: Should i use an other Sampler ? Thought this one would fit. > > Thanks & Regards, > Christoph > > -----Ursprüngliche Nachricht----- > Von: sebb [mailto:[email protected]] > Gesendet: Dienstag, 19. Januar 2010 17:59 > An: JMeter Users List > Betreff: Re: How to pass Objects between Java Samplers > > On 19/01/2010, Memmesheimer, Christoph <[email protected]> wrote: > > Hi, > > > > i am new to JMeter.. is it possible to pass Java Objects between Java > > Samplers ? > > > > (thought about sharing a Connection Object) > > Do you really mean Java Sampler as in: > > > http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Java_Request > > The provided Java samplers don't use Connection Objects. > > I suggest you have a look at all the other samplers, and read the > manual a few times to get a better feel for what JMeter is about. > > The standard way to pass items between samplers in the same thread is > to use a JMeter variable. These are normally Strings, but you can > store anything you like in them if you write the appropriate Java > code. > > > > > Thanks & Regards > > > > Christoph > > > > > > > > CENIT AG, Industriestrasse 52-54, 70565 Stuttgart, Tel.: +49 711 7825-30, > Fax: +49 711 7825-4000, Internet: www.cenit.de > > Geschaeftsstellen: Berlin, Duesseldorf, Frankfurt, Hamburg, Hannover, > Muenchen, Oelsnitz, Saarbruecken > > Vorstandsmitglieder: Kurt Bengel, Christian Pusch > > Aufsichtsratsmitglieder: Andreas Schmidt (Vorsitzender des > Aufsichtsrats), Hubert Leypoldt, Andreas Karrer > > Bankverbindungen: > > Deutsche Bank (BLZ 600 700 70) Kto. 1661 040 IBAN : DE85 6007 0070 0166 > 1040 00 SWIFT-CODE : DEUTDESS, > > Commerzbank (BLZ 600 400 71) Kto. 532 015 500 IBAN : DE83 6004 0071 0532 > 0155 00 SWIFT-Code : COBADEFF600, > > BW-Bank (BLZ 600 501 01) Kto. 2 403 313 IBAN : DE17 6005 0101 0002 4033 > 13 SWIFT-Code : SOLADEST > > Registergericht: Amtsgericht Stuttgart > > Handelsregister: HRB Nr. 19117 > > Umsatzsteuer: ID-Nr. DE 147 862 777 > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > > > > CENIT AG, Industriestrasse 52-54, 70565 Stuttgart, Tel.: +49 711 7825-30, > Fax: +49 711 7825-4000, Internet: www.cenit.de > Geschaeftsstellen: Berlin, Duesseldorf, Frankfurt, Hamburg, Hannover, > Muenchen, Oelsnitz, Saarbruecken > Vorstandsmitglieder: Kurt Bengel, Christian Pusch > Aufsichtsratsmitglieder: Andreas Schmidt (Vorsitzender des Aufsichtsrats), > Hubert Leypoldt, Andreas Karrer > Bankverbindungen: > Deutsche Bank (BLZ 600 700 70) Kto. 1661 040 IBAN : DE85 6007 0070 0166 1040 > 00 SWIFT-CODE : DEUTDESS, > Commerzbank (BLZ 600 400 71) Kto. 532 015 500 IBAN : DE83 6004 0071 0532 > 0155 00 SWIFT-Code : COBADEFF600, > BW-Bank (BLZ 600 501 01) Kto. 2 403 313 IBAN : DE17 6005 0101 0002 4033 13 > SWIFT-Code : SOLADEST > Registergericht: Amtsgericht Stuttgart > Handelsregister: HRB Nr. 19117 > Umsatzsteuer: ID-Nr. DE 147 862 777 > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > > > > CENIT AG, Industriestrasse 52-54, 70565 Stuttgart, Tel.: +49 711 7825-30, > Fax: +49 711 7825-4000, Internet: www.cenit.de > Geschaeftsstellen: Berlin, Duesseldorf, Frankfurt, Hamburg, Hannover, > Muenchen, Oelsnitz, Saarbruecken > Vorstandsmitglieder: Kurt Bengel, Christian Pusch > Aufsichtsratsmitglieder: Andreas Schmidt (Vorsitzender des Aufsichtsrats), > Hubert Leypoldt, Andreas Karrer > Bankverbindungen: > Deutsche Bank (BLZ 600 700 70) Kto. 1661 040 IBAN : DE85 6007 0070 0166 1040 > 00 SWIFT-CODE : DEUTDESS, > Commerzbank (BLZ 600 400 71) Kto. 532 015 500 IBAN : DE83 6004 0071 0532 > 0155 00 SWIFT-Code : COBADEFF600, > BW-Bank (BLZ 600 501 01) Kto. 2 403 313 IBAN : DE17 6005 0101 0002 4033 13 > SWIFT-Code : SOLADEST > Registergericht: Amtsgericht Stuttgart > Handelsregister: HRB Nr. 19117 > Umsatzsteuer: ID-Nr. DE 147 862 777 > > > CENIT AG, Industriestrasse 52-54, 70565 Stuttgart, Tel.: +49 711 7825-30, > Fax: +49 711 7825-4000, Internet: www.cenit.de > Geschaeftsstellen: Berlin, Duesseldorf, Frankfurt, Hamburg, Hannover, > Muenchen, Oelsnitz, Saarbruecken > Vorstandsmitglieder: Kurt Bengel, Christian Pusch > Aufsichtsratsmitglieder: Andreas Schmidt (Vorsitzender des Aufsichtsrats), > Hubert Leypoldt, Andreas Karrer > Bankverbindungen: > Deutsche Bank (BLZ 600 700 70) Kto. 1661 040 IBAN : DE85 6007 0070 0166 1040 > 00 SWIFT-CODE : DEUTDESS, > Commerzbank (BLZ 600 400 71) Kto. 532 015 500 IBAN : DE83 6004 0071 0532 > 0155 00 SWIFT-Code : COBADEFF600, > BW-Bank (BLZ 600 501 01) Kto. 2 403 313 IBAN : DE17 6005 0101 0002 4033 13 > SWIFT-Code : SOLADEST > Registergericht: Amtsgericht Stuttgart > Handelsregister: HRB Nr. 19117 > Umsatzsteuer: ID-Nr. DE 147 862 777 > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > > > > CENIT AG, Industriestrasse 52-54, 70565 Stuttgart, Tel.: +49 711 7825-30, > Fax: +49 711 7825-4000, Internet: www.cenit.de > Geschaeftsstellen: Berlin, Duesseldorf, Frankfurt, Hamburg, Hannover, > Muenchen, Oelsnitz, Saarbruecken > Vorstandsmitglieder: Kurt Bengel, Christian Pusch > Aufsichtsratsmitglieder: Andreas Schmidt (Vorsitzender des Aufsichtsrats), > Hubert Leypoldt, Andreas Karrer > Bankverbindungen: > Deutsche Bank (BLZ 600 700 70) Kto. 1661 040 IBAN : DE85 6007 0070 0166 1040 > 00 SWIFT-CODE : DEUTDESS, > Commerzbank (BLZ 600 400 71) Kto. 532 015 500 IBAN : DE83 6004 0071 0532 > 0155 00 SWIFT-Code : COBADEFF600, > BW-Bank (BLZ 600 501 01) Kto. 2 403 313 IBAN : DE17 6005 0101 0002 4033 13 > SWIFT-Code : SOLADEST > Registergericht: Amtsgericht Stuttgart > Handelsregister: HRB Nr. 19117 > Umsatzsteuer: ID-Nr. DE 147 862 777 > > > CENIT AG, Industriestrasse 52-54, 70565 Stuttgart, Tel.: +49 711 7825-30, > Fax: +49 711 7825-4000, Internet: www.cenit.de > Geschaeftsstellen: Berlin, Duesseldorf, Frankfurt, Hamburg, Hannover, > Muenchen, Oelsnitz, Saarbruecken > Vorstandsmitglieder: Kurt Bengel, Christian Pusch > Aufsichtsratsmitglieder: Andreas Schmidt (Vorsitzender des Aufsichtsrats), > Hubert Leypoldt, Andreas Karrer > Bankverbindungen: > Deutsche Bank (BLZ 600 700 70) Kto. 1661 040 IBAN : DE85 6007 0070 0166 1040 > 00 SWIFT-CODE : DEUTDESS, > Commerzbank (BLZ 600 400 71) Kto. 532 015 500 IBAN : DE83 6004 0071 0532 > 0155 00 SWIFT-Code : COBADEFF600, > BW-Bank (BLZ 600 501 01) Kto. 2 403 313 IBAN : DE17 6005 0101 0002 4033 13 > SWIFT-Code : SOLADEST > Registergericht: Amtsgericht Stuttgart > Handelsregister: HRB Nr. 19117 > Umsatzsteuer: ID-Nr. DE 147 862 777 > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

