问题
I am trying to deploy Apache Archiva on my Server, but it just fails all the time.
specs:
os: ubuntu 10.04
tomcat: Apache Tomcat/6.0.24
jvm: 1.6.0_27-b27
$CATALINA_HOME : /usr/share/tomcat6
$CATALINA_BASE : /var/lib/tomcat6
$CATALINA_OPTS : "-Dappserver.home=$CATALINA_HOME -Dappserver.base=$CATALINA_BASE"
path to lib : $CATALINA_BASE/common/lib
#java -version
java version "1.6.0_27"
OpenJDK Runtime Environment (IcedTea6 1.12.3) (6b27-1.12.3-0ubuntu1~10.04.1)
OpenJDK Client VM (build 20.0-b12, mixed mode, sharing)
Tomcat itself is up and running. I followed the instructions on this page, copied all the necessary jars to the lib (location specified above), created the archiva.xml
in /var/lib/tomcat6/conf/Catalina/localhost/
with that content:
<Context path="/archiva" docBase="/var/lib/tomcat6/archiva/apache-archiva-1.4-M4.war">
<Resource name="jdbc/users"
auth="Container"
type="javax.sql.DataSource"
username="philipp"
password="xxx"
driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
url="jdbc:derby:////localhost:1527/archivausers;create=true" />
<Resource name="jdbc/archiva"
auth="Container"
type="javax.sql.DataSource"
username="philipp"
password="xxx"
driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
url="jdbc:derby://localhost:1527/archivadata;create=true" />
<Resource name="mail/Session"
auth="Container"
type="javax.mail.Session"
mail.smtp.host="localhost"/>
</Context>
After a click on »start« in the tomcat manager: FAIL - Application at context path /archiva could not be started
the last lines on the catalina.out
are:
SCHWERWIEGEND: A web application created a ThreadLocal with key of type[java.lang.ThreadLocal] (value [java.lang.ThreadLocal@69bf9]) and a value of type [org.apache.logging.log4j.core.impl.Log4jLogEvent] (value [Logger=org.springframework.web.context.ContextLoader Level=ERROR Message=Context initialization failed]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
11.06.2013 16:29:30 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SCHWERWIEGEND: A web application created a ThreadLocal with key of type [null] (value [org.apache.logging.log4j.spi.DefaultThreadContextMap$1@1ea380c]) and a value of type [null] (value [null]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
I tried more or less everything what came to my mind, but always FAIL!
Any Idea?
回答1:
Since I could manage to get it running I think it could be useful for somebody else to share the steps I have taken. These descriptions assume that one has already has read the official installation Instructions of archiva and should be a kind of additional explanation due to the fact that the official documentation could be a bit more verbose.
First I downloaded the »war« and stored it in /var/lib/tomcat6/archiva
, this defines the starting point.
1. Database:
In the official instruction one is asked to download derby.jar
and derbytools.jar
to save them in $CATALINA_HOME/lib
(in my case that points to /usr/share/tomcat6/lib
) to make the files available for all web application running on this tomcat. On my research I came over the apache derby project where I also found this command:
sudo apt-get install sun-javadb-core sun-javadb-client
which just installs the derby db (in my case I had to add »multiverse« in /etc/apt/sources.list
at the of one source). After that I run:
sudo ln -s /usr/share/javadb/lib/*.jar -t /usr/share/tomcat6/lib
what linked all needed derby-jars to the tomcat lib (probably some are not needed there). After that I created the directory db
in /var/lib/tomcat6/archiva
and changed its owner and group to tomcat6, but it is up to you where you want to store the database files, but it is important not to create the two subdirectories for the two needed databases, namly: users
and archiva
, inside that directory.
2. Mail
There I followed the Instructions and copied mail.jar
and activation.jar
to tomcats library.
3. archiva home directory
One of the Errors that prevented archiva from running was that it tried to create a home Directory in /usr/share/tomcat6/.m2
, but that resulted in an permission conflict, so I created that directory and changed group and owner to tomcat6.
Last but not least I cared about the archiva.xml
, located in in /var/lib/conf/Catalina/localhost
. Since the paths that should be replaced were not marked in »bold« it is kind of easy to oversee them, so I try to do that here, using ${path}
to point that out:
<Context path="/archiva"
docBase="${path to the archiva war archive here}">
<Resource name="jdbc/users"
auth="Container"
type="javax.sql.DataSource"
username="sa"
password=""
driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
url="jdbc:derby:${path to the db folder}/users;create=true" />
<Resource name="jdbc/archiva"
auth="Container"
type="javax.sql.DataSource"
username="sa"
password=""
driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
url="jdbc:derby:${path to db folder}/archiva;create=true" />
<Resource name="mail/Session"
auth="Container"
type="javax.mail.Session"
mail.smtp.host="localhost"/>
</Context>
That should be everything and I hope that I did not forgot anything to mention. Searching the catalina.out
for error logs is a kind of senseless since the messages in there do not describe explicit problems, therefor I want to suggest to read localhost.${date}.log
in the same directory, therein I could find debug information which was much more useful.
p.s.: After the Installation of Archiva did the very same Steps for Apache Continuum, just replacing folder- and filenames, what resulted in a running Installation, too.
Happy Install, cheers!
来源:https://stackoverflow.com/questions/17046850/deploy-apache-archiva-on-tomcat-6