Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

File Upload (struts) IllegalArgumentException

2 views
Skip to first unread message

lb

unread,
Apr 15, 2004, 6:56:45 AM4/15/04
to
Hi

I have this code in my jsp page:

<html:form action="FileUpload.do">
<html:file property="uploadFilename" />
<html:submit />
</html:form>

...and it works. The code in my action class gets executed.
But if I add the encode type property like this:

<html:form action="FileUpload.do" enctype="multipart/form-data">
<html:file property="uploadFilename" />
<html:submit />
</html:form>

...then the code in my action class is not executed. Instead I get this
error:

500 Internal Server Error
java.lang.IllegalArgumentException: type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.j
ava:1789)
at
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.j
ava:1684)
at
org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:17
13)
at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252)
at
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j
ava:821)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind[Oracle Application Server Containers for J2EE 10g
(9.0.4.0.0)].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.ja
va:65)
at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:356)
at com.evermind[Oracle Application Server Containers for J2EE 10g
(9.0.4.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispa
tcher.java:614)
at com.evermind[Oracle Application Server Containers for J2EE 10g
(9.0.4.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletReq
uestDispatcher.java:317)
at com.evermind[Oracle Application Server Containers for J2EE 10g
(9.0.4.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandle
r.java:784)
at com.evermind[Oracle Application Server Containers for J2EE 10g
(9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
at com.evermind[Oracle Application Server Containers for J2EE 10g
(9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
at com.evermind[Oracle Application Server Containers for J2EE 10g
(9.0.4.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableRe
sourcePooledExecutor.java:192)
at java.lang.Thread.run(Thread.java:536)


What am I missing?

Thanks in advance
Lars B.


lb

unread,
Apr 15, 2004, 9:31:28 AM4/15/04
to
In case anyone is interested, I found the solution. The problem could easily
have been identified if the error message actually said something useful.

The problem is that "uploadFilename" in " <html:file
property="uploadFilename" />" is not a string . it's a FormFile.


"lb" <asas@rt.h> skrev i en meddelelse
news:407e6a77$0$439$edfa...@dread14.news.tele.dk...

0 new messages