Install woes

62 views
Skip to first unread message

Paul Hoffman

unread,
Aug 27, 2015, 6:37:47 PM8/27/15
to fedora-c...@googlegroups.com
I've installed Fedora 4.3.0 on Ubuntu 14.04 using OpenJDK 8 and Jetty 8
but it doesn't appear to be running correctly, and I'm hoping that
someone who has deployed Fedora under Jetty might have some words of
wisdom as to what I should do next.

I've been following the Deploying Fedora 4 Complete Guide, though not to
the letter as it's not really written that way.

* Install OpenJDK 8, Jetty 8, Solr
* Copy fcrepo-webapp-4.3.0.war to ~jetty/webapps
* Start up Jetty (service jetty8 start)
* Create a data directory at /var/local/fedora-data
* chown -R jetty:jetty ~jetty /var/local/fedora-data

I set the following in /etc/default/jetty8:

NO_START=0
VERBOSE=yes
JAVA_OPTIONS="-Xmx256m -Djava.awt.headless=true -Dfcrepo.home=/var/local/fedora-data"
JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"

After starting Jetty I could see that the WAR file was not uncompressed within
~jetty/webapps, but after a little poking around I found it in
/var/cache/jetty8/data along with root and solr webapps:

# ls -l /var/cache/jetty8/data
total 12
drwxr-xr-x 3 jetty jetty 4096 Aug 27 17:03 jetty--8080-fcrepo-webapp-4.3.0-_fcrepo-webapp-4.3.0-any-
drwxr-xr-x 4 jetty jetty 4096 Aug 27 17:03 jetty--8080-root--any-
drwxr-xr-x 4 jetty jetty 4096 Aug 27 17:03 jetty--8080-solr-_solr-any-

However, I don't know what to do next. http://localhost:8080/ leads to a Jetty
welcome page, but http://localhost:8080/rest/ leads to 404 Not Found and
http://localhost:8080/fcrepo-webapp-4.3.0/rest/ leads to 503 Service
Unavailable.

In case it helps, I'll just note that Jetty's log file
(/var/log/jetty8/2015_08_27.stderrout.log) logs something that I find baffling
-- "Object of class 'org.eclipse.jetty.webapp.WebAppContext' is not of type
'org.eclipse.jetty.webapp.WebAppContext'". Huh? I suppose in Java a class is
not a type, but...?

I'm only including the beginning of the log as everything after this
appears to relate to solr:

2015-08-27 17:03:35.339:WARN:oejd.WebAppDeployer:WebAppDeployer is deprecated. Use WebAppProvider
2015-08-27 17:03:35.341:INFO:oejs.Server:jetty-8.1.3.v20120416
2015-08-27 17:03:38.091:WARN:oejw.WebAppContext:Failed startup of context o.e.j.w.WebAppContext{/fcrepo-webapp-4.3.0,file:/var/lib/jetty8/webapps/fcrepo-webapp-4.3.0/},file:/var/lib/jetty8/webapps/fcrepo-webapp-4.3.0/
java.lang.IllegalArgumentException: Object of class 'org.eclipse.jetty.webapp.WebAppContext' is not of type 'org.eclipse.jetty.webapp.WebAppContext'. Object Class and type Class are from different loaders.
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:318)
[call tree truncated]
2015-08-27 17:03:38.145:INFO:oejw.StandardDescriptorProcessor:NO JSP Support for , did not find org.apache.jasper.servlet.JspServlet
2015-08-27 17:03:38.229:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{,file:/var/lib/jetty8/webapps/root/},file:/var/lib/jetty8/webapps/root/
2015-08-27 17:03:38.229:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{,file:/var/lib/jetty8/webapps/root/},file:/var/lib/jetty8/webapps/root/
2015-08-27 17:03:39.017:WARN:oejw.JettyWebXmlConfiguration:Unable to process jetty-web.xml
java.lang.ClassNotFoundException: org.mortbay.jetty.webapp.WebAppContext
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
[call tree truncated]

Thanks in advance,

Paul.

--
Paul Hoffman <pa...@flo.org>
Systems Librarian
Fenway Libraries Online
c/o Wentworth Institute of Technology
550 Huntington Ave.
Boston, MA 02115
(617) 442-2384 (FLO main number)

Andrew Woods

unread,
Aug 27, 2015, 7:29:34 PM8/27/15
to Paul Hoffman, fedora-community
Hello Paul,
Everything you have detailed seems correct. Is it possible that you used to have a Jetty7 on your machine, the residue of which is causing interference?
Andrew

--
You received this message because you are subscribed to the Google Groups "Fedora Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fedora-communi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Paul Hoffman

unread,
Aug 28, 2015, 10:54:47 AM8/28/15
to fedora-community
On Thu, Aug 27, 2015 at 07:29:31PM -0400, Andrew Woods wrote:
> Hello Paul,
> Everything you have detailed seems correct. Is it possible that you used to
> have a Jetty7 on your machine, the residue of which is causing interference?
> http://stackoverflow.com/questions/10492555/jettyrun-causes-class-not-found-exception-for-org-mortbay-jetty-webapp-webappco

Indeed -- and I still do! When I installed Jetty 8 from the OpenJDK PPA
(recall that I am on Ubuntu 14.04) I apparently pulled in Jetty 7 --
probably by installing solr-jetty or some other packages.

Then later I messed up the home dir for jetty, such that its webapps dir
contained Jetty 7 stuff -- grep -rc eclipse vs. grep -rc mortbay made that
clear.

At this point I think I'll try wiping it clean and reinstalling. I'll
remove all Java stuff, then install them using the OpenJDK PPA.

[...time passes...]

And that's done -- I think all is well now but here's what I did, just
for the record...

# apt-get remove jetty jetty8 java-common open-jre-headless [and a bunch of other stuff]

Jetty 7 and 8 couldn't be removed until I got rid of their init scripts:

# rm -f /etc/init.d/jetty*

I also ran apt-get autoremove to get rid of a lot of cruft pulled in (I
gather) by default-jre.

I saved my paltry /etc/default/jetty* files:

# mv /etc/default/jetty* /tmp/

I deleted the jetty user, its home dir, and a bunch of other Jetty dirs
(both 7 and 8):

# userdel -r jetty
# rm -Rf /usr/share/jetty* /var/lib/jetty* /etc/jetty* /var/log/jetty* /etc/cron.daily/jetty*

I then started over with OpenJDK 8:

# apt-get install openjdk-8-jre-headless

When I attempted to reinstall Jetty 8, it wasn't happy that I had
removed the jetty user, so I recreated it (and its group) using the UID
and GID it had before, which I had *not* wisely written down but which
were fortunately still in my scrollback buffer:

# groupadd -g 121 jetty
# useradd -u 112 -g 121 jetty

(It's possible that I've missed some vital secondary groups, but time
will tell.)

Then I tried again and it succeeded:

# apt-get install jetty8

I did *not* install solr-jetty, since it depends on default-jdk (and
default-jre and default-jre-headless, all of which are from Java 7).
Not sure what I'll do about that down the road, but what the heck. :-)

At this point I have only one Java install:

# update-java-alternatives -l
java-1.8.0-openjdk-amd64 1069 /usr/lib/jvm/java-1.8.0-openjdk-amd64

And I don't see any traces of Jetty 7:

# fgrep -rc eclipse ~jetty/etc/
0

So I think I'm in much better shape to get things going.

Thanks for the help!

Andrew Woods

unread,
Aug 28, 2015, 12:25:36 PM8/28/15
to Paul Hoffman, fedora-community
Hello Paul,
Thanks for your detailed notes. It provides a helpful record for the list.
I am glad to hear you are up and running.
Andrew

Paul Hoffman

unread,
Aug 28, 2015, 2:23:34 PM8/28/15
to fedora-community
On Fri, Aug 28, 2015 at 12:25:32PM -0400, Andrew Woods wrote:
> Thanks for your detailed notes. It provides a helpful record for the list.
> I am glad to hear you are up and running.

Oh, I'm not up and running, I'm just unstuck. Well, I'm stuck, but it's
a totally different stuck.

My current problem is missing files -- things I deleted this morning
that I expected to reappear when I reinstalled jetty8 but -- surprise!
-- didn't reappear at all.

I restored the init script (/etc/init.d/jetty8) but when I try to run it
it fails, because /etc/jetty8/jetty.conf doesn't exist. In fact,
/etc/jetty8 is empty except for /etc/jetty8/contexts, which itself is
empty. I deleted all these things, of course, but expected them to
reappear when I reinstalled jetty8. /usr/share/jetty8 was repopulated,
which was nice, but I'm far from up and running.

*Sigh*!

I hate package managers. If I thought it wouldn't just lead to a fresh
new hell, I'd install OpenJDK 9 from source, Jetty 9 from source, etc.,
etc., etc.

Or is that perhaps worth pursuing after all? Has anyone here followed
the Deploying Fedora 4 Complete Guide in a recent(ish) Ubuntu?

Paul.

Alan Witkowski

unread,
Sep 2, 2015, 6:44:03 PM9/2/15
to Fedora Community
I think the more recent versions of fedora require jetty9, or at least that's the impression that i got when i tried and failed to install it. You may have luck with fedora v4.0 or 4.1, but i just ended up going with tomcat instead of jetty in the end.

Anyway, here are the instructions i made for ubuntu 15.04 and tomcat8. 14.04 only has tomcat7 and java7, so you'll at least need to get java8 from a PPA (which looks like you've done). Not sure if it works with tomcat7 but you can try it.

-- Install tomcat 8 --
sudo apt-get purge default-jre default-jre-headless
sudo apt-get install tomcat8 openjdk-8-jre-headless

-- Set up fedora storage --
sudo service tomcat8 stop 
sudo mkdir -p /var/lib/fedora
sudo chown tomcat8:tomcat8 /var/lib/fedora
sudo vi /etc/default/tomcat8

Change JAVA_OPTS to:
JAVA_OPTS="-Djava.awt.headless=true -Xmx2048m -XX:+UseConcMarkSweepGC -Dfcrepo.home=/var/lib/fedora"

-- Download fedora 4.3.0 -- 
sudo mv /var/lib/tomcat8/ROOT /var/lib/tomcat8/_ROOT
sudo mv fcrepo-webapp-4.3.0.war /var/lib/tomcat8/webapps/ROOT.war
sudo chown tomcat8:tomcat8 /var/lib/tomcat8/webapps/ROOT.war

sudo service tomcat8 start

Paul Hoffman

unread,
Sep 3, 2015, 10:28:31 AM9/3/15
to Fedora Community
On Wed, Sep 02, 2015 at 03:38:31PM -0700, Alan Witkowski wrote:
> I think the more recent versions of fedora require jetty9, or at least
> that's the impression that i got when i tried and failed to install it. You
> may have luck with fedora v4.0 or 4.1, but i just ended up going with
> tomcat instead of jetty in the end.
>
> Anyway, here are the instructions i made for ubuntu 15.04 and tomcat8.
> [...]

Thanks, this looks very helpful -- specific commands, yay! I should
probably abandon my preference for Jetty over Tomcat -- a dubious
preference, not grounded in hard experience.

Paul Hoffman

unread,
Sep 14, 2015, 12:38:30 PM9/14/15
to Fedora Community
On Wed, Sep 02, 2015 at 03:38:31PM -0700, Alan Witkowski wrote:
> I think the more recent versions of fedora require jetty9, or at least
> that's the impression that i got when i tried and failed to install it. You
> may have luck with fedora v4.0 or 4.1, but i just ended up going with
> tomcat instead of jetty in the end.
>
> Anyway, here are the instructions i made for ubuntu 15.04 and tomcat8.
> 14.04 only has tomcat7 and java7, so you'll at least need to get java8 from
> a PPA (which looks like you've done). Not sure if it works with tomcat7 but
> you can try it.

Thanks again for the info. Everything seems fine now except I'm not
seeing the feature tour -- do I need a GUI browser to have any hope of
seeing it?

Anyhow, just FTR I'll flesh out your unstructions with some details on
what I did. I'll omit the sudo's since I did it all as root -- lately
sudo has been annoying me.

> -- Install tomcat 8 --
> sudo apt-get purge default-jre default-jre-headless

I started by purging tomcat7:

apt-get purge tomcat7

This resulted in an attempt to stop the tomcat7 service, which failed,
and the failure triggered an attempt to *start* the tomcat7 service,
which failed, causing the purge to fail. Which is so silly...

Somehow I thought to delete the tomcat7 user and try apt-get purge
again, and this did the trick -- no service stop/start nonsense and
tomcat7 is gone.

> sudo apt-get install tomcat8 openjdk-8-jre-headless

I couldn't find a PPA for tomcat8 -- I don't know why I assumed I would
-- so I created the tomcat8 user and group manually, then downloaded the
core binary package from tomcat.apache.org and untarred it in ~tomcat8
(i.e., /var/lib/tomcat8). Naturally this didn't not give me an init
script. If I had kept the init script for tomcat7 I could have tweaked
that for tomcat8, but noooooo...

> -- Set up fedora storage --
> sudo service tomcat8 stop

I skipped this, since it wasn't running.

> sudo mkdir -p /var/lib/fedora
> sudo chown tomcat8:tomcat8 /var/lib/fedora
> sudo vi /etc/default/tomcat8
>
> Change JAVA_OPTS to:
> JAVA_OPTS="-Djava.awt.headless=true -Xmx2048m -XX:+UseConcMarkSweepGC
> -Dfcrepo.home=/var/lib/fedora"

I did it this way:

JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
JAVA_OPTS="-Djava.awt.headless=true"
CATALINA_HOME="/var/lib/tomcat8"
CATALINA_BASE="$CATALINA_HOME"
CATALINA_PID="$CATALINA_BASE/tomcat.pid"
CATALINA_OPTS="-Xmx2048m -XX:+UseConcMarkSweepGC -Dfcrepo.home=/var/lib/fedora"

Though I suspect I'll need multiple CATALINA_BASEs down the road.

> -- Download fedora 4.3.0 --
> wget
> "https://github.com/fcrepo4/fcrepo4/releases/download/fcrepo-4.3.0/fcrepo-webapp-4.3.0.war"
> sudo mv /var/lib/tomcat8/ROOT /var/lib/tomcat8/_ROOT

I think you meant this, which is what I did:

/var/lib/tomcat8/webapps/ROOT /var/lib/tomcat8/webapps/_ROOT

> sudo mv fcrepo-webapp-4.3.0.war /var/lib/tomcat8/webapps/ROOT.war
> sudo chown tomcat8:tomcat8 /var/lib/tomcat8/webapps/ROOT.war

OK, all good so far.

> sudo service tomcat8 start

Happily, my simple init script works.
Yay, it's there -- it's a big text/turtle blob, but it's there:

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Link: <http://www.w3.org/ns/ldp#Resource>;rel="type"
Link: <http://www.w3.org/ns/ldp#Container>;rel="type"
Link: <http://www.w3.org/ns/ldp#BasicContainer>;rel="type"
Accept-Patch: application/sparql-update
Accept-Post: text/turtle,text/rdf+n3,text/n3,application/rdf+xml,application/n-triples,multipart/form-data,application/sparql-update
Allow: MOVE,COPY,DELETE,POST,HEAD,GET,PUT,PATCH,OPTIONS
Preference-Applied: return=representation
Vary: Prefer
Vary: Accept, Range, Accept-Encoding, Accept-Language
Content-Type: text/turtle
Content-Length: 6776
Date: Mon, 14 Sep 2015 16:10:31 GMT

@prefix premis: <http://www.loc.gov/premis/rdf/v1#> .
[etc.]

When I try http://localhost:8080/rest in w3m it gives my a big JSON
blob. At least it's giving me something, but where's the feature tour?
I suspect I have to use a GUI browser (*sigh!*).

Alan Witkowski

unread,
Sep 14, 2015, 12:59:56 PM9/14/15
to fedora-c...@googlegroups.com
Thanks for catching those typos. Looks like you got it working. If you
want html in the response add "Accept: text/html" to your request
header, otherwise it returns text/turtle.

curl http://localhost/rest -H 'Accept: text/html'

Also i learned that if you ever want authentication set up you need to
use this war file instead:
https://github.com/fcrepo4-exts/fcrepo-webapp-plus/releases/download/fcrepo-webapp-plus-4.3.0/fcrepo-webapp-plus-rbacl-audit-4.3.0.war.
The other war doesn't have the BasicRolesAuthorizationDelegate class.

Here are some other basic commands you can test on your new setup.

-- Create new container "test" --
curl -i -X PUT "http://localhost:8080/rest/test"

-- Insert dc terms with file body.rdf --
curl -X PATCH -H "Content-Type: application/sparql-update" --data-binary
"@body.rdf" "http://localhost:8080/rest/test"

body.rdf:
PREFIX dc: <http://purl.org/dc/elements/1.1/>

DELETE { }
INSERT {
<> dc:title "This is the title." ;
dc:subject "Subject goes here."
}
WHERE { }

-- Remove dc term --
curl -X PATCH -H "Content-Type: application/sparql-update" --data-binary
"@delete.rdf" "http://localhost:8080/rest/test"

delete.rdf:
PREFIX dc: <http://purl.org/dc/elements/1.1/>

DELETE WHERE { ?s dc:subject ?o }

-- Delete item --
curl -X DELETE "http://localhost:8080/rest/test"

-- Delete tombstone to reuse url --
curl -X DELETE "http://localhost:8080/rest/test/fcr:tombstone"
Reply all
Reply to author
Forward
0 new messages