El 19/04/17 a las 12:42, helix84 escribió:
You didn't add the python requests module to the jython webapp. Take a
look at this section.

https://wiki.duraspace.org/display/DSPACE/Jython+webapp+for+DSpace#JythonwebappforDSpace-AddingPythonlibraries


Regards,
~~helix84

Compulsory reading: DSpace Mailing List Etiquette
https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette


On Wed, Apr 19, 2017 at 12:07 PM, euler <[email protected]
<mailto:[email protected]>> wrote:

    Hi Àlex,

    I am trying to implement this in my dspace 6.0 test instance, but I
    think I missed something in setting up jython to work with
    DSpace/Tomcat. I followed the instructions here (steps 1-4
    only?): Jython webapp for DSpace

<https://wiki.duraspace.org/display/DSPACE/Jython+webapp+for+DSpace> but
    I am having a 500 Internal Server error when accessing
    ImpactServlet.py. Below is the error message. Hope you can point me
    to anything that I may have missed.

    javax.servlet.ServletException: Traceback (most recent call last):

      File "C:\DSpace\webapps\jython\impact\ImpactServlet.py", line 5,
in <module>
        import requests
    ImportError: No module named requests

        org.python.util.PyServlet.createInstance(PyServlet.java:224)
        org.python.util.PyServlet.loadServlet(PyServlet.java:188)
        org.python.util.PyServlet.getServlet(PyServlet.java:178)
        org.python.util.PyServlet.service(PyServlet.java:155)

 org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)



<https://lh3.googleusercontent.com/-GyeYLoWsV-k/WPc2gplnU0I/AAAAAAAAA0E/8YEDeHhnVU0oc_t-0_XqQST-tSb2E5pOwCLcB/s1600/ImpactServlet.PNG>






    Thanks in advance and regards,
    euler

    On Monday, August 29, 2016 at 5:51:20 PM UTC+8, Àlex Magaz Graça
wrote:

        El 26/07/16 a las 16:45, euler escribió:
        > Hi Àlex and helix84,
        >
        > I tried to implement the Scopus citations from your gist, but
        I am
        > having this error in my Tomcat logs:
        >
        > Traceback (most recent call last):
        >   File "C:\DSpace\webapps\jython\ImpactServlet.py", line 36,
        in doGet
        >     self.doPost(request, response)
        >   File "C:\DSpace\webapps\jython\ImpactServlet.py", line 47,
        in doPost
        >     response.getWriter().println(impactService.query())
        >   File "C:\DSpace\webapps\jython\ImpactServlet.py", line 155,
        in query
        >     responseData = self._impactService.query()
        >   File "C:\DSpace\webapps\jython\ImpactServlet.py", line 93,
        in query
        >     return self._buildResponseToClient(serviceResponse)
        >   File "C:\DSpace\webapps\jython\ImpactServlet.py", line 221,
        in _buildResponseToClient
        >     citationCount =
        serviceResponseObject["citation-count-response"]\
        > KeyError: 'citation-count-response'
        >
        >     org.python.core.Py.KeyError(Py.java:249)
        >     org.python.core.PyObject.__getitem__(PyObject.java:738)
        >

org.python.pycode._pyx2._buildResponseToClient$22(C:\DSpace\webapps\jython\ImpactServlet.py:224)

        >

org.python.pycode._pyx2.call_function(C:\DSpace\webapps\jython\ImpactServlet.py)

        >     org.python.core.PyTableCode.ca
        <http://org.python.core.PyTableCode.ca>ll(PyTableCode.java:167)
        >     org.python.core.PyBaseCode.call(PyBaseCode.java:153)
        >     org.python.core.PyFunction.__call__(PyFunction.java:423)
        >     org.python.core.PyMethod.__call__(PyMethod.java:141)
        >

org.python.pycode._pyx2.query$8(C:\DSpace\webapps\jython\ImpactServlet.py:93)

        >

org.python.pycode._pyx2.call_function(C:\DSpace\webapps\jython\ImpactServlet.py)

        >     org.python.core.PyTableCode.ca
        <http://org.python.core.PyTableCode.ca>ll(PyTableCode.java:167)
        >     org.python.core.PyBaseCode.call(PyBaseCode.java:138)
        >     org.python.core.PyFunction.__call__(PyFunction.java:413)
        >     org.python.core.PyMethod.__call__(PyMethod.java:126)
        >

org.python.pycode._pyx2.query$14(C:\DSpace\webapps\jython\ImpactServlet.py:164)

        >

org.python.pycode._pyx2.call_function(C:\DSpace\webapps\jython\ImpactServlet.py)

        >     org.python.core.PyTableCode.ca
        <http://org.python.core.PyTableCode.ca>ll(PyTableCode.java:167)
        >     org.python.core.PyBaseCode.call(PyBaseCode.java:138)
        >     org.python.core.PyFunction.__call__(PyFunction.java:413)
        >     org.python.core.PyMethod.__call__(PyMethod.java:126)
        >

org.python.pycode._pyx2.doPost$4(C:\DSpace\webapps\jython\ImpactServlet.py:47)

        >

org.python.pycode._pyx2.call_function(C:\DSpace\webapps\jython\ImpactServlet.py)

        >     org.python.core.PyTableCode.ca
        <http://org.python.core.PyTableCode.ca>ll(PyTableCode.java:167)
        >     org.python.core.PyBaseCode.call(PyBaseCode.java:170)
        >     org.python.core.PyFunction.__call__(PyFunction.java:434)
        >     org.python.core.PyMethod.__call__(PyMethod.java:156)
        >

org.python.pycode._pyx2.doGet$3(C:\DSpace\webapps\jython\ImpactServlet.py:36)

        >

org.python.pycode._pyx2.call_function(C:\DSpace\webapps\jython\ImpactServlet.py)

        >     org.python.core.PyTableCode.ca
        <http://org.python.core.PyTableCode.ca>ll(PyTableCode.java:167)
        >     org.python.core.PyBaseCode.call(PyBaseCode.java:307)
        >     org.python.core.PyBaseCode.call(PyBaseCode.java:198)
        >     org.python.core.PyFunction.__call__(PyFunction.java:482)
        >

org.python.core.PyMethod.instancemethod___call__(PyMethod.java:237)
        >     org.python.core.PyMethod.__call__(PyMethod.java:228)
        >     org.python.core.PyMethod.__call__(PyMethod.java:218)
        >     org.python.core.PyMethod.__call__(PyMethod.java:213)
        >     org.python.core.PyObject._jcallexc(PyObject.java:3626)
        >     org.python.proxies.__main__$ImpactServlet$6.doGet(Unknown
        Source)
        >     javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
        >
        org.python.proxies.__main__$ImpactServlet$6.service(Unknown
Source)
        >     javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
        >     org.python.util.PyServlet.service(PyServlet.java:155)
        >     org.apache.tomcat.websocket.se

<http://org.apache.tomcat.websocket.se>rver.WsFilter.doFilter(WsFilter.java:52)

        >
        >
        >
        > Can you please comment on what could be the cause of this
        error and how
        > to resolve this?
        >
        > Thanks in advance and best regards,
        > euler
        >
        > On Friday, December 18, 2015 at 8:40:01 PM UTC+8, Àlex Magaz
        Graça wrote:
        >
        >     El 06/11/15 a las 13:27, helix84 escribió:
        >     > 1) Register for Thomson's AMR.
        >     >
        >     > 2) Follow steps 1-4 from here:
        >     >
        https://wiki.duraspace.org/display/DSPACE/Jython+webapp+for+DSpace

<https://wiki.duraspace.org/display/DSPACE/Jython+webapp+for+DSpace>

        >

<https://wiki.duraspace.org/display/DSPACE/Jython+webapp+for+DSpace

<https://wiki.duraspace.org/display/DSPACE/Jython+webapp+for+DSpace>>

        >     >
        >     > 3) Copy the attached file into the webapp.
        >     >
        >     > 4) Get the data like this:
        >     >
        http://example.com/webapp/wok_servlet.py?ut=000361215400001
        <http://example.com/webapp/wok_servlet.py?ut=000361215400001>
        >
        <http://example.com/webapp/wok_servlet.py?ut=000361215400001
        <http://example.com/webapp/wok_servlet.py?ut=000361215400001>>
        >     >
        >     > 5) Use either XSLT or JavaScript to parse the xml
        response and
        >     display
        >     > the data. I recommend the later (XMLHttpRequest).
        >     >
        >     >
        >     > Regards,
        >     > ~~helix84
        >     >
        >     > Compulsory reading: DSpace Mailing List Etiquette
        >     >
        https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette
        <https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette>
        >

<https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette
<https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette>>

        >     >
        >     > --
        >     > You received this message because you are subscribed to
        the Google
        >     > Groups "DSpace Technical Support" group.
        >     > To unsubscribe from this group and stop receiving emails
        from it,
        >     send
        >     > an email to [email protected] <javascript:>
        >     > <mailto:[email protected]
        <javascript:>>.
        >     > To post to this group, send email to
        [email protected]
        >     <javascript:>
        >     > <mailto:[email protected] <javascript:>>.
        >     > Visit this group at
        http://groups.google.com/group/dspace-tech
        <http://groups.google.com/group/dspace-tech>
        >     <http://groups.google.com/group/dspace-tech
        <http://groups.google.com/group/dspace-tech>>.
        >     > For more options, visit
        https://groups.google.com/d/optout
        <https://groups.google.com/d/optout>
        >     <https://groups.google.com/d/optout
        <https://groups.google.com/d/optout>>.
        >     Hi,
        >
        >     I've made some adaptations to the script and added Scopus
        citations
        >     too. In case someone finds it useful, I'm sharing it,
        along with the
        >     UI code, in a gist:
        >
        >     https://gist.github.com/rivaldi8/7a9f2483d5648e570d4c
        <https://gist.github.com/rivaldi8/7a9f2483d5648e570d4c>
        >     <https://gist.github.com/rivaldi8/7a9f2483d5648e570d4c
        <https://gist.github.com/rivaldi8/7a9f2483d5648e570d4c>>
        >
        >     Cheers,
        >     Àlex
        >
        > --
        > You received this message because you are subscribed to the
        Google
        > Groups "DSpace Technical Support" group.
        > To unsubscribe from this group and stop receiving emails from
        it, send
        > an email to [email protected]
        > <mailto:[email protected]>.
        > To post to this group, send email to [email protected]
        > <mailto:[email protected]>.
        > Visit this group at https://groups.google.com/group/dspace-tech
        <https://groups.google.com/group/dspace-tech>.
        > For more options, visit https://groups.google.com/d/optout
        <https://groups.google.com/d/optout>.
        Hi euler,

        Sorry for the late response, I've been on holidays.

        I also have these errors logged by Tomcat. If apart from these
        errors, you are getting proper citation counts in item pages,
        don't worry. It's just lack of error control. Ideally the code
        should check no error has been received from the server, whether
        the DOI has been found or not, etc. To keep it simple, I decided
        that if anything failed, the client JavaScript would just skip
        the rendering of the citation count.

        Apart from the errors logged, I haven't noticed any problem, so
        I didn't think it worth spending more time on it. Please, let me
        know If you've had any problem caused by it or think it might be
        problematic.

        Cheers,
        Àlex

    --
    You received this message because you are subscribed to the Google
    Groups "DSpace Technical Support" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to [email protected]
    <mailto:[email protected]>.
    To post to this group, send email to [email protected]
    <mailto:[email protected]>.
    Visit this group at https://groups.google.com/group/dspace-tech
    <https://groups.google.com/group/dspace-tech>.
    For more options, visit https://groups.google.com/d/optout
    <https://groups.google.com/d/optout>.


--
You received this message because you are subscribed to the Google
Groups "DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.

That's right, it depends on some Python modules. Apart from requests, you may also need to add chardet, urllib3 and six.

You may want to try building it with Maven which will take care of installing the modules. I'm attaching the full source tree of the impact webapp. Just unpack it into your DSpace source and run Maven. The downloading of Jython libraries isn't very reliable. You may have to run it more than once until it succeeds.

Cheers,
Àlex

--
You received this message because you are subscribed to the Google Groups "DSpace 
Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.

Attachment: impact.tar.gz
Description: application/gzip

Reply via email to