Re: Grinder bug report?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Grinder bug report?

Philip Aston-2
There are still a few stalwarts hanging out on grinder-use (cc'd), so start there.

Looking at that archive message, its for an older version of the grinder. The code that's throwing an NPE in that message doesn't exist any more.

I'm guessing you're using 3.11. You'll need to provide the error message if you want someone to diagnose it.

- Phil

On 01/12/16 13:58, Dorian Cransac wrote:
Hi Philip,

I hope I'm not bothering you with this email. I've used the grinder repeatedly over the course of my career and so I guess starting this email with a thank you would be appropriate. So thank you :)

I'm currently trying to use the HTTP plugin and objects of the grinder from within a jython script running on Nashorn (via Java's ScriptEngine).

I'm running into a problem which seems to have been reported a couple of times in the past but never really addressed, from what I understand (I found a few similar reports such as this one : https://sourceforge.net/p/grinder/mailman/message/29028470/ ).

It's a fairly strange bug as the class and corresponding jar file are definitely present in my classpath but something in the static initializer seems to be interfering with the classpath mecanics.

Seeing that there isn't much activity anymore on the sourceforge project, I was wondering if I should still try to open a ticket there or if you could maybe direct me towards someone who would be willing to help debugging this error.

Best Regards,
--
Dorian Cransac



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

_______________________________________________
grinder-use mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/grinder-use
Reply | Threaded
Open this post in threaded view
|

Re: Grinder bug report?

Philip Aston-2
Can you try with 3.11?

On 01/12/16 14:50, Dorian Cransac wrote:
Hi Philip,

Thanks for your reply. I'm copying the full stacktrace down below as well as the script itself and the code of the test class. It seems fairly easy to reproduce. (Btw I don't know why I mentioned Nashorn in my previous email, I'm obviously just running the jython engine, sorry about that)/

Script "GrinderHTTP.py" :
from net.grinder.script.Grinder import grinder
from net.grinder.plugin.http import HTTPPlugin
from net.grinder.plugin.http import HTTPRequest

request1 = HTTPRequest()

result = request1.GET("http://www.denkbar.io/")


Full stacktrace :
javax.script.ScriptException: java.lang.ExceptionInInitializerError: java.lang.ExceptionInInitializerError in <script> at line number 2
at org.python.jsr223.PyScriptEngine.scriptException(PyScriptEngine.java:202)
at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:42)
at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:47)
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:249)
at TestGrinder.main(TestGrinder.java:32)
Caused by: Traceback (most recent call last):
  File "<script>", line 2, in <module>
java.lang.ExceptionInInitializerError

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:348)

at org.python.core.Py.loadAndInitClass(Py.java:991)

at org.python.core.Py.findClassInternal(Py.java:926)

at org.python.core.Py.findClass(Py.java:951)

at org.python.core.JavaImportHelper.isJavaClass(JavaImportHelper.java:182)

at org.python.core.JavaImportHelper.tryAddPackage(JavaImportHelper.java:41)

at org.python.core.imp.import_next(imp.java:845)

at org.python.core.imp.import_logic(imp.java:904)

at org.python.core.imp.import_module_level(imp.java:978)

at org.python.core.imp.importName(imp.java:1062)

at org.python.core.ImportFunction.__call__(__builtin__.java:1280)

at org.python.core.PyObject.__call__(PyObject.java:431)

at org.python.core.__builtin__.__import__(__builtin__.java:1232)

at org.python.core.imp.importFromAs(imp.java:1156)

at org.python.core.imp.importFrom(imp.java:1132)

at org.python.pycode._pyx0.f$0(<script>:7)

at org.python.pycode._pyx0.call_function(<script>)

at org.python.core.PyTableCode.call(PyTableCode.java:167)

at org.python.core.PyCode.call(PyCode.java:18)

at org.python.core.Py.runCode(Py.java:1386)

at org.python.core.__builtin__.eval(__builtin__.java:497)

at org.python.core.__builtin__.eval(__builtin__.java:501)

at org.python.util.PythonInterpreter.eval(PythonInterpreter.java:259)

at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:40)

at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:47)

at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:249)

at TestGrinder.main(TestGrinder.java:32)

Caused by: java.lang.NullPointerException

at net.grinder.plugin.http.HTTPPlugin.<clinit>(HTTPPlugin.java:60)

... 28 more


java.lang.ExceptionInInitializerError: java.lang.ExceptionInInitializerError

at org.python.core.Py.JavaError(Py.java:546)
at org.python.core.PyTableCode.call(PyTableCode.java:170)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1386)
at org.python.core.__builtin__.eval(__builtin__.java:497)
at org.python.core.__builtin__.eval(__builtin__.java:501)
at org.python.util.PythonInterpreter.eval(PythonInterpreter.java:259)
at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:40)
... 3 more
Caused by: java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.python.core.Py.loadAndInitClass(Py.java:991)
at org.python.core.Py.findClassInternal(Py.java:926)
at org.python.core.Py.findClass(Py.java:951)
at org.python.core.JavaImportHelper.isJavaClass(JavaImportHelper.java:182)
at org.python.core.JavaImportHelper.tryAddPackage(JavaImportHelper.java:41)
at org.python.core.imp.import_next(imp.java:845)
at org.python.core.imp.import_logic(imp.java:904)
at org.python.core.imp.import_module_level(imp.java:978)
at org.python.core.imp.importName(imp.java:1062)
at org.python.core.ImportFunction.__call__(__builtin__.java:1280)
at org.python.core.PyObject.__call__(PyObject.java:431)
at org.python.core.__builtin__.__import__(__builtin__.java:1232)
at org.python.core.imp.importFromAs(imp.java:1156)
at org.python.core.imp.importFrom(imp.java:1132)
at org.python.pycode._pyx0.f$0(<script>:7)
at org.python.pycode._pyx0.call_function(<script>)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
... 9 more
Caused by: java.lang.NullPointerException
at net.grinder.plugin.http.HTTPPlugin.<clinit>(HTTPPlugin.java:60)
... 28 more

And the code of my test class :

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.nio.charset.Charset;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;

public class TestGrinder {

public static void main(String... args){

ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("jython");

File scriptFile = new File("D:\\GrinderHTTP.py");

Reader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(new FileInputStream(scriptFile), Charset.forName("UTF-8")));
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}     
try {
try {
engine.eval(reader);
} catch (ScriptException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} finally {
if(reader!=null) {
try {
reader.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
}



On Thu, Dec 1, 2016 at 3:30 PM, Philip Aston <[hidden email]> wrote:
There are still a few stalwarts hanging out on grinder-use (cc'd), so start there.

Looking at that archive message, its for an older version of the grinder. The code that's throwing an NPE in that message doesn't exist any more.

I'm guessing you're using 3.11. You'll need to provide the error message if you want someone to diagnose it.

- Phil


On 01/12/16 13:58, Dorian Cransac wrote:
Hi Philip,

I hope I'm not bothering you with this email. I've used the grinder repeatedly over the course of my career and so I guess starting this email with a thank you would be appropriate. So thank you :)

I'm currently trying to use the HTTP plugin and objects of the grinder from within a jython script running on Nashorn (via Java's ScriptEngine).

I'm running into a problem which seems to have been reported a couple of times in the past but never really addressed, from what I understand (I found a few similar reports such as this one : https://sourceforge.net/p/grinder/mailman/message/29028470/ ).

It's a fairly strange bug as the class and corresponding jar file are definitely present in my classpath but something in the static initializer seems to be interfering with the classpath mecanics.

Seeing that there isn't much activity anymore on the sourceforge project, I was wondering if I should still try to open a ticket there or if you could maybe direct me towards someone who would be willing to help debugging this error.

Best Regards,
--
Dorian Cransac





--
Dorian Cransac



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

_______________________________________________
grinder-use mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/grinder-use
Reply | Threaded
Open this post in threaded view
|

Re: Grinder bug report?

Philip Aston-2
My bad. The change to the plugin has not been released.


Anyway, I've now read what you're trying to do and I'm afraid its not supported.

The plugin needs to be initialised before a script can access them, and that process is built into the worker process. The same applies to parts of the script API, e.g. test instrumentation and statistics.  The net result is a script can only access the script API run by the grinder worker process.

- Phil



On 01/12/16 15:11, Dorian Cransac wrote:

Im sorry: that's with 3.11.


On Dec 1, 2016 15:57, "Philip Aston" <[hidden email]> wrote:
Can you try with 3.11?

On 01/12/16 14:50, Dorian Cransac wrote:
Hi Philip,

Thanks for your reply. I'm copying the full stacktrace down below as well as the script itself and the code of the test class. It seems fairly easy to reproduce. (Btw I don't know why I mentioned Nashorn in my previous email, I'm obviously just running the jython engine, sorry about that)/

Script "GrinderHTTP.py" :
from net.grinder.script.Grinder import grinder
from net.grinder.plugin.http import HTTPPlugin
from net.grinder.plugin.http import HTTPRequest

request1 = HTTPRequest()

result = request1.GET("http://www.denkbar.io/")


Full stacktrace :
javax.script.ScriptException: java.lang.ExceptionInInitializerError: java.lang.ExceptionInInitializerError in <script> at line number 2
at org.python.jsr223.PyScriptEngine.scriptException(PyScriptEngine.java:202)
at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:42)
at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:47)
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:249)
at TestGrinder.main(TestGrinder.java:32)
Caused by: Traceback (most recent call last):
  File "<script>", line 2, in <module>
java.lang.ExceptionInInitializerError

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:348)

at org.python.core.Py.loadAndInitClass(Py.java:991)

at org.python.core.Py.findClassInternal(Py.java:926)

at org.python.core.Py.findClass(Py.java:951)

at org.python.core.JavaImportHelper.isJavaClass(JavaImportHelper.java:182)

at org.python.core.JavaImportHelper.tryAddPackage(JavaImportHelper.java:41)

at org.python.core.imp.import_next(imp.java:845)

at org.python.core.imp.import_logic(imp.java:904)

at org.python.core.imp.import_module_level(imp.java:978)

at org.python.core.imp.importName(imp.java:1062)

at org.python.core.ImportFunction.__call__(__builtin__.java:1280)

at org.python.core.PyObject.__call__(PyObject.java:431)

at org.python.core.__builtin__.__import__(__builtin__.java:1232)

at org.python.core.imp.importFromAs(imp.java:1156)

at org.python.core.imp.importFrom(imp.java:1132)

at org.python.pycode._pyx0.f$0(<script>:7)

at org.python.pycode._pyx0.call_function(<script>)

at org.python.core.PyTableCode.call(PyTableCode.java:167)

at org.python.core.PyCode.call(PyCode.java:18)

at org.python.core.Py.runCode(Py.java:1386)

at org.python.core.__builtin__.eval(__builtin__.java:497)

at org.python.core.__builtin__.eval(__builtin__.java:501)

at org.python.util.PythonInterpreter.eval(PythonInterpreter.java:259)

at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:40)

at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:47)

at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:249)

at TestGrinder.main(TestGrinder.java:32)

Caused by: java.lang.NullPointerException

at net.grinder.plugin.http.HTTPPlugin.<clinit>(HTTPPlugin.java:60)

... 28 more


java.lang.ExceptionInInitializerError: java.lang.ExceptionInInitializerError

at org.python.core.Py.JavaError(Py.java:546)
at org.python.core.PyTableCode.call(PyTableCode.java:170)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1386)
at org.python.core.__builtin__.eval(__builtin__.java:497)
at org.python.core.__builtin__.eval(__builtin__.java:501)
at org.python.util.PythonInterpreter.eval(PythonInterpreter.java:259)
at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:40)
... 3 more
Caused by: java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.python.core.Py.loadAndInitClass(Py.java:991)
at org.python.core.Py.findClassInternal(Py.java:926)
at org.python.core.Py.findClass(Py.java:951)
at org.python.core.JavaImportHelper.isJavaClass(JavaImportHelper.java:182)
at org.python.core.JavaImportHelper.tryAddPackage(JavaImportHelper.java:41)
at org.python.core.imp.import_next(imp.java:845)
at org.python.core.imp.import_logic(imp.java:904)
at org.python.core.imp.import_module_level(imp.java:978)
at org.python.core.imp.importName(imp.java:1062)
at org.python.core.ImportFunction.__call__(__builtin__.java:1280)
at org.python.core.PyObject.__call__(PyObject.java:431)
at org.python.core.__builtin__.__import__(__builtin__.java:1232)
at org.python.core.imp.importFromAs(imp.java:1156)
at org.python.core.imp.importFrom(imp.java:1132)
at org.python.pycode._pyx0.f$0(<script>:7)
at org.python.pycode._pyx0.call_function(<script>)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
... 9 more
Caused by: java.lang.NullPointerException
at net.grinder.plugin.http.HTTPPlugin.<clinit>(HTTPPlugin.java:60)
... 28 more

And the code of my test class :

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.nio.charset.Charset;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;

public class TestGrinder {

public static void main(String... args){

ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("jython");

File scriptFile = new File("D:\\GrinderHTTP.py");

Reader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(new FileInputStream(scriptFile), Charset.forName("UTF-8")));
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}     
try {
try {
engine.eval(reader);
} catch (ScriptException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} finally {
if(reader!=null) {
try {
reader.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
}



On Thu, Dec 1, 2016 at 3:30 PM, Philip Aston <[hidden email]> wrote:
There are still a few stalwarts hanging out on grinder-use (cc'd), so start there.

Looking at that archive message, its for an older version of the grinder. The code that's throwing an NPE in that message doesn't exist any more.

I'm guessing you're using 3.11. You'll need to provide the error message if you want someone to diagnose it.

- Phil


On 01/12/16 13:58, Dorian Cransac wrote:
Hi Philip,

I hope I'm not bothering you with this email. I've used the grinder repeatedly over the course of my career and so I guess starting this email with a thank you would be appropriate. So thank you :)

I'm currently trying to use the HTTP plugin and objects of the grinder from within a jython script running on Nashorn (via Java's ScriptEngine).

I'm running into a problem which seems to have been reported a couple of times in the past but never really addressed, from what I understand (I found a few similar reports such as this one : https://sourceforge.net/p/grinder/mailman/message/29028470/ ).

It's a fairly strange bug as the class and corresponding jar file are definitely present in my classpath but something in the static initializer seems to be interfering with the classpath mecanics.

Seeing that there isn't much activity anymore on the sourceforge project, I was wondering if I should still try to open a ticket there or if you could maybe direct me towards someone who would be willing to help debugging this error.

Best Regards,
--
Dorian Cransac





--
Dorian Cransac




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

_______________________________________________
grinder-use mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/grinder-use
Reply | Threaded
Open this post in threaded view
|

Re: Grinder bug report?

Philip Aston-2
I've not tried nGrinder. I'm sure others on this list can pitch in though.

- Phil

On 01/12/16 18:44, Dorian Cransac wrote:
Thanks for taking the time and for keeping me posted, I appreciate it.

I wonder if I could still make this work by loading the worker code (bare minimum) through direct calls in Java prior to evaluating the jython script. Maybe I'll tinker around a bit.

If I may ask you another question (semi-related) : what's your take on nGrinder? I haven't taken a deep look at their architecture, but it might be worth trying to see if it integrates easier. I'd really love to be able to invoke Grinder or Grinder style scripts through the ScriptEngine and benefit from all the work that's been done at the TCPProxy and HTTP API level.

Regards
Dorian

On Thu, Dec 1, 2016 at 7:35 PM, Philip Aston <[hidden email]> wrote:
My bad. The change to the plugin has not been released.


Anyway, I've now read what you're trying to do and I'm afraid its not supported.

The plugin needs to be initialised before a script can access them, and that process is built into the worker process. The same applies to parts of the script API, e.g. test instrumentation and statistics.  The net result is a script can only access the script API run by the grinder worker process.

- Phil




On 01/12/16 15:11, Dorian Cransac wrote:

Im sorry: that's with 3.11.


On Dec 1, 2016 15:57, "Philip Aston" <[hidden email]> wrote:
Can you try with 3.11?

On 01/12/16 14:50, Dorian Cransac wrote:
Hi Philip,

Thanks for your reply. I'm copying the full stacktrace down below as well as the script itself and the code of the test class. It seems fairly easy to reproduce. (Btw I don't know why I mentioned Nashorn in my previous email, I'm obviously just running the jython engine, sorry about that)/

Script "GrinderHTTP.py" :
from net.grinder.script.Grinder import grinder
from net.grinder.plugin.http import HTTPPlugin
from net.grinder.plugin.http import HTTPRequest

request1 = HTTPRequest()

result = request1.GET("http://www.denkbar.io/")


Full stacktrace :
javax.script.ScriptException: java.lang.ExceptionInInitializerError: java.lang.ExceptionInInitializerError in <script> at line number 2
at org.python.jsr223.PyScriptEngine.scriptException(PyScriptEngine.java:202)
at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:42)
at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:47)
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:249)
at TestGrinder.main(TestGrinder.java:32)
Caused by: Traceback (most recent call last):
  File "<script>", line 2, in <module>
java.lang.ExceptionInInitializerError

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:348)

at org.python.core.Py.loadAndInitClass(Py.java:991)

at org.python.core.Py.findClassInternal(Py.java:926)

at org.python.core.Py.findClass(Py.java:951)

at org.python.core.JavaImportHelper.isJavaClass(JavaImportHelper.java:182)

at org.python.core.JavaImportHelper.tryAddPackage(JavaImportHelper.java:41)

at org.python.core.imp.import_next(imp.java:845)

at org.python.core.imp.import_logic(imp.java:904)

at org.python.core.imp.import_module_level(imp.java:978)

at org.python.core.imp.importName(imp.java:1062)

at org.python.core.ImportFunction.__call__(__builtin__.java:1280)

at org.python.core.PyObject.__call__(PyObject.java:431)

at org.python.core.__builtin__.__import__(__builtin__.java:1232)

at org.python.core.imp.importFromAs(imp.java:1156)

at org.python.core.imp.importFrom(imp.java:1132)

at org.python.pycode._pyx0.f$0(<script>:7)

at org.python.pycode._pyx0.call_function(<script>)

at org.python.core.PyTableCode.call(PyTableCode.java:167)

at org.python.core.PyCode.call(PyCode.java:18)

at org.python.core.Py.runCode(Py.java:1386)

at org.python.core.__builtin__.eval(__builtin__.java:497)

at org.python.core.__builtin__.eval(__builtin__.java:501)

at org.python.util.PythonInterpreter.eval(PythonInterpreter.java:259)

at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:40)

at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:47)

at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:249)

at TestGrinder.main(TestGrinder.java:32)

Caused by: java.lang.NullPointerException

at net.grinder.plugin.http.HTTPPlugin.<clinit>(HTTPPlugin.java:60)

... 28 more


java.lang.ExceptionInInitializerError: java.lang.ExceptionInInitializerError

at org.python.core.Py.JavaError(Py.java:546)
at org.python.core.PyTableCode.call(PyTableCode.java:170)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1386)
at org.python.core.__builtin__.eval(__builtin__.java:497)
at org.python.core.__builtin__.eval(__builtin__.java:501)
at org.python.util.PythonInterpreter.eval(PythonInterpreter.java:259)
at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:40)
... 3 more
Caused by: java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.python.core.Py.loadAndInitClass(Py.java:991)
at org.python.core.Py.findClassInternal(Py.java:926)
at org.python.core.Py.findClass(Py.java:951)
at org.python.core.JavaImportHelper.isJavaClass(JavaImportHelper.java:182)
at org.python.core.JavaImportHelper.tryAddPackage(JavaImportHelper.java:41)
at org.python.core.imp.import_next(imp.java:845)
at org.python.core.imp.import_logic(imp.java:904)
at org.python.core.imp.import_module_level(imp.java:978)
at org.python.core.imp.importName(imp.java:1062)
at org.python.core.ImportFunction.__call__(__builtin__.java:1280)
at org.python.core.PyObject.__call__(PyObject.java:431)
at org.python.core.__builtin__.__import__(__builtin__.java:1232)
at org.python.core.imp.importFromAs(imp.java:1156)
at org.python.core.imp.importFrom(imp.java:1132)
at org.python.pycode._pyx0.f$0(<script>:7)
at org.python.pycode._pyx0.call_function(<script>)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
... 9 more
Caused by: java.lang.NullPointerException
at net.grinder.plugin.http.HTTPPlugin.<clinit>(HTTPPlugin.java:60)
... 28 more

And the code of my test class :

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.nio.charset.Charset;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;

public class TestGrinder {

public static void main(String... args){

ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("jython");

File scriptFile = new File("D:\\GrinderHTTP.py");

Reader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(new FileInputStream(scriptFile), Charset.forName("UTF-8")));
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}     
try {
try {
engine.eval(reader);
} catch (ScriptException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} finally {
if(reader!=null) {
try {
reader.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
}



On Thu, Dec 1, 2016 at 3:30 PM, Philip Aston <[hidden email]> wrote:
There are still a few stalwarts hanging out on grinder-use (cc'd), so start there.

Looking at that archive message, its for an older version of the grinder. The code that's throwing an NPE in that message doesn't exist any more.

I'm guessing you're using 3.11. You'll need to provide the error message if you want someone to diagnose it.

- Phil


On 01/12/16 13:58, Dorian Cransac wrote:
Hi Philip,

I hope I'm not bothering you with this email. I've used the grinder repeatedly over the course of my career and so I guess starting this email with a thank you would be appropriate. So thank you :)

I'm currently trying to use the HTTP plugin and objects of the grinder from within a jython script running on Nashorn (via Java's ScriptEngine).

I'm running into a problem which seems to have been reported a couple of times in the past but never really addressed, from what I understand (I found a few similar reports such as this one : https://sourceforge.net/p/grinder/mailman/message/29028470/ ).

It's a fairly strange bug as the class and corresponding jar file are definitely present in my classpath but something in the static initializer seems to be interfering with the classpath mecanics.

Seeing that there isn't much activity anymore on the sourceforge project, I was wondering if I should still try to open a ticket there or if you could maybe direct me towards someone who would be willing to help debugging this error.

Best Regards,
--
Dorian Cransac





--
Dorian Cransac






--
Dorian Cransac



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

_______________________________________________
grinder-use mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/grinder-use
Reply | Threaded
Open this post in threaded view
|

Re: Grinder bug report?

Philip Aston-2
No objection at all. But be aware, changes are unlikely to be merged back into the mainline project.

- Phil

On 01/12/16 20:13, Dorian Cransac wrote:
Hi Philip,

I was able to make the HTTP API work in my context by shedding the entire plugin mecanism (along with workers altogether) and also relocating objects cached at the thread level (such as the HTTPConnection).

Would you have any objection to me forking the project so as to provide a "light" version of the HTTP Plugin and expose it as a standalone java / jython library? (I guess I'm mostly talking about the grinder-http and grinder-httpclient artefacts here) 

Regards

Dorian

On Thu, Dec 1, 2016 at 8:22 PM, Philip Aston <[hidden email]> wrote:
I've not tried nGrinder. I'm sure others on this list can pitch in though.

- Phil


On 01/12/16 18:44, Dorian Cransac wrote:
Thanks for taking the time and for keeping me posted, I appreciate it.

I wonder if I could still make this work by loading the worker code (bare minimum) through direct calls in Java prior to evaluating the jython script. Maybe I'll tinker around a bit.

If I may ask you another question (semi-related) : what's your take on nGrinder? I haven't taken a deep look at their architecture, but it might be worth trying to see if it integrates easier. I'd really love to be able to invoke Grinder or Grinder style scripts through the ScriptEngine and benefit from all the work that's been done at the TCPProxy and HTTP API level.

Regards
Dorian

On Thu, Dec 1, 2016 at 7:35 PM, Philip Aston <[hidden email]> wrote:
My bad. The change to the plugin has not been released.


Anyway, I've now read what you're trying to do and I'm afraid its not supported.

The plugin needs to be initialised before a script can access them, and that process is built into the worker process. The same applies to parts of the script API, e.g. test instrumentation and statistics.  The net result is a script can only access the script API run by the grinder worker process.

- Phil




On 01/12/16 15:11, Dorian Cransac wrote:

Im sorry: that's with 3.11.


On Dec 1, 2016 15:57, "Philip Aston" <[hidden email]> wrote:
Can you try with 3.11?

On 01/12/16 14:50, Dorian Cransac wrote:
Hi Philip,

Thanks for your reply. I'm copying the full stacktrace down below as well as the script itself and the code of the test class. It seems fairly easy to reproduce. (Btw I don't know why I mentioned Nashorn in my previous email, I'm obviously just running the jython engine, sorry about that)/

Script "GrinderHTTP.py" :
from net.grinder.script.Grinder import grinder
from net.grinder.plugin.http import HTTPPlugin
from net.grinder.plugin.http import HTTPRequest

request1 = HTTPRequest()

result = request1.GET("http://www.denkbar.io/")


Full stacktrace :
javax.script.ScriptException: java.lang.ExceptionInInitializerError: java.lang.ExceptionInInitializerError in <script> at line number 2
at org.python.jsr223.PyScriptEngine.scriptException(PyScriptEngine.java:202)
at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:42)
at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:47)
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:249)
at TestGrinder.main(TestGrinder.java:32)
Caused by: Traceback (most recent call last):
  File "<script>", line 2, in <module>
java.lang.ExceptionInInitializerError

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:348)

at org.python.core.Py.loadAndInitClass(Py.java:991)

at org.python.core.Py.findClassInternal(Py.java:926)

at org.python.core.Py.findClass(Py.java:951)

at org.python.core.JavaImportHelper.isJavaClass(JavaImportHelper.java:182)

at org.python.core.JavaImportHelper.tryAddPackage(JavaImportHelper.java:41)

at org.python.core.imp.import_next(imp.java:845)

at org.python.core.imp.import_logic(imp.java:904)

at org.python.core.imp.import_module_level(imp.java:978)

at org.python.core.imp.importName(imp.java:1062)

at org.python.core.ImportFunction.__call__(__builtin__.java:1280)

at org.python.core.PyObject.__call__(PyObject.java:431)

at org.python.core.__builtin__.__import__(__builtin__.java:1232)

at org.python.core.imp.importFromAs(imp.java:1156)

at org.python.core.imp.importFrom(imp.java:1132)

at org.python.pycode._pyx0.f$0(<script>:7)

at org.python.pycode._pyx0.call_function(<script>)

at org.python.core.PyTableCode.call(PyTableCode.java:167)

at org.python.core.PyCode.call(PyCode.java:18)

at org.python.core.Py.runCode(Py.java:1386)

at org.python.core.__builtin__.eval(__builtin__.java:497)

at org.python.core.__builtin__.eval(__builtin__.java:501)

at org.python.util.PythonInterpreter.eval(PythonInterpreter.java:259)

at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:40)

at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:47)

at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:249)

at TestGrinder.main(TestGrinder.java:32)

Caused by: java.lang.NullPointerException

at net.grinder.plugin.http.HTTPPlugin.<clinit>(HTTPPlugin.java:60)

... 28 more


java.lang.ExceptionInInitializerError: java.lang.ExceptionInInitializerError

at org.python.core.Py.JavaError(Py.java:546)
at org.python.core.PyTableCode.call(PyTableCode.java:170)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1386)
at org.python.core.__builtin__.eval(__builtin__.java:497)
at org.python.core.__builtin__.eval(__builtin__.java:501)
at org.python.util.PythonInterpreter.eval(PythonInterpreter.java:259)
at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:40)
... 3 more
Caused by: java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.python.core.Py.loadAndInitClass(Py.java:991)
at org.python.core.Py.findClassInternal(Py.java:926)
at org.python.core.Py.findClass(Py.java:951)
at org.python.core.JavaImportHelper.isJavaClass(JavaImportHelper.java:182)
at org.python.core.JavaImportHelper.tryAddPackage(JavaImportHelper.java:41)
at org.python.core.imp.import_next(imp.java:845)
at org.python.core.imp.import_logic(imp.java:904)
at org.python.core.imp.import_module_level(imp.java:978)
at org.python.core.imp.importName(imp.java:1062)
at org.python.core.ImportFunction.__call__(__builtin__.java:1280)
at org.python.core.PyObject.__call__(PyObject.java:431)
at org.python.core.__builtin__.__import__(__builtin__.java:1232)
at org.python.core.imp.importFromAs(imp.java:1156)
at org.python.core.imp.importFrom(imp.java:1132)
at org.python.pycode._pyx0.f$0(<script>:7)
at org.python.pycode._pyx0.call_function(<script>)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
... 9 more
Caused by: java.lang.NullPointerException
at net.grinder.plugin.http.HTTPPlugin.<clinit>(HTTPPlugin.java:60)
... 28 more

And the code of my test class :

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.nio.charset.Charset;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;

public class TestGrinder {

public static void main(String... args){

ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("jython");

File scriptFile = new File("D:\\GrinderHTTP.py");

Reader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(new FileInputStream(scriptFile), Charset.forName("UTF-8")));
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}     
try {
try {
engine.eval(reader);
} catch (ScriptException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} finally {
if(reader!=null) {
try {
reader.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
}



On Thu, Dec 1, 2016 at 3:30 PM, Philip Aston <[hidden email]> wrote:
There are still a few stalwarts hanging out on grinder-use (cc'd), so start there.

Looking at that archive message, its for an older version of the grinder. The code that's throwing an NPE in that message doesn't exist any more.

I'm guessing you're using 3.11. You'll need to provide the error message if you want someone to diagnose it.

- Phil


On 01/12/16 13:58, Dorian Cransac wrote:
Hi Philip,

I hope I'm not bothering you with this email. I've used the grinder repeatedly over the course of my career and so I guess starting this email with a thank you would be appropriate. So thank you :)

I'm currently trying to use the HTTP plugin and objects of the grinder from within a jython script running on Nashorn (via Java's ScriptEngine).

I'm running into a problem which seems to have been reported a couple of times in the past but never really addressed, from what I understand (I found a few similar reports such as this one : https://sourceforge.net/p/grinder/mailman/message/29028470/ ).

It's a fairly strange bug as the class and corresponding jar file are definitely present in my classpath but something in the static initializer seems to be interfering with the classpath mecanics.

Seeing that there isn't much activity anymore on the sourceforge project, I was wondering if I should still try to open a ticket there or if you could maybe direct me towards someone who would be willing to help debugging this error.

Best Regards,
--
Dorian Cransac







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

_______________________________________________
grinder-use mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/grinder-use