Hi!

  I've got problems to upload a xml to cocoon. I want to transfer a
  file with a simple <input type="file" name="antrag" /> and suffer a
  NullPointerException.

  The Exception is only visible with activated debug-filter. But when
  the debug filter is deactivated, the upload doesn't work either.

  I work with a snapshot-release of last night with an applied patch
  to AbstractProcessingPipeline.java (reenabled
  environment.setStatus(HttpServletResponse.SC_OK); )

  OS: Win XP SP2
  Server: Jetty

  Does anybody have an idea where to search?

regards

  Martin.
  

--- snip ---
HTTP ERROR: 500

INTERNAL_SERVER_ERROR

RequestURI=/showantrag
Caused by:

java.lang.NullPointerException
        at 
org.apache.cocoon.servlet.multipart.PartOnDisk.toString(PartOnDisk.java:89)
        at 
org.apache.cocoon.servlet.multipart.MultipartHttpServletRequest.getParameterValues(MultipartHttpServletRequest.java:153)
        at org.apache.cocoon.servlet.DebugFilter.doFilter(DebugFilter.java:120)
        at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1045)
        at 
org.apache.cocoon.servlet.multipart.MultipartFilter.doFilter(MultipartFilter.java:140)
        at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1045)
        at 
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:358)
        at 
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:231)
        at 
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:629)
        at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:453)
        at 
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:149)
        at 
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:123)
        at 
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:141)
        at org.mortbay.jetty.Server.handle(Server.java:303)
        at 
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:452)
        at 
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:735)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:636)
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:349)
        at 
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:320)
        at 
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)
--- snap ---



These are the cocoon logs:

--- snip ---
btpool0-2 DEBUG request.RequestContextListener - Bound request context to 
thread: POST /showantrag HTTP/1.1
Host: localhost:8888
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.3) 
Gecko/20070309 Firefox/2.0.0.3
Accept: 
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost:8888/index.html
Content-Type: multipart/form-data; 
boundary=---------------------------7181888329450
Content-Length: 66839


btpool0-2 DEBUG cocoon - Deleting uploaded file(s).
btpool0-2 DEBUG request.RequestContextListener - Cleared thread-bound request 
context: POST /showantrag HTTP/1.1
Host: localhost:8888
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.3) 
Gecko/20070309 Firefox/2.0.0.3
Accept: 
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost:8888/index.html
Content-Type: multipart/form-data; 
boundary=---------------------------7181888329450
Content-Length: 66839
--- snap ---





Here is the sitemap:


--- snip ---
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0";>

 <map:components>
  <map:generators default="file">
    <!-- use the new implementation of JX -->
    <map:generator name="jx" 
src="org.apache.cocoon.template.JXTemplateGenerator"/>
  </map:generators>

 </map:components>
 
 <map:pipelines>

   <map:pipeline>

     <map:match pattern="index.html">
        <map:generate src="index.html" />
        <map:serialize type="xhtml"/>
     </map:match>

     <map:match pattern="showantrag">
        <map:generate type="stream">
                <map:parameter name="form-name" value="antrag" />
        </map:generate>
        <map:serialize type="xml"/>
     </map:match>
        
        </map:pipeline>
        
        
 </map:pipelines>

</map:sitemap> 
--- snap ---




And the properties:

--- snip ---
# Causes all files in multipart requests to be processed.
# Default is true but the maximum allowed size is kept small for security 
reasons.
# Unsupported values will be interpreted as false.
org.apache.cocoon.uploads.enable=true

# This parameter allows to specify where Cocoon should put uploaded files.
# The path specified can be either absolute or relative to the context
# path of the servlet. On windows platform, absolute directory must start
# with volume: C:\Path\To\Upload\Directory
#
# The default directory is "upload-dir" in the work-directory
#org.apache.cocoon.uploads.directory=d:/temp/cocoonuploads

# Causes all files in multipart requests to be saved to upload-dir.
# Default is true for security reasons.
# Unsupported values will be interpreted as false.
org.apache.cocoon.uploads.autosave=true

# Specify handling of name conflicts when saving uploaded files to disk.
# Acceptable values are deny, allow, rename (default). Files are renamed
# x_filename where x is an integer value incremented to make the new
# filename unique.
org.apache.cocoon.uploads.overwrite=rename

# Specify maximum allowed size of the upload. Defaults to 10 Mb.
# Set here to a very low 100 kb to allow samples to run.
#org.apache.cocoon.uploads.maxsize=100000000
--- snap ---



And finally the html-form:

--- snip ---
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html>
        <head>
                <title>Antragsvorschau</title>
        </head>
        <body>
                <h1>Antragsvorschau</h1>
        <form action="showantrag" enctype="multipart/form-data" method="post">
                                <table summary="" border="0">
                                        <tbody>
                                                <tr>
                                                        <td><label title="Bitte 
wÀhlen Sie die Antragsdatei aus" for="antrag" class="forms upload active 
required">Antrag</label></td>
                                                        <td><span title="Bitte 
wÀhlen Sie die Antragsdatei aus"><input title="Bitte wÀhlen Sie die 
Antragsdatei aus" name="antrag" id="antrag" type="file" /> * </span></td>
                                                </tr>
                                                <tr>
                                                        <td colspan="2"><input 
type="submit" /></td>
                                                </tr>
                                        </tbody>
                                </table>
        </form>
        </body>
</html>
--- snap ---


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to