I managed to set up artifactory using our existing tomcat. I have set to ARTIFACTORY_HOME=/opt/artifactory, that part works well. There is, however, also the jfrog access.war file, which needs to be running as well. I didn't figure out which variable to use to specify its home, therefore it defaults to ~/.jfrog_access, which is not at all what I like.

I moved the content over to my $ARTIFACTORY_HOME/access and symlinked it, but that's not the way to go for sure. Any help appreciated.

In case someone is stumbling over this thread and struggles with the same problem:

Solution for me was to also extract the Context files (access.xml and artifactory.xml which are available in the zip file under <zip extract>/misc/tomcat) to the Tomcat configuration folder, e.g. $CATALINA_HOME/conf/Catalina/localhost/. After that the $ARTIFACTORY_HOME env will be recognized on Access startup.

A previous answer finally put me on the right track for solving this problem on Amazon Linux.

In addition to copying access.xml and artifactory.xml to ${catalina.home}/host/MY_HOSTNAME, I found that some other changes were needed.

I modified the docBase attributes in the XML context files because my server has multiple hostnames:

/usr/share/tomcat8/conf/Catalina/repo.mydomain.org/access.xml

<Context path="/access" docBase="${catalina.home}/host/repo.mydomain.org/access.war">
    <Parameter name="jfrog.access.bundled" value="true" override="true"/>
    <!-- enable annotations scanning of access jar files -->
    <JarScanner scanClassPath="false">
        <JarScanFilter defaultPluggabilityScan="false" pluggabilityScan="access*" defaultTldScan="false"/>
    </JarScanner>
</Context>

/usr/share/tomcat8/conf/Catalina/repo.mydomain.org/artifactory.xml

<Context crossContext="true" path="/artifactory" docBase="${catalina.home}/host/repo.mydomain.org/artifactory.war">
</Context>

Important Note: In order to prevent the above two XML files from being deleted by Tomcat Manager during upgrades via Undeploy/Deploy WAR, make sure they are owned by root and not writable by the tomcat user:

chown root.root access.xml artifactory.xml
chmod 644 access.xml artifactory.xml

If you forget to do the above, you will likely end up missing these files, which will break the communication between the access and artifactory web applications, resulting in login failures ("Username or Password Are Incorrect"). In this case, these errors result from the lack of communication between the web applications, not a problem with the credentials themselves.


/usr/share/tomcat8/conf/Catalina/repo.mydomain.org/manager.xml

This gives me the ability to upload new versions of access.war and artifactory.war via https://repo.mydomain.org:8443/manager/html:

<Context docBase="${catalina.home}/webapps/manager" privileged="true" antiResourceLocking="false">
</Context>

Additionally, I created the following folder to serve as the artifactory.home:

sudo mkdir /usr/share/artifactory
sudo chown tomcat.tomcat /usr/share/artifactory

tomcat8.conf

Add (or modify) the following line:

JAVA_OPTS="-Dartifactory.home=/usr/share/artifactory -Djfrog.access.home=/usr/share/artifactory/access -Dartifactory.access.client.serverUrl.override=http://localhost:8080/access"

Note: The Access Client URL specified above must use localhost in order to avoid the Server HTTP parameter from being overwritten by Apache and its modules. For instance, if I use:

https://repo.mydomain.org/access/api/v1/system/ping

The Server HTTP header value in the response is:

Server: Apache/2.4.33 (Amazon) OpenSSL/1.0.2k-fips mod_jk/1.2.43

And the Access Client produces the following exception:

[ERROR] (o.j.a.c.AccessClientImpl:154) - Access client/server version mismatch. Client version: 4.1.5, Server version: 2.4.33 (Amazon) OpenSSL

Which means the Access Client is depending on the first string matching #.#.# in the server header. This seems like a really fragile part of the Access Client. They should have used X-JFrog-Access-Server or something instead of trying to control a value that is set by the web server. So, to reiterate, use http://localhost:8080/access to connect directly to the tomcat server.


Artifactory 6.2.0 depends on Apache Derby (the specific version can be found in jfrog-artifactory-oss-6.2.0.zip\artifactory-oss-6.2.0\tomcat\lib). This should be added as a shared library to Tomcat:

mkdir /usr/share/tomcat8/shared
cd /usr/share/tomcat8/shared
wget http://central.maven.org/maven2/org/apache/derby/derby/10.11.1.1/derby-10.11.1.1.jar

Add or modify the following line in catalina.properties:

shared.loader=${catalina.home}/shared/*.jar

Since we want https://repo.mydomain.org to go to the Artifactory webapp:

mkdir /usr/share/tomcat8/host/repo.mydomain.org/ROOT
echo '<html><head><meta http-equiv="refresh" content="0;URL=/artifactory"></meta></head><body></body></html>' > /usr/share/tomcat8/host/repo.mydomain.org/ROOT/index.html

And make sure the services automatically start on reboot:

sudo chkconfig httpd on
sudo chkconfig tomcat8 on

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.