title: Unable to create the directory for webapp in Tomcat in mac
body: <p>I tried to deploy my web app <code>smart4j</code> to tomcat 8 server in localhost. It failed with the following message (updated): </p>
  
  <pre><code>08-Nov-2015 08:57:42.302 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
  08-Nov-2015 08:57:42.309 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
  08-Nov-2015 08:57:42.310 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 867 ms
  08-Nov-2015 08:59:31.907 INFO [http-nio-8080-exec-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /Users/minconghuang/Informatique/Java/apache-tomcat-8.0.21/webapps/smart4j.war
  08-Nov-2015 08:59:36.764 SEVERE [http-nio-8080-exec-1] org.apache.catalina.startup.ContextConfig.beforeStart Exception fixing docBase for context [/smart4j]
   java.io.IOException: Unable to create the directory [/Users/minconghuang/Informatique/Java/apache-tomcat-8.0.21/webapps/smart4j/license]
      at org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:151)
      at org.apache.catalina.startup.ContextConfig.fixDocBase(ContextConfig.java:618)
      at org.apache.catalina.startup.ContextConfig.beforeStart(ContextConfig.java:744)
      at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:307)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
      at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
      at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:940)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:461)
      at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1526)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
      at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
      at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1460)
      at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:733)
      at org.apache.catalina.manager.ManagerServlet.doPut(ManagerServlet.java:432)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:651)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:614)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
      at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
      at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1517)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1474)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Thread.java:745)
  
  08-Nov-2015 09:00:02.991 INFO [http-nio-8080-exec-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
  08-Nov-2015 09:01:31.692 SEVERE [http-nio-8080-exec-1] org.apache.catalina.core.StandardContext.startInternal Error listenerStart
  08-Nov-2015 09:01:31.693 SEVERE [http-nio-8080-exec-1] org.apache.catalina.core.StandardContext.startInternal Context [/smart4j] startup failed due to previous errors
  08-Nov-2015 09:01:31.781 WARNING [http-nio-8080-exec-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [smart4j] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
  08-Nov-2015 09:01:31.782 WARNING [http-nio-8080-exec-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [smart4j] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
   java.lang.Object.wait(Native Method)
   java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135)
   com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:43)
  08-Nov-2015 09:01:31.783 SEVERE [http-nio-8080-exec-1] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [smart4j] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@3a0f8a4d]) and a value of type [org.hibernate.internal.SessionFactoryImpl] (value [org.hibernate.internal.SessionFactoryImpl@25c37603]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
  08-Nov-2015 09:01:31.783 SEVERE [http-nio-8080-exec-1] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [smart4j] created a ThreadLocal with key of type [org.apache.log4j.helpers.ThreadLocalMap] (value [org.apache.log4j.helpers.ThreadLocalMap@5240e302]) and a value of type [java.util.Hashtable] (value [{}]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
  08-Nov-2015 09:01:31.790 INFO [http-nio-8080-exec-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /Users/minconghuang/Informatique/Java/apache-tomcat-8.0.21/webapps/smart4j.war has finished in 119,883 ms
  </code></pre>
  
  <p>To make sure Tomcat has to permission to write on my mac, I did <code>chmod 777 webapps</code> to grant the webapps folder, but it did not help. And here're some useful details.</p>
  
  <p><strong>The content of webapps folder</strong>:</p>
  
  <pre><code>macbook-pro-de-mincong:webapps minconghuang$ ls -l
  total 116168
  drwxr-xr-x@ 19 minconghuang  staff       646 Mar 23  2015 ROOT
  drwxr-xr-x@ 55 minconghuang  staff      1870 Mar 23  2015 docs
  drwxr-xr-x@  7 minconghuang  staff       238 Mar 23  2015 examples
  drwxr-xr-x@  7 minconghuang  staff       238 Mar 23  2015 host-manager
  drwxr-xr-x@  8 minconghuang  staff       272 Mar 23  2015 manager
  drwxr-xr-x   5 minconghuang  staff       170 Nov  7 18:05 mvndeploy
  -rw-r--r--   1 minconghuang  staff      1693 Nov  7 18:05 mvndeploy.war
  -rw-r--r--   1 minconghuang  staff  59472717 Nov  7 20:12 smart4j.war 
  </code></pre>
  
  <p><strong>conf/tomcat-users.xml</strong></p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  &lt;tomcat-users xmlns="http://tomcat.apache.org/xml"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
                version="1.0"&gt;
      &lt;role rolename="admin-gui"/&gt;
      &lt;role rolename="manager-gui"/&gt;
      &lt;role rolename="manager-script"/&gt;
      &lt;user username="mincong" password="mincong" roles="admin-gui,manager-gui,manager-script"/&gt;
  &lt;/tomcat-users&gt;
  </code></pre>
  
  <p>By the way, I did another deployment test with a simple maven-based project <code>mvndeploy.war</code>. And it did expand into a folder. So, am I missing something in my application <strong>smart4j</strong> ?</p>