Issue1455
Created on 2009-09-02.13:43:00 by techniq, last changed 2010-09-08.16:11:54 by ddaniels.
Files | ||||
---|---|---|---|---|
File name | Uploaded | Description | Edit | Remove |
jython_syspath_package.diff | stan, 2010-04-07.19:43:12 |
Messages | |||
---|---|---|---|
msg5086 (view) | Author: Sean Lynch (techniq) | Date: 2009-09-02.13:42:59 | |
I'm in the process of migrating some JRuby scripts over to Jython, but found the HtmlUnit java jar I rely on does not work with Jython (I've tested it with 2.5.0, 2.5.1, and 2.5b1). HtmlUnit's website is at http://htmlunit.sourceforge.net. I am using htmlunit-2.5. A script to test the functionality: ############################ import java import sys,os directory = 'C:/Downloads/Java/htmlunit-2.5/htmlunit-2.5/lib/' for file in os.listdir(directory): sys.path.append(os.path.join(directory, file)) from com.gargoylesoftware import htmlunit browser = htmlunit.WebClient() browser.getPage("http://www.google.com") ############################ And the exception stack trace I receive: ############################ Sep 2, 2009 9:38:22 AM com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfigu ration loadConfiguration SEVERE: Error when loading JavascriptConfiguration.xml java.lang.NullPointerException at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfigu ration.getConfigurationFileAsReader(J avaScriptConfiguration.java:258) at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfigu ration.loadConfiguration(JavaScriptCo nfiguration.java:179) at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfigu ration.<init>(JavaScriptConfiguration .java:138) at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfigu ration.getInstance(JavaScriptConfigur ation.java:236) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.init(JavaScrip tEngine.java:156) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.access$000(Jav aScriptEngine.java:68) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$1.run(JavaScri ptEngine.java:130) at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515 ) at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFa ctory.java:507) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.initialize(Jav aScriptEngine.java:141) at com.gargoylesoftware.htmlunit.WebClient.initialize(WebClient.java:1107) at com.gargoylesoftware.htmlunit.WebWindowImpl.setEnclosedPage(WebWindowImp l.java:99) at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:268) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultP ageCreator.java:127) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageC reator.java:101) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.ja va:442) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:329) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:386) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:371) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:17 5) at org.python.core.PyObject.__call__(PyObject.java:355) at org.python.core.PyMethod.__call__(PyMethod.java:215) at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:221) at org.python.core.PyMethod.__call__(PyMethod.java:206) at org.python.core.PyObject.__call__(PyObject.java:397) at org.python.core.PyObject.__call__(PyObject.java:401) at org.python.pycode._pyx0.f$0(webclient_test.py:11) at org.python.pycode._pyx0.call_function(webclient_test.py) at org.python.core.PyTableCode.call(PyTableCode.java:165) at org.python.core.PyCode.call(PyCode.java:18) at org.python.core.Py.runCode(Py.java:1204) at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:200) at org.python.util.jython.run(jython.java:246) at org.python.util.jython.main(jython.java:129) java.lang.NullPointerException at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfigu ration.getConfigurationFileAsReader(J avaScriptConfiguration.java:258) at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfigu ration.loadConfiguration(JavaScriptCo nfiguration.java:179) at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfigu ration.<init>(JavaScriptConfiguration .java:138) at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfigu ration.getInstance(JavaScriptConfigur ation.java:236) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.init(JavaScrip tEngine.java:156) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.access$000(Jav aScriptEngine.java:68) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$1.run(JavaScri ptEngine.java:130) at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515 ) at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFa ctory.java:507) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.initialize(Jav aScriptEngine.java:141) at com.gargoylesoftware.htmlunit.WebClient.initialize(WebClient.java:1107) at com.gargoylesoftware.htmlunit.WebWindowImpl.setEnclosedPage(WebWindowImp l.java:99) at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:268) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultP ageCreator.java:127) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageC reator.java:101) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.ja va:442) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:329) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:386) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:371) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:17 5) at org.python.core.PyObject.__call__(PyObject.java:355) at org.python.core.PyMethod.__call__(PyMethod.java:215) at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:221) at org.python.core.PyMethod.__call__(PyMethod.java:206) at org.python.core.PyObject.__call__(PyObject.java:397) at org.python.core.PyObject.__call__(PyObject.java:401) at org.python.pycode._pyx0.f$0(webclient_test.py:11) at org.python.pycode._pyx0.call_function(webclient_test.py) at org.python.core.PyTableCode.call(PyTableCode.java:165) at org.python.core.PyCode.call(PyCode.java:18) at org.python.core.Py.runCode(Py.java:1204) at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:200) at org.python.util.jython.run(jython.java:246) at org.python.util.jython.main(jython.java:129) Sep 2, 2009 9:38:25 AM com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$1 run SEVERE: Exception while initializing JavaScript for the page java.lang.IllegalStateException: Configuration was not initialized - see log for details at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfigu ration.<init>(JavaScriptConfiguration .java:142) at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfigu ration.getInstance(JavaScriptConfigur ation.java:236) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.init(JavaScrip tEngine.java:156) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.access$000(Jav aScriptEngine.java:68) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$1.run(JavaScri ptEngine.java:130) at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515 ) at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFa ctory.java:507) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.initialize(Jav aScriptEngine.java:141) at com.gargoylesoftware.htmlunit.WebClient.initialize(WebClient.java:1107) at com.gargoylesoftware.htmlunit.WebWindowImpl.setEnclosedPage(WebWindowImp l.java:99) at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:268) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultP ageCreator.java:127) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageC reator.java:101) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.ja va:442) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:329) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:386) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:371) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:17 5) at org.python.core.PyObject.__call__(PyObject.java:355) at org.python.core.PyMethod.__call__(PyMethod.java:215) at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:221) at org.python.core.PyMethod.__call__(PyMethod.java:206) at org.python.core.PyObject.__call__(PyObject.java:397) at org.python.core.PyObject.__call__(PyObject.java:401) at org.python.pycode._pyx0.f$0(webclient_test.py:11) at org.python.pycode._pyx0.call_function(webclient_test.py) at org.python.core.PyTableCode.call(PyTableCode.java:165) at org.python.core.PyCode.call(PyCode.java:18) at org.python.core.Py.runCode(Py.java:1204) at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:200) at org.python.util.jython.run(jython.java:246) at org.python.util.jython.main(jython.java:129) Traceback (most recent call last): File "webclient_test.py", line 11, in <module> browser.getPage("http://www.google.com") Exception class=[java.lang.IllegalStateException] com.gargoylesoftware.htmlunit.ScriptException: Configuration was not initialized - see log for details at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$1.run(JavaScri ptEngine.java:134) at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515 ) at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFa ctory.java:507) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.initialize(Jav aScriptEngine.java:141) at com.gargoylesoftware.htmlunit.WebClient.initialize(WebClient.java:1107) at com.gargoylesoftware.htmlunit.WebWindowImpl.setEnclosedPage(WebWindowImp l.java:99) at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:268) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultP ageCreator.java:127) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageC reator.java:101) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.ja va:442) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:329) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:386) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:371) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) com.gargoylesoftware.htmlunit.ScriptException: com.gargoylesoftware.htmlunit.ScriptException: Configuration was not init ialized - see log for details ############################ |
|||
msg5375 (view) | Author: Sean Lynch (techniq) | Date: 2009-12-11.03:39:33 | |
Tested with Jython 2.5.1 and HtmlUnit 2.6, same exception. |
|||
msg5642 (view) | Author: (stan) | Date: 2010-04-07.19:43:12 | |
Working for me with svn r6993 + patch from msg5528 on http://bugs.jython.org/issue1373 + attached patch |
|||
msg5941 (view) | Author: Jim Baker (zyasoft) | Date: 2010-08-06.05:31:27 | |
Based on msg5642, the underlying root cause was #1373, which was fixed as of r7080. Closing. |
|||
msg5955 (view) | Author: (stan) | Date: 2010-08-14.09:32:51 | |
with r7089 still need changes from jython_syspath_package.diff for example script to work |
|||
msg5959 (view) | Author: Jim Baker (zyasoft) | Date: 2010-08-14.22:08:31 | |
The patch (jython_syspath_package.diff) looks like a good start, however, it would seem the best way to do this is to use the jar's manifest to define the specific package information, if available. |
|||
msg5960 (view) | Author: Jim Baker (zyasoft) | Date: 2010-08-14.22:12:35 | |
Changed the title since it's more than HtmlUnit here that's potentially impacted. The solution should be to read the MANIFEST.MF resource in the source jar and get the desired attributes. |
|||
msg5962 (view) | Author: Jim Baker (zyasoft) | Date: 2010-08-15.14:13:34 | |
Patch (jython_syspath_package.diff) applied in r7094. Closing this issue, I opened #1641, with low priority, for the remaining metadata in the manifest. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-09-08 16:11:54 | ddaniels | set | nosy: + ddaniels |
2010-08-15 14:13:35 | zyasoft | set | status: open -> closed resolution: accepted -> fixed messages: + msg5962 |
2010-08-14 22:12:36 | zyasoft | set | priority: high title: Unable to retrieve webpage using the java HtmlUnit jar -> Classes loaded dynamically from sys.path do not have their package defined messages: + msg5960 components: + Core, - Library versions: + 2.5.1, - 2.5b1 |
2010-08-14 22:08:31 | zyasoft | set | status: closed -> open assignee: zyasoft resolution: fixed -> accepted messages: + msg5959 |
2010-08-14 09:32:52 | stan | set | messages: + msg5955 |
2010-08-06 05:31:28 | zyasoft | set | status: open -> closed resolution: fixed messages: + msg5941 nosy: + zyasoft |
2010-04-07 19:43:13 | stan | set | files:
+ jython_syspath_package.diff nosy: + stan messages: + msg5642 keywords: + patch |
2009-12-11 03:39:34 | techniq | set | messages: + msg5375 |
2009-09-11 20:08:29 | fwierzbicki | set | nosy: + fwierzbicki |
2009-09-02 13:43:00 | techniq | create |
Supported by Python Software Foundation,
Powered by Roundup