[Dspace-tech] DSpace 5.2, Tomcat 8, JSPUI and servlet-api version problems?

196 views
Skip to first unread message

Michael White

unread,
Aug 26, 2015, 2:33:50 PM8/26/15
to dspac...@lists.sourceforge.net
Hi,

I've been trying to bring up a brand new install of DSpace 5.2 on a shiny new box with the following:

Debian 8
OpenJDK 7U79
Maven 3.0.5
Ant 1.9.4
PostgreSQL 9.4
Tomcat 8.0.14

I've been able to build and deploy, but when I try and access the JSPUI, I get an Internal Server Error (XMLUI works OK, but I want to use JSPUI):

Exception:
org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: [60] in the generated java file: [/var/lib/tomcat8/work/Catalina/localhost/jspui/org/apache/jsp/index_jsp.java]
The method getDispatcherType() is undefined for the type HttpServletRequest

Stacktrace:
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:199)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:450)

Maven is a bit of a dark art to me, but from a bit of Googling (and in particular this thread from DSpace tech http://sourceforge.net/p/dspace/mailman/message/33532346/) the problem seems to be a version issue with servlet-api.jar - DSpace is asking/expecting to use v2.5 whereas Tomcat 8 comes with v3.1, which includes "getDispatcherType()". And things are further complicated because they changed the "name of the artefact" with 3.0.1 . . .

The solution appears to be to persuade DSpace to use v3.1 instead of v2.5 (if I'm reading it right?).

So, I updated all the pom.xml files in my dspace source tree - I updated the main (top level) pom.xml file to reference the latest version:

<dependency>
<groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>3.1.0</version>
</dependency>

And updated the Artifact ID in all the others (except dspace-rest/pom.xml which appears to already reference v3.1.0 explicitly, although I don't see this coming through when the system is built) - i.e. in the following files:

dspace-api/pom.xml
dspace-jspui/pom.xml
dspace-lni/dspace-lni-client/pom.xml
dspace-lni/pom.xml
dspace-oai/pom.xml
dspace-rdf/pom.xml
dspace-services/pom.xml
dspace-solr/pom.xml
dspace-sword/pom.xml
dspace-swordv2/pom.xml
dspace-xmlui/pom.xml
dspace/modules/additions/pom.xml
dspace/modules/jspui/pom.xml
dspace/modules/lni/pom.xml
dspace/modules/oai/pom.xml
dspace/modules/rdf/pom.xml
dspace/modules/rest/pom.xml
dspace/modules/sword/pom.xml
dspace/modules/swordv2/pom.xml
dspace/modules/xmlui/pom.xml
dspace/pom.xml

- the following was changed:

<dependency>
<groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
+ <artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>

I then ran:

mvn clean
mvn -U package
cd /usr/src/dspace-5.2-src-release/dspace/target/dspace-installer
ant -Dconfig=/usr/local/dspace/config/dspace.cfg update

- but after re-deploying and restarting tomcat, I still see the same problem :-(

I have also tried completely deleting the Maven repository, the "installed dspace" directory, and all (cached) versions of (expanded) war files, and then running:

mvn clean
mvn package
cd /usr/src/dspace-5.2-src-release/dspace/target/dspace-installer
ant fresh_install

- but same result :-(

I've been round the block a few times trying different things (cleaning everything out, and starting from scratch etc) but have made no progress.

>From my investigations, it still appears that DSpace is fixated on using v2.5 but I have no idea why - if I search for servlet-api jars, I see the target directories still littered with occurrences of v2.5 (and v2.4!) - v3.1 is in there, but well hidden:

# find /usr/src/dspace-5.2-src-release -name '*servlet-api*' -print
/usr/src/dspace-5.2-src-release/dspace-oai/target/dspace-oai-5.2/WEB-INF/lib/servlet-api-2.5-20081211.jar
/usr/src/dspace-5.2-src-release/dspace-oai/target/dspace-oai-5.2/WEB-INF/lib/servlet-api-2.5.jar
/usr/src/dspace-5.2-src-release/dspace-rest/target/dspace-rest-5.2/WEB-INF/lib/servlet-api-2.5-20081211.jar
/usr/src/dspace-5.2-src-release/dspace-xmlui/target/dspace-xmlui-5.2/WEB-INF/lib/servlet-api-2.4.jar
/usr/src/dspace-5.2-src-release/dspace-xmlui/target/dspace-xmlui-5.2/WEB-INF/lib/servlet-api-2.5-20081211.jar
/usr/src/dspace-5.2-src-release/dspace-rdf/target/dspace-rdf-5.2/WEB-INF/lib/servlet-api-2.5-20081211.jar
/usr/src/dspace-5.2-src-release/dspace-jspui/target/dspace-jspui-5.2/WEB-INF/lib/servlet-api-2.5-20081211.jar
/usr/src/dspace-5.2-src-release/dspace/modules/jspui/target/jspui-5.2/WEB-INF/lib/servlet-api-2.5-20081211.jar
/usr/src/dspace-5.2-src-release/dspace/modules/sword/target/sword-5.2/WEB-INF/lib/servlet-api-2.5-20081211.jar
/usr/src/dspace-5.2-src-release/dspace/modules/swordv2/target/swordv2-5.2/WEB-INF/lib/servlet-api-2.4.jar
/usr/src/dspace-5.2-src-release/dspace/modules/swordv2/target/swordv2-5.2/WEB-INF/lib/servlet-api-2.5-20081211.jar
/usr/src/dspace-5.2-src-release/dspace/modules/oai/target/oai-5.2/WEB-INF/lib/servlet-api-2.5-20081211.jar
/usr/src/dspace-5.2-src-release/dspace/modules/oai/target/oai-5.2/WEB-INF/lib/servlet-api-2.5.jar
/usr/src/dspace-5.2-src-release/dspace/modules/xmlui/target/xmlui-5.2/WEB-INF/lib/servlet-api-2.4.jar
/usr/src/dspace-5.2-src-release/dspace/modules/xmlui/target/xmlui-5.2/WEB-INF/lib/servlet-api-2.5-20081211.jar
/usr/src/dspace-5.2-src-release/dspace/modules/rest/target/war/work/org.dspace/dspace-rest/WEB-INF/lib/servlet-api-2.5-20081211.jar
/usr/src/dspace-5.2-src-release/dspace/modules/rest/target/rest-5.2/WEB-INF/lib/servlet-api-2.5-20081211.jar
/usr/src/dspace-5.2-src-release/dspace/modules/rdf/target/war/work/org.dspace/dspace-rdf/WEB-INF/lib/servlet-api-2.5-20081211.jar
/usr/src/dspace-5.2-src-release/dspace/modules/rdf/target/rdf-5.2/WEB-INF/lib/servlet-api-2.5-20081211.jar
/usr/src/dspace-5.2-src-release/dspace/target/dspace-installer/webapps/jspui/WEB-INF/lib/servlet-api-2.5-20081211.jar
/usr/src/dspace-5.2-src-release/dspace/target/dspace-installer/webapps/sword/WEB-INF/lib/servlet-api-2.5-20081211.jar
/usr/src/dspace-5.2-src-release/dspace/target/dspace-installer/webapps/swordv2/WEB-INF/lib/servlet-api-2.4.jar
/usr/src/dspace-5.2-src-release/dspace/target/dspace-installer/webapps/swordv2/WEB-INF/lib/servlet-api-2.5-20081211.jar
/usr/src/dspace-5.2-src-release/dspace/target/dspace-installer/webapps/oai/WEB-INF/lib/servlet-api-2.5-20081211.jar
/usr/src/dspace-5.2-src-release/dspace/target/dspace-installer/webapps/oai/WEB-INF/lib/servlet-api-2.5.jar
/usr/src/dspace-5.2-src-release/dspace/target/dspace-installer/webapps/xmlui/WEB-INF/lib/servlet-api-2.4.jar
/usr/src/dspace-5.2-src-release/dspace/target/dspace-installer/webapps/xmlui/WEB-INF/lib/servlet-api-2.5-20081211.jar
/usr/src/dspace-5.2-src-release/dspace/target/dspace-installer/webapps/rest/WEB-INF/lib/servlet-api-2.5-20081211.jar
/usr/src/dspace-5.2-src-release/dspace/target/dspace-installer/webapps/rdf/WEB-INF/lib/servlet-api-2.5-20081211.jar
/usr/src/dspace-5.2-src-release/dspace/target/dspace-installer/lib/javax.servlet-api-3.1.0.jar
/usr/src/dspace-5.2-src-release/dspace/target/dspace-installer/lib/servlet-api-2.5-20081211.jar
/usr/src/dspace-5.2-src-release/dspace/target/dspace-installer/lib/servlet-api-2.5.jar
/usr/src/dspace-5.2-src-release/dspace-swordv2/target/dspace-swordv2-5.2/WEB-INF/lib/servlet-api-2.4.jar
/usr/src/dspace-5.2-src-release/dspace-swordv2/target/dspace-swordv2-5.2/WEB-INF/lib/servlet-api-2.5-20081211.jar
/usr/src/dspace-5.2-src-release/dspace-sword/target/dspace-sword-5.2/WEB-INF/lib/servlet-api-2.5-20081211.jar

I am now officially at a loss as to what to try next in order to get the DSpace 5.2 JSPUI up and running under tomcat 8 :-(

Should what I did have worked (i.e. if I can just get the system to forget what it thinks it should be doing and actually use the pom files as configured, this should work)? Have I missed a step or something obvious? Am I just being dense?

If anyone else has run into this problem and worked their way around it, I would welcome any insights you have to share as I've been banging my head against this for a while now and I'm starting to lose the will to develop ;-(

Help! :-)

Cheers,

Mike

Michael White
eLearning Developer
Information Services

T: (01786) 466877
E: michae...@stir.ac.uk
A: S8, Library, University of Stirling, Stirling, FK9 4LA


--
The University is ranked in the QS World Rankings of the top 5% of universities in the world (QS World University Rankings, 2014)
The University of Stirling is a charity registered in Scotland,
number SC 011159.


euler

unread,
Aug 26, 2015, 2:33:51 PM8/26/15
to dspac...@lists.sourceforge.net
Hi Michael,

Perhaps this post from SO [1] can help you. Although I can see that you
already updated your pom files.
[1] http://stackoverflow.com/q/29797833/1919069
<http://stackoverflow.com/q/29797833/1919069>

Regards,
euler



--
View this message in context: http://dspace.2283337.n4.nabble.com/DSpace-5-2-Tomcat-8-JSPUI-and-servlet-api-version-problems-tp4678049p4678050.html
Sent from the DSpace - Tech mailing list archive at Nabble.com.

Mark H. Wood

unread,
Aug 26, 2015, 2:33:52 PM8/26/15
to dspac...@lists.sourceforge.net
I think you may be seeing https://jira.duraspace.org/browse/DS-2502
(Incorrect dependencies drag javax.servlet:servlet-api into all
webapp.s)

There's an untested patch at https://github.com/DSpace/DSpace/pull/953

--
Mark H. Wood
Lead Technology Analyst

University Library
Indiana University - Purdue University Indianapolis
755 W. Michigan Street
Indianapolis, IN 46202
317-274-0749
www.ulib.iupui.edu
signature.asc

Mark H. Wood

unread,
Aug 26, 2015, 2:33:53 PM8/26/15
to dspac...@lists.sourceforge.net
Sorry, my previous post was a bit terse.

DSpace should not be including *any* version of servlet-api.jar in its
webapp.s. The Servlet spec. requires that this be provided by the
container. The PR previously mentioned is meant to prevent
servlet-api being pulled in.

I would be interested to learn whether this patch is helpful.
signature.asc
Reply all
Reply to author
Forward
0 new messages