You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by sebb <se...@gmail.com> on 2005/11/07 18:20:25 UTC

Re: new HTTPSampleResult() returns null. My Mistake or JMeter's?

On 04/11/05, Alex Eagar <al...@yahoo.com> wrote:
> JMeter v. 2.1.1 with bsh-2.0b4.jar and j2sdk1.4.2_10
> on Windows XP SP2.
>
> --- The Problem ---
> Within a BeanShell Sampler, I have the following:
> import
> org.apache.jmeter.protocol.http.sampler.HTTPSampleResult;
>
> HTTPSampleResult res = new HTTPSampleResult();
>
> print("res == " + res);
>
> When run, the terminal prints the following:
> res == null
>
> --- Info Found ---
> HTTPSampleResult Constructor Definition:
> public HTTPSampleResult() {super();}
>
> HTTPSamplerResult extends SampleResult
> SampleResult Constructor Definition:
> public SampleResult() {time = 0;}
>
> --- Another Problem ---
> If the above is my mistake, then the following is not
> a problem, but if it is JMeter's mistake then I think
> it would be another problem. Please correct my logic
> if I'm not seeing how this all works.
>
> HTTPSampler, method setupConnection(URL u, String
> method, HTTPSampleResult res)
> The argument res is supposed to get set up but if res
> is null, it never happens.
> Line 154, the beginning of res setup:
> if (res != null) {
>
> --- Comment/Background ---
> I am trying to learn how to use JMeter elements
> programmatically from a BeanShell Sampler for more
> flexible control. Besides the general increased
> flexibility, right now I am trying to make a web
> crawler. If you can point me in the direction of
> documentation on how to control elements from a
> BeanShell Sampler, please tell me; I will appreciate
> it very much.

BeanShell Sampler was not designed for such usage.

Sorry, but I've no idea whether or not this can be made to work.

Try checking jmeter.log in case there are any error messages to show
why res==null.

> Thanks for your time (and for JMeter),
> Alex Eagar
>
>
>
>
> __________________________________
> Yahoo! Mail - PC Magazine Editors' Choice 2005
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

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


Re: new HTTPSampleResult() returns null. My Mistake or JMeter's?

Posted by sebb <se...@gmail.com>.
On 08/11/05, Alex Eagar <al...@yahoo.com> wrote:
> --- sebb wrote:
> > BeanShell Sampler was not designed for such usage.
> >
> > Sorry, but I've no idea whether or not this can be
> > made to work.
> >
> > Try checking jmeter.log in case there are any error
> > messages to show
> > why res==null.

Are there any errors in jmeter.log?

> Every other object that I create works just fine. I
> created some simple classes with inheritance that have
> constructors that work the same as the source code for
> HTTPSampleResult and SampleResult and I didn't have
> any problem.

See above ...

> So what is a BeanShell Sampler designed for then? Once

It is intended for developing Samplers written in Java.

> I discovered that I could use BeanShells, I got pretty
> excited. There are some things that I just can't
> figure out how to with the JMeter GUI. The crawler I'm
> trying to create is pretty simple. It's just a
> recursive method that takes two parameters, a URL and
> an int for depth. It then loads and parses the
> particular page, and for each link in the page, it
> calls itself with a depth minus one. If depth equals
> zero then it doesn't call itself. I could then much
> more easily check all the links on my page. If you
> know of an easier way to do this then please tell me.
> If not, I'm sure I'll figure it out with enough
> effort.
>
> I downloaded Ant today, but I haven't had the time to
> learn how to use it yet. Is there a way to rebundle
> one particular jar file without recompiling
> everything? I want to try to find out at what point
> things are failing but I can't do that yet because I'm
> not sure how to edit and compile HTTPSampleResult.java
> and SampleResult.java. Like I say, I'll figure it
> eventually, but I'd prefer an easier way than learning
> recompile everything using Ant (not that that won't be
> useful in the future).

You can create your own jars and put them in lib/ext.
No need to use Ant unless you want to.

I think the jars are processed in alphabetical order (this may depend
on the OS) so it may be possible to build your own jar with your own
copies of *SampleResult.class and just give it a name that sorts
earlier.

Or you can delete the existing classes from the jars.

> Alex Eagar
>
>
>
>
> __________________________________
> Yahoo! Mail - PC Magazine Editors' Choice 2005
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

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


AW: new HTTPSampleResult() returns null. My Mistake or JMeter's?

Posted by Carsten Sensler <ic...@cauni.de>.
Hi Alex,

perhaps solves the LinkParser your problem.

http://jakarta.apache.org/jmeter/usermanual/component_reference.html#HTML_Li
nk_Parser

With this Pre Processor Element you can parse a retrieved HTML response and
follow all links with in the response.

I hope this hint will help to sovle your problem.

Carsten

> -----Ursprüngliche Nachricht-----
> Von: Alex Eagar [mailto:alexeagar@yahoo.com]
> Gesendet: Dienstag, 8. November 2005 01:57
> An: JMeter Users List
> Betreff: Re: new HTTPSampleResult() returns null. My Mistake or JMeter's?
> 
> --- sebb wrote:
> > BeanShell Sampler was not designed for such usage.
> >
> > Sorry, but I've no idea whether or not this can be
> > made to work.
> >
> > Try checking jmeter.log in case there are any error
> > messages to show
> > why res==null.
> 
> Every other object that I create works just fine. I
> created some simple classes with inheritance that have
> constructors that work the same as the source code for
> HTTPSampleResult and SampleResult and I didn't have
> any problem.
> 
> So what is a BeanShell Sampler designed for then? Once
> I discovered that I could use BeanShells, I got pretty
> excited. There are some things that I just can't
> figure out how to with the JMeter GUI. The crawler I'm
> trying to create is pretty simple. It's just a
> recursive method that takes two parameters, a URL and
> an int for depth. It then loads and parses the
> particular page, and for each link in the page, it
> calls itself with a depth minus one. If depth equals
> zero then it doesn't call itself. I could then much
> more easily check all the links on my page. If you
> know of an easier way to do this then please tell me.
> If not, I'm sure I'll figure it out with enough
> effort.
> 
> I downloaded Ant today, but I haven't had the time to
> learn how to use it yet. Is there a way to rebundle
> one particular jar file without recompiling
> everything? I want to try to find out at what point
> things are failing but I can't do that yet because I'm
> not sure how to edit and compile HTTPSampleResult.java
> and SampleResult.java. Like I say, I'll figure it
> eventually, but I'd prefer an easier way than learning
> recompile everything using Ant (not that that won't be
> useful in the future).
> 
> Alex Eagar
> 
> 
> 
> 
> __________________________________
> Yahoo! Mail - PC Magazine Editors' Choice 2005
> http://mail.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org



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


Re: new HTTPSampleResult() returns null. My Mistake or JMeter's?

Posted by Alex Eagar <al...@yahoo.com>.
--- sebb wrote:
> BeanShell Sampler was not designed for such usage.
> 
> Sorry, but I've no idea whether or not this can be
> made to work.
> 
> Try checking jmeter.log in case there are any error
> messages to show
> why res==null.

Every other object that I create works just fine. I
created some simple classes with inheritance that have
constructors that work the same as the source code for
HTTPSampleResult and SampleResult and I didn't have
any problem.

So what is a BeanShell Sampler designed for then? Once
I discovered that I could use BeanShells, I got pretty
excited. There are some things that I just can't
figure out how to with the JMeter GUI. The crawler I'm
trying to create is pretty simple. It's just a
recursive method that takes two parameters, a URL and
an int for depth. It then loads and parses the
particular page, and for each link in the page, it
calls itself with a depth minus one. If depth equals
zero then it doesn't call itself. I could then much
more easily check all the links on my page. If you
know of an easier way to do this then please tell me.
If not, I'm sure I'll figure it out with enough
effort.

I downloaded Ant today, but I haven't had the time to
learn how to use it yet. Is there a way to rebundle
one particular jar file without recompiling
everything? I want to try to find out at what point
things are failing but I can't do that yet because I'm
not sure how to edit and compile HTTPSampleResult.java
and SampleResult.java. Like I say, I'll figure it
eventually, but I'd prefer an easier way than learning
recompile everything using Ant (not that that won't be
useful in the future).

Alex Eagar


	
		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

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