Enabling REST interface

55 views
Skip to first unread message

Sean Carte

unread,
Nov 13, 2018, 1:45:06 AM11/13/18
to dspac...@googlegroups.com
I'm trying to enable the REST interface, but am just getting a 404:
curl -s -H "Accept: application/xml" http://localhost:8080/rest/communities
<html><head><title>Apache Tomcat/7.0.68 (Ubuntu) - Error report</title><style>...<h1>HTTP Status 404 - </h1>...

I created a context:
/etc/tomcat7/Catalina/localhost/rest.xml:
<?xml version='1.0'?>
<Context
        path="/rest"
        docBase="/dspacecris-dut/webapps/rest"
/>

And disabled SSL by commenting out the security-constraint section in:
/dspacecris-dut/webapps/rest/WEB-INF/web.xml

These lines from catalina.out seem relevant:

INFO: Deploying configuration descriptor /etc/tomcat7/Catalina/localhost/rest.xml
Nov 13, 2018 8:32:06 AM org.apache.catalina.loader.WebappClassLoaderBase validateJarFile
INFO: validateJarFile(/dspacecris-dut/webapps/rest/WEB-INF/lib/el-api-1.0.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class
Nov 13, 2018 8:32:06 AM org.apache.catalina.loader.WebappClassLoaderBase validateJarFile
INFO: validateJarFile(/dspacecris-dut/webapps/rest/WEB-INF/lib/jsp-api-2.1.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class
INFO: Deployment of configuration descriptor /etc/tomcat7/Catalina/localhost/rest.xml has finished in 34,892 ms

Any ideas what else I can do?


DSpace version:  CRIS-5.8.1-SNAPSHOT
  SCM revision:  9e925eeed17155160c031f3775d5fec6436d79bf
    SCM branch:  dspace-5_x_x-cris
            OS:  Linux(amd64) version 4.4.0-138-generic
...
     Discovery:  enabled.
           JRE:  Oracle Corporation version 1.8.0_181
   Ant version:  Apache Ant(TM) version 1.9.6 compiled on July 8 2015
 Maven version:  3.3.9
tomcat 7
postgres 9.5
--

Alan Orth

unread,
Nov 14, 2018, 4:30:16 AM11/14/18
to Sean Carte, dspac...@googlegroups.com
Dear Sean,

Does the root path for the rest API work, ie /rest? Also, some basic sanity checking: make sure the path you gave as the context docBase exists:

$ ls -l /dspacecris-dut/webapps/rest

Cheers,

--
All messages to this mailing list should adhere to the DuraSpace Code of Conduct: https://duraspace.org/about/policies/code-of-conduct/
---
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 dspace-tech...@googlegroups.com.
To post to this group, send email to dspac...@googlegroups.com.
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.


--
Alan Orth
alan...@gmail.com
https://picturingjordan.com
https://englishbulgaria.net
https://mjanja.ch
"In heaven all the interesting people are missing." ―Friedrich Nietzsche

Sean Carte

unread,
Nov 14, 2018, 4:42:15 AM11/14/18
to Alan Orth, dspac...@googlegroups.com
Also, the permissions are the same as for all the other webapps, including sword2 and jspui, which do work.

On Wed, 14 Nov 2018 at 11:40, Sean Carte <sean....@gmail.com> wrote:
Thanks for responding, Alan.

Yes, the path exists:
dspace@dev-ir:~$ ls /dspacecris-dut/webapps/rest/
ametrics  common  css  image  index.jsp  js  META-INF  static  WEB-INF

Same 404 for the root:
dspace@dev-ir:~$ curl -s -H "Accept: application/xml" http://localhost:8080/rest<html><head><title>Apache Tomcat/7.0.68 (Ubuntu) - Error report</title>...<h1>HTTP Status 404 - </h1>...


--

Alan Orth

unread,
Nov 14, 2018, 4:46:58 AM11/14/18
to Sean Carte, dspac...@googlegroups.com
Dear Sean,

It's "good" that the /rest path doesn't work either. So something is wrong with the loading of this application. Restart Tomcat and watch the logs as it loads each application (xmlui, solr, rest, etc). On Ubuntu that would be the general Tomcat Catalina logs[0] and localhost container logs[1].

Regards,

[0] /var/log/tomcat7/catalina.out
[1] /var/log/tomcat7/localhost.2018-11-14.log

Sean Carte

unread,
Nov 14, 2018, 5:05:08 AM11/14/18
to Alan Orth, dspac...@googlegroups.com
The /var/log/tomcat7/localhost.2018-11.14.log has some interesting info:
...
INFO: Marking servlet DSpace REST API as unavailable
Nov 14, 2018 4:08:51 AM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet [DSpace REST API] in web application [/rest] threw load() exception
java.lang.ClassNotFoundException: com.sun.jersey.spi.spring.container.servlet.SpringServlet
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1859)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1702)
        at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:504)
        at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:486)
        at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:113)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1146)
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1085)
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5318)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5610)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
        at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:677)
        at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1962)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

Looks like I'm missing the SpringServlet class, but where would I get this?

I'm using openjdk version "1.8.0_181", if that's at all relevant.
--

Alan Orth

unread,
Nov 15, 2018, 3:26:23 AM11/15/18
to Sean Carte, dspac...@googlegroups.com
Dear Sean,

I'm not sure which package provides the SpringServlet class, but I have the following in my REST application directory on DSpace 5.8:

dspace/webapps/rest/WEB-INF/lib/spring-aop-3.1.1.RELEASE.jar
dspace/webapps/rest/WEB-INF/lib/spring-asm-3.1.1.RELEASE.jar
dspace/webapps/rest/WEB-INF/lib/spring-beans-3.1.1.RELEASE.jar
dspace/webapps/rest/WEB-INF/lib/spring-context-3.1.1.RELEASE.jar
dspace/webapps/rest/WEB-INF/lib/spring-context-support-3.1.1.RELEASE.jar
dspace/webapps/rest/WEB-INF/lib/spring-core-3.1.1.RELEASE.jar
dspace/webapps/rest/WEB-INF/lib/spring-expression-3.1.1.RELEASE.jar
dspace/webapps/rest/WEB-INF/lib/spring-web-3.1.1.RELEASE.jar

Are you using a source or binary build for DSpace? Maybe you should try to mvn package again?

Regards,

Terry Brady

unread,
Nov 15, 2018, 1:58:36 PM11/15/18
to sean....@gmail.com, Alan Orth, dspac...@googlegroups.com
If you are running DSpace 5+, the REST api requires ssh by default.

You can comment that requirement out in the web.xml file for the rest webapp.

Terry Brady
Applications Programmer Analyst
Georgetown University Library Information Technology
425-298-5498 (Seattle, WA)

Sean Carte

unread,
Nov 16, 2018, 12:38:31 AM11/16/18
to Terry...@georgetown.edu, Alan Orth, dspac...@googlegroups.com
Thanks, Terry, I did comment out the security-constraint section in:
/dspacecris-dut/webapps/rest/WEB-INF/web.xml
--

Sean Carte

unread,
Nov 16, 2018, 6:22:59 AM11/16/18
to Alan Orth, dspac...@googlegroups.com
Hi Alan

I installed a new instance of DSpace-CRIS, and the REST interface does work.

Unfortunately, I'm still a bit stuck as the version on https://github.com/4Science/DSpace is 5.10, but the version I have installed on my production and dev servers is 5.8. I would simply upgrade, but Symplectics is integrating Elements (yes, I know: we're integrating a RIMS and CRIS ...) and they say they have problems with SWORDv2 in DSpace 5.10. Since I can't find a way to download any but the current version (dspace-5_x_x-cris) from github, I guess I'm stuck.

I did try copying the 5.10 webapps/rest/WEB-INF/lib/ to the 5.8 server, but that doesn't make any difference.

Anyway, thank you very much for your help, Alan. At least we know that a solution exists.
--

Reply all
Reply to author
Forward
0 new messages