Struts File Upload Error - erroneous handlers

W

watergirl

Hello.

I'm trying to do a very simple upload using velocity and struts. This
is my html:

<html>
<body>
<form name="myForm" method="post" action="<my action goes here>"
enctype="multipart/form-data">
Select File: <input type="file" name="myFile"> </br>
<input type="submit" value="Upload File">
</form>
</body>
</html>

For some reason I'm getting this error...

java.lang.InternalError: erroneous handlers
at
org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest(Ljavax/servlet/http/HttpServletRequest;)V(CommonsMultipartRequestHandler.java:???)
at
org.apache.struts.util.RequestUtils.populate(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;Ljavax/servlet/http/HttpServletRequest;)V(RequestUtils.java:445)

Does anyone have any clue what this could be about? Also - my
struts-config file:

<form-bean
dynamic="true"
name="myForm"
type="org.apache.struts.action.DynaActionForm">
<!-- inputs -->
<form-property name="myFile"
type="org.apache.struts.upload.FormFile"/>
</form-bean>
I was creating my own action form but currently just trying to keep it
basic.

<action
path="/FileUpload"
name="myForm"
type="my.package.StrutsUploadAction">
<forward name="success" path="/success.vm"/>
</action>

Any ideas would be greatly appreciated.

Thank you!
 
M

Manish Pandit

Try replacing
Select File: <input type="file" name="myFile"> </br>

with Select File : <html:file property="myFile"/></br>

If this does not work, try getting rid of the dyna form altogether, and
parse the multipart request in your action. I am not sure what type
<input type=file> puts in the request, but your action is expecting a
FormFile, which can be the error you are observing.

-cheers,
Manish
 
W

watergirl

Manish said:
Try replacing


with Select File : <html:file property="myFile"/></br>

If this does not work, try getting rid of the dyna form altogether, and
parse the multipart request in your action. I am not sure what type
<input type=file> puts in the request, but your action is expecting a
FormFile, which can be the error you are observing.

-cheers,
Manish

Manish.

Thank you for the suggestion. I tried removing the dyna form and
parsing via the multi part request object and got the same
error...Still at a loss!

Thanks.
Steph
 
M

Manish Pandit

Hi!

Can you check and see if the jakarta fileupload library version is same
on your tomcat vs. your IDE/build location? If there is a fileupload
jar in tomcat, get rid of it so that it will always pick up the one in
your WEB-INF/lib.

-cheers,
Manish
 
W

watergirl

Thanks Manish! I removed old jars and made sure the only ones that I
wanted to use were in my WEB-INF/lib and it works great :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top