On Wed, Apr 29, 2009 at 09:27, Jonas Almfeldt
<jonas.almfeldt(a)gmail.com
wrote:
Hi,
On Tue, Apr 28, 2009 at 4:54 PM, Thomas Mortagne
<thomas.mortagne(a)xwiki.com>wrote;wrote:
[snip]
>>
>> Looks like it can't find some python files which are inside a jar
>> file
>> (pygments-1.0-xwiki.jar). A java URL to the files inside the
>> jar is
>> given to jython which is supposed to look at this URL as if it
>> was a
>> folder. Maybe this can't be done with the JVM, the application
>> Server
>> or the configuration of one of theses.
>
> Could you try to extract Lib/ folder from pygments-1.0-xwiki.jar
> to
> classes/ folder (the one which is at the same level than lib/
> folder,
> create it if it does not exists) and move the jar where jython
> could
> not find it. Trying to see if it's working when the Pygments
> code is
> in a real folder.
>
> (I should maybe add a configuration to be able to set the location
> of
> Python code anyway)
>
I have now tried to remove the file pygments-1.0-xwiki.jar from
xwiki.war/WEB-INF/lib/
and extracted the Lib/ folder of the pygments-1.0-xwiki.jar to this
path:
xwiki.war/WEB-INF/classes/Lib/
so that xwiki.war/WEB-INF/classes/Lib/pygments/ contains the python
files.
And then restarted the app server. But I get the "Failed to execute
macro:
code" with part of the stack trace below.
Also tried to skip the Lib part of the path and put the pygments
folder
directly under xwiki.war/WEB-INF/classes/
but it did not do the trick either.
Maybe the issue is that your application server does not let you
read
directly in resources (like jar and classes). Currently the macro
always look in the resources, i will try to add a configuration to
be
able to set the pygments/python folder anywhere.
Thomas I'm not sure we should have this config option. It doesn't
sound right. It should be ok to always look in the resources.
If the macro uses File IO to explicitely look into WEB-INF/lib/...
then yes that's very wrong. We should only use the classloader to
load
resources.