Problem i am facing
I implemented a small change to my application and I checked it in the subversion repository. Once this was verified, I started the Jenkins build. Jenkins is currently running on a Windows server.
The error I am getting is the following:
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (deploy) on project sd-rest-servlet: Cannot invoke Tomcat manager: FAIL - Deployed application at context path /sd but context failed to start
I further examined this error message, so I checked the Tomcat logs on the Jenkins server, and I found the main problem:
SEVERE: Error starting static Resources java.lang.IllegalArgumentException: Document base C:\Program Files\Apache Software Foundation\Tomcat 6.0\temp\28-sd does not exist or is not a readable directory at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:142) at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4320) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4489) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:675) at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:601) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502) at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1385) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:306) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142) at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1389) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1653) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1662) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1642) at java.lang.Thread.run(Unknown Source)
Now, as I understand it, the temp folder is only ever used this way when I set antiJarLocking or antiResourceLocking to true in the context file. However, as you can see, I did not include this in the context element:
<Context unpackWAR="false">
Other behavior
Unable to deploy
After some rigorous testing, I found that Jenkins could not deploy the application. In the magazines I see this message.
[INFO] Undeploying application at http:
However, the assembly failed during deployment with the following error:
Cannot invoke Tomcat manager: FAIL - Application already exists at path /sd
Incorrect Temp Directory Access
I also noticed that he throws the same IllegalArgumentException whenever he tries to access any file inside the temp directory. This tells me that something is wrong with the temp directory, however I set the permissions earlier in the application, Jenkins actually puts the file in the temp directory.
No problem using
Jenkins actually deploys the application seamlessly. I watched directories change when files are added to them, including the temp directory. This tells me that Jenkins accidentally decides that he cannot read the contents of the directory, even though a file has been added to it. He seems to have write permissions, but not read permissions, which really doesn't make sense!
Attempts to solve the problem.
Make sure the file exists.
First I tried to look inside C:\Program Files\Apache Software Foundation\Tomcat 6.0\temp\28-sd to see if the file exists. Of course he existed.
Changed Permissions
I set permissions to provide full access from each user on the server as a precaution.
Explored Using Temp Catalog
I tried setting up my context file to avoid using the temp directory, so I donβt know why it is still trying to read it. I am inexperienced with this technology, so I may have some settings that require the temp folder.
edits
Extended Tomcat Logs
18-Dec-2013 12:14:19 org.apache.catalina.startup.HostConfig checkResources INFO: Undeploying context [/sd] 18-Dec-2013 12:16:06 org.apache.catalina.startup.HostConfig deployDescriptor INFO: Deploying configuration descriptor sd.xml 18-Dec-2013 12:16:09 org.apache.catalina.core.StandardContext resourcesStart <!-- Above stacktrace goes here --> 18-Dec-2013 12:16:09 org.apache.catalina.core.StandardContext start SEVERE: Error in resourceStart() 18-Dec-2013 12:16:09 org.apache.catalina.core.StandardContext start SEVERE: Error getConfigured 18-Dec-2013 12:16:09 org.apache.catalina.core.StandardContext start SEVERE: Context [/sd] startup failed due to previous errors 18-Dec-2013 12:16:09 org.apache.catalina.core.StandardContext stop INFO: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/sd] has not been started
Additional issue information
After reading the logs for the thousandth time, I reread this line:
...Tomcat 6.0\temp\28-sd does not exist or is *not a readable directory*
So, when I looked again at the temp directory, I realized that the files being created are not directories . These are these weird file objects with no extension, and they look like this:

For me, this indicates that something went wrong as Tomcat manipulates files, and this is the core of the problem. Hope this additional information helps someone with an answer!