Friday, August 7, 2015

Getting to the Nexus of the problem of Nexus-OSS on TomEE-RS...

As I have mentioned on previous posts, I am trying to move my development target to Apache TomEE.

As part of that, I am also trying to make my laptop into a complete development environment that includes:

  • TomEE to host my apps (and development tools)
  • Nexus-OSS for repository management (one of those aforementioned dev tools)
  • MariaDB as a database

Well, to start with - I run Kubuntu. So, I installed Tomcat 7 the usual 'apt-get' way and followed the directions on the TomEE site for installing it as a WAR (I used the TomEE-RS version) onto an existing server. Pretty straight forward.

MariaDB required a bit of back and forth with installing and purging Maria vs MySQL but eventually it settled down and I did not need to manually change anything.

Nexus caused some trouble. I found a good list of steps for doing the install here:

http://www.hackrunner.com/2012/04/installing-nexus/

That post is a bit dated - so, I adapted as I typed because I was working with Tomcat 7 and Nexus 2.11.4.

  1. sudo mkdir /usr/share/tomcat7/sonatype-work
  2. sudo chown tomcat7:tomcat7 /usr/share/tomcat7/sonatype-work
  3. wget http://www.sonatype.org/downloads/nexus-2.11.4.war
  4. sudo cp nexus-2.11.4.war /var/lib/tomcat7/webapps/nexus.war

And, it looked like it was working until - it didn't. I got an error in the log file that included:

java.lang.RuntimeException: javax.naming.NameNotFoundException: Name [com] is not bound in this Context. Unable to find [com].

So I searched for some solution online. There was nothing specifically related to installing Nexus on TomEE. Instead, there were results about installing apps that included Jersey on TomEE. People were running into trouble because there is already REST support in the TomEE-RS server. The solution was to remove Jersey from the WAR file that you are trying to deploy (as well as whatever references there are to the included jars in web.xml).

The Nexus WAR was already exploded so, I checked the web.xml to see if there were any references to Jersey - Nope. But, there were several jar files hiding in the WEB-INF directory. I got rid of those with these commands (hoping that it would not end up removing something that I actually needed):

cd /var/lib/tomcat7/webapps/nexus
find . -name jersey* -exec sudo rm -v {} +

And, restarted Tomcat...


Success!

Now, as a note - I probably should have at least specified that the find search for jar files rather than any old file that had a name starting with 'jersey'. I did know that there were only jar files because I had already done the search once before adding the remove. If you are going to try this for something other than installing Nexus on TomEE-RS make sure that you have verified what is going to be removed first.
Post a Comment