如何在Grails中配置multipart?

时间:2015-08-25 16:12:37

标签: grails multipart

我在Grails应用程序中使用Servlet 3.0和Spring Security REST plugin。当我在Glassfish中运行应用程序时,当安全性插件在请求中查找访问令牌时,会抛出以下异常:

java.lang.IllegalStateException: Request.getParts is called without multipart configuration. Either add a @MultipartConfig to the servlet, or a multipart-config element to web.xml
at org.apache.catalina.connector.Request.checkMultipartConfiguration(Request.java:4533)
at org.apache.catalina.connector.Request.getParts(Request.java:4539)
at org.apache.catalina.connector.RequestFacade.getParts(RequestFacade.java:1086)
at javax.servlet.http.HttpServletRequestWrapper.getParts(HttpServletRequestWrapper.java:375)
at javax.servlet.http.HttpServletRequestWrapper.getParts(HttpServletRequestWrapper.java:375)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaBeanProperty.getProperty(MetaBeanProperty.java:60)
at groovy.lang.MetaBeanProperty$getProperty.call(Unknown Source)
at org.codehaus.groovy.grails.plugins.web.ServletsGrailsPluginSupport$_enhanceServletApi_closure1.doCall(ServletsGrailsPluginSupport.groovy:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod.invoke(ClosureMetaMethod.java:81)
at groovy.lang.ExpandoMetaClass.getProperty(ExpandoMetaClass.java:1161)
at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:174)
at org.codehaus.groovy.runtime.callsite.PojoMetaClassGetPropertySite.getProperty(PojoMetaClassGetPropertySite.java:33)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:293)
at grails.plugin.springsecurity.rest.token.bearer.BearerTokenReader.findToken(BearerTokenReader.groovy:47)

我在哪里放置多部分配置?

我没有上传文件,所以我想我不能使用注释。但是在Grails中也没有web.xml。

我使用的是Grails 2.5.0和GlassFish 4.1

提前致谢!

0 个答案:

没有答案