Solved

$CATALINA_TMPDIR No such file or directory

Posted on 2007-04-04
5
1,679 Views
Last Modified: 2013-12-02
I have a problem that is occuring in a production environment but the problem does not occur in a development and test environment.  The problem in production happens when uploading a file.  The error is:

HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Processing of multipart/form-data request failed. $CATALINA_TMPDIR/upload_00000546.tmp (No such file or directory)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:193)
      at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:309)
      at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:387)
      at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:673)
      at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:615)
      at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:786)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:666)
      at java.lang.Thread.run(Thread.java:534)


root cause

javax.servlet.ServletException: Processing of multipart/form-data request failed. $CATALINA_TMPDIR/upload_00000546.tmp (No such file or directory)
      at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:533)
      at org.apache.jsp.voicemail_jsp._jspService(voicemail_jsp.java:1888)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:204)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:193)
      at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:309)
      at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:387)
      at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:673)
      at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:615)
      at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:786)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:666)
      at java.lang.Thread.run(Thread.java:534)



--------------------------------------------------------------------------------

Apache Tomcat/4.1.29-LE-jdk14

The JSP code used to upload the file is:

boolean bIsMultipart = FileUpload.isMultipartContent(request);
if (bIsMultipart) {
      DiskFileUpload upload = new DiskFileUpload();

      // Parse the request
      java.util.List /* FileItem */ items = upload.parseRequest(request);
      psCollection formFields = new psCollection();

      Iterator iter = items.iterator();

      while (iter.hasNext() && !bErrorFlag) {
            boolean bFileExists = false;
            FileItem item = (FileItem) iter.next();
            if (item.isFormField()) {
                  //first get the all the data entered.  Process the data after the while loop
                  formFields.add(new String(item.getString()), new String(item.getFieldName()));
            } else {
                  sName = item.getFieldName();
                  sFileName = item.getName().substring(item.getName().lastIndexOf("\\") + 1);
                  sContentType = item.getContentType();
                  bInMemory = item.isInMemory();
                  lSizeInBytes = item.getSize();
                 
                  // Process the file upload in memory
                  try {
                        data = item.get();
                  } catch (Exception e) {
                        bErrorFlag = true;
                        sDisplayMessage = "We were unable to access the uploaded file.";
                        logger.debug("unable to get the data from the file.");
                  }



The main difference between the development/test environment and the production environment is that the development/test environment have Apache and Tomcat on the same server while the production environment has one server running Apache and another server running Tomcat.
0
Comment
Question by:david_m_jacobson
  • 2
5 Comments
 
LVL 14

Accepted Solution

by:
Farzad Akbarnejad earned 250 total points
ID: 18854983
Create a folder name 'temp' in beside of bin and webapp. Then start the tomcat and test uploading file.
0
 
LVL 2

Assisted Solution

by:ckyteh
ckyteh earned 250 total points
ID: 19055015
As FarzadA said, you need to create a temp directory for Tomcat to use. You also need to make sure Tomcat is configured appropriately to use the temp directory that you created ($CATALINA_TMPDIR variable). Finally, this temp directory needs the appropriate permissions to allow the Tomcat service to write to the directory.
0
 
LVL 14

Expert Comment

by:Farzad Akbarnejad
ID: 19060883
david_m_jacobson,
ckyteh's comment is a perfect answer. I see the structural thinking in that answer.

-FA
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

-Xmx and -Xms are the two JVM options often used to tune JVM heap size.   Here are some common mistakes made when using them:   Assume BigApp is a java class file for the below examples. 1.         Missing m, M, g or G at the end …
If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
This video discusses moving either the default database or any database to a new volume.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now