title: Apache Usergrid, tomcat7 403 error on database setup
body: <p>I have setup usergrid following this <a href="http://usergrid.apache.org/docs/installation/deployment-guide.html" rel="nofollow">guide</a>.<br>
  Steps I have done include:<br>
  1. Setup Cassandra (<code>nodetool status</code>shows me one healty node and I can log in with <code>cqlsh</code>).<br>
  2. Setup ElasticSearch (<code>curl localhost:9200</code> gives me a nice .json back, everything ok.)<br>
  3. Built the usergrid app with <code>mvn clean install</code> and moved the built <code>ROOT.war</code>to <code>CATALINA_BASE</code><br>
  4. Created <code>usergrid-deployment.properties</code>to <code>CATALINA_HOME</code> at <code>/usr/share/tomcat7</code><br></p>
  
  <p>When I start tomcat7 service everything goes ok, no errors in catalina logs. Last line is "Server Startup". </p>
  
  <p>In <code>catalina.out</code> log I have the line:</p>
  
  <blockquote>
    <p>INFO: Starting Servlet Engine: Apache Tomcat/7.0.52 (Ubuntu)
    Mar 08, 2016 9:33:25 AM org.apache.catalina.startup.HostConfig deployWAR
    <br>INFO: <b>Deploying web application archive /var/lib/tomcat7/webapps/ROOT.war</b><br>
    Mar 08, 2016 10:02:50 AM org.apache.catalina.util.SessionIdGenerator createSecureRandom
    INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [5$<br>
    Mar 08, 2016 10:02:50 AM org.apache.coyote.AbstractProtocol start<br>
    INFO: Starting ProtocolHandler ["http-bio-8080"]
    Mar 08, 2016 10:02:50 AM org.apache.catalina.startup.Catalina start<br>
    INFO: Server startup in 5561 ms</p>
  </blockquote>
  
  <p>So the usergrid app should be running. </p>
  
  <p>I can browse to <code>localhost:8080</code> and see the Tomcat7"It works" - page. </p>
  
  <p>However, when I try to setup the usergrid database like this:</p>
  
  <pre><code>curl -X PUT http://localhost:8080/system/database/setup -u [user]:[password] 
  </code></pre>
  
  <p>I get a 403 error:</p>
  
  <blockquote>
    <p>Access to the specified resource has been forbidden. </p>
  </blockquote>
  
  <p>I am sure that my credentials match those that I have defined in <code>usergrid-deployment.properties</code> in <code>CATALINA_HOME</code> as usergrid <code>sysadmin.login</code> credentials.</p>
  
  <p>In tomcat7 <code>localhost_access_log</code> I have the following output: </p>
  
  <blockquote>
    <p>0:0:0:0:0:0:0:1 - - [08/Mar/2016:12:27:43 +0200] "PUT /system/database/setup HTTP/1.1" 403 979</p>
  </blockquote>
  
  <p>However (number2), when I try <code>curl -v localhost:8080/status</code> to see the status of the usergrid app, I get </p>
  
  <blockquote>
    <p>404 - requested resource is not available</p>
  </blockquote>
  
  <p>So, any help as to what I might do to:
  a) be sure that the usergrid app is deployed correctly with tomcat (as there are no errors in logs
  b) to solve the 403 issue?</p>
  
  <p>Thank you for any help!</p>
  
  <p><b>EDIT:</b></p>
  
  <p>I noticed that my <code>CATALINA_BASE</code>(<code>/var/lib/tomcat/</code>) didn't have the <code>WEB_INF</code>directory inside <code>webapps</code> at all. In the guide I made reference to, we are only instructed to copy the  <code>ROOT.war</code> file to <code>webapps</code> directory. Is this correct? Should I also copy the WEB-INF files from the usergrid stack?</p>
  
  <p>Here is what the guide says: <br>
  <i>The next step is to deploy the Usergrid Stack software to Tomcat. There are a variey of ways of doing this and the simplest is probably to place the Usergrid Stack ROOT.war file into the Tomcat webapps directory, then restart Tomcat.</i><br><br>
  I tried copying the <code>WEB-INF</code> files to <code>CATALINA_BASE</code> but that resulted in multiple errors and tomcat7 was unable to start:<br><br>
  This:
  <br><br></p>
  
  <blockquote>
    <p>21:25:49,923  WARN Slf4jConnectionPoolMonitorImpl:31 - BadRequestException: [host=localhost(127.0.0.1):9160, latency=16(38), attempts=1]InvalidRequestException(why:You have not logged in) </p>
  </blockquote>
  
  <p>And: </p>
  
  <blockquote>
    <p>INFO transport:93 - [node-1] bound_address {inet[0.0.0.0/0.0.0.0:9301]}, publish_address {inet[/XX.XXX.XXX.XXX:9301]}
    21:25:51,892  INFO discovery:85 - [node-1] elasticsearch/RIaKYgv1R-yTKJ_aknZOuw
    21:25:51,905  WARN netty:620 - [node-1] exception caught on transport layer [[id: 0xc1bc7fca]], closing connection
    java.net.UnknownHostException: localhost:9200</p>
  </blockquote>
  
  <p><br><br>
  <b>EDIT 2</b>: I was adviced that only Elasticsearch v 1.4.4 works (I tried with 2.2.0) and for Cassandra 1.2.x and 2.1.x versions (I tried with 3.0.3). I havent yet tried with these versions, I'll update this question if I get it to work. </p>