REST API not working

259 views
Skip to first unread message

George Kozak

unread,
Jan 22, 2018, 1:30:22 PM1/22/18
to DSpace Technical Support
Hi...
I wrote about this back on January 8th, but didn't get any replies...so I am trying again :-)
In our DSpace 6.2 installation, if I try to access the REST API, the system responds with "Page Not Found" as if I had typed in an inaccurate URL.  It does this even when I try:
curl https://<my dspace install>/rest/test

In the tomcat server.xml, I have:
<Context path="/rest" docBase="/[path to my tomcat]/webapps/rest" />  

Does anyone have any ideas why the code would not recognize the REST API?
(PS: it worked fine in DSpace 5.5)
Thanks!

--
***************************
George Kozak
Digital Library Specialist
Cornell University Library - IT
218 Olin Library
Cornell University
Ithaca, NY 14853
607-255-8924

Hardy Pottinger

unread,
Jan 22, 2018, 2:11:27 PM1/22/18
to George Kozak, DSpace Technical Support
Hi, George, by any chance are you putting your Tomcat server behind a reverse proxy? If so, you'll probably want to drop the security constraint for the REST-API, since you don't need to encrypt traffic between the reverse proxy and Tomcat. Here's an example of what I mean:


Now, be careful, do *not* drop that constraint if you're exposing Tomcat to the world. :-)

--Hardy

--
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+unsubscribe@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.

George Kozak

unread,
Jan 22, 2018, 3:27:51 PM1/22/18
to Hardy Pottinger, DSpace Technical Support
Hi, Hardy:

Thanks for the suggestion.  Yes, our tomcat sits behind a reverse proxy.  However, after removing the Security constraint from the web.xml for the Rest API, and restarting tomcat, I still get the same "Page Not Found" error.  I'm definitely stumped.
George
   

George Kozak

unread,
Jan 22, 2018, 4:13:24 PM1/22/18
to Hardy Pottinger, DSpace Technical Support
Hi, Hardy:
I think I found the problem in the catalina.out log.
I see:
SEVERE: Error listenerStart
SEVERE: Context [/rest] startup failed due to previous errors
SEVERE: Exception sending context destroyed event to listener instance of class org.dspace.app.util.DSpaceWebappListener

So, for some reason the Rest API is failing.  Still not sure why, but I will continue to dig.
George 

On Mon, Jan 22, 2018 at 2:11 PM, Hardy Pottinger <hardy.p...@gmail.com> wrote:

Mark H. Wood

unread,
Jan 23, 2018, 8:23:58 AM1/23/18
to DSpace Technical Support
On Monday, January 22, 2018 at 4:13:24 PM UTC-5, George Kozak wrote:
Hi, Hardy:
I think I found the problem in the catalina.out log.
I see:
SEVERE: Error listenerStart
SEVERE: Context [/rest] startup failed due to previous errors
SEVERE: Exception sending context destroyed event to listener instance of class org.dspace.app.util.DSpaceWebappListener

So, for some reason the Rest API is failing.  Still not sure why, but I will continue to dig.



There may be more clues in the Tomcat log for the specific <Host>, such as localhost.2018-01-18.log

Paul Warner

unread,
Jan 24, 2018, 2:14:00 AM1/24/18
to DSpace Technical Support
Hi,

It sounds like you are having other problems, George, but I just struggled with Dspace's Rest interface, and I can confirm the Apache Proxy/ReverseProxy problem.  That stumped me for a while, because we are running https through Apache, and I thought I should leave the https in.  But we are not using https for Tomcat, of course (duh!), since it is running behind Apache - so I had to comment out the https segment in the Rest config before I could get it to work.  I have tomcat configured to listen only on localhost, so I can now access the Rest interface only on that machine.  I use curl on the command line.  Everything works.  But I have not included rest in the Proxy/ReverseProxy list for Apache, so it is not available in the browser.  I get a 404 just like you do, George.  I do not want everyone to be able to use it online, so this suits me.  

I post this because these kinds of fine points can be overlooked.  I hope it helps someone.

Best regards,
Paul

George Kozak

unread,
Jan 24, 2018, 11:02:44 AM1/24/18
to Paul Warner, DSpace Technical Support
Thanks, Paul:
I will try and see if I can get things working following your directions.
George

--
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+unsubscribe@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.

George Kozak

unread,
Jan 24, 2018, 11:05:09 AM1/24/18
to Mark H. Wood, DSpace Technical Support
Thanks, Mark...I will keep digging.
George

--
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+unsubscribe@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.
Reply all
Reply to author
Forward
0 new messages