You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jean-Claude Vogel <vo...@gmail.com> on 2008/01/24 10:25:46 UTC

"upload-max-size" with no effect

Hello,

I would like to upload a file in a Cocoon forms ihm, so I have fixed the
limit upload size in my web.xml :
    <servlet>
        <description>Cocoon blocks dispatcher</description>
        <display-name>DispatcherServlet</display-name>
        <servlet-name>DispatcherServlet</servlet-name>
        <servlet-class>org.apache.cocoon.servletservice.DispatcherServlet
</servlet-class>
        <init-param>
            <param-name>enable-uploads</param-name>
            <param-value>true</param-value>
        </init-param>
        <init-param>
            <param-name>upload-max-size</param-name>
            <param-value>10000000</param-value>
        </init-param>
        <load-on-startup>2</load-on-startup>
    </servlet>

It works fine when I upload a small file. But when I try to upload a bigger
file I am still having the exception :
     [exec] Caused by: java.io.IOException: Multipart element '
FRANCE2-4-2007-06-12-20070611-060528.XML' is too large (1
18742 bytes) and was discarded.
     [exec]     at
org.apache.cocoon.servlet.multipart.RejectedPart.getInputStream(
RejectedPart.java:81)
     [exec]     at org.apache.cocoon.generation.StreamGenerator.generate(
StreamGenerator.java:119)
     [exec]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
     [exec]     at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
     [exec]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
     [exec]     at java.lang.reflect.Method.invoke(Method.java:585)
     [exec]     at
org.apache.cocoon.core.container.spring.avalon.PoolableProxyHandler.invoke(
PoolableProxyHandler.java:
72)
     [exec]     at $Proxy16.generate(Unknown Source)
     [exec]     at
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processXMLPipeline
(AbstractProcessin
gPipeline.java:542)
     [exec]     at
org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.processXMLPipeline
(Abstr
actCachingProcessingPipeline.java:275)
     [exec]     at
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(
AbstractProcessingPipeline.j
ava:437)
     [exec]     at sun.reflect.GeneratedMethodAccessor119.invoke(Unknown
Source)
     [exec]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
     [exec]     at java.lang.reflect.Method.invoke(Method.java:585)
     [exec]     at
org.apache.cocoon.core.container.spring.avalon.PoolableProxyHandler.invoke(
PoolableProxyHandler.java:
72)
     [exec]     at $Proxy10.process(Unknown Source)
     [exec]     at
org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(
SerializeNode.java:144)
     [exec]     at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes
(AbstractParentPro
cessingNode.java:55)
     [exec]     at
org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(
MatchNode.java:87)
     [exec]     at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes
(AbstractParentPro
cessingNode.java:77)
     [exec]     at
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(
PipelineNode.java:151)
     [exec]     at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes
(AbstractParentPro
cessingNode.java:77)
     [exec]     at
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(
PipelinesNode.java:93)
     [exec]     at
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(
ConcreteTreeProcessor.java:2
40)
     [exec]     at
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(
ConcreteTreeProcessor.java:1
71)
     [exec]     at
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(
TreeProcessor.java:251)
     [exec]     at org.apache.cocoon.servlet.RequestProcessor.process(
RequestProcessor.java:357)
     [exec]     at org.apache.cocoon.servlet.RequestProcessor.service(
RequestProcessor.java:171)
     [exec]     at org.apache.cocoon.sitemap.SitemapServlet.service(
SitemapServlet.java:64)
     [exec]     at javax.servlet.http.HttpServlet.service(HttpServlet.java
:856)

Could somebody explain me what is wrong in my code please ?

Re: "upload-max-size" with no effect

Posted by Grzegorz Kossakowski <gk...@apache.org>.
Jean-Claude Vogel pisze:
> Thank a lot,
> 
> I fact I don't know how to set static variables in the spring
> configuration of the block but I will look for it. If you can send a
> small example it would be great.

Jean, you probably have misunderstood what I meant. I didn't mean you need to set static variables
as it's quite insane to try to _change_ value of _static_ variable, don't you think? ;-)

You should look at the configure() method of MultipartConfigurationHelper class. There configuration
is obtained from properties in a way like this:
        value = settings.getProperty(KEY_UPLOADS_MAXSIZE);
        if (value != null) {
            setMaxUploadSize(Integer.valueOf(value).intValue());
        }

Where KEY_UPLOADS_MAXSIZE is defined at the top of the class:

    String KEY_UPLOADS_MAXSIZE = "org.apache.cocoon.uploads.maxsize";

So you just need to set this property. You can do this multiple ways[1]. I suggest creating a
uploadsettings.properties file in src/main/resources/META-INF/cocoon/properties directory of your block.

[1] http://cocoon.apache.org/subprojects/configuration/1.0/spring-configurator/1.0/1310_1_1.html

-- 
Grzegorz Kossakowski
Committer and PMC Member of Apache Cocoon
http://reflectingonthevicissitudes.wordpress.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: "upload-max-size" with no effect

Posted by Jean-Claude Vogel <vo...@gmail.com>.
Thank a lot,

I fact I don't know how to set static variables in the spring configuration
of the block but I will look for it. If you can send a small example it
would be great.

Best regards,
Jean-Claude


2008/1/28, Grzegorz Kossakowski <gk...@apache.org>:
>
> Jean-Claude Vogel pisze:
> > Thank for your reply,
> >
> > Like you said, I tried to add an "upload-max-size" init param in the
> > Spring configuration of the Cocoon SitemapServlet but I have still the
> > same error.
> >
> > Here is what I wrote :
> >     <bean id="zzz.ma-adminui.block"
> > class="org.apache.cocoon.sitemap.SitemapServlet">
> >         <servlet:context mount-path="/ui"
> > context-path="blockcontext:/ma-adminui/" >
> >
> >             <servlet:init-params>
> >                 <entry key="upload-max-size" value="10000000" />
> >             </servlet:init-params>
> >
> >             <servlet:connections>
> >                 <entry key="ajax"
> > value-ref="org.apache.cocoon.ajax.impl.servlet" />
> >                 <entry key="forms"
> > value-ref="org.apache.cocoon.forms.impl.servlet" />
> >                 <entry key="services" value-ref="zzz.ma-service.block"/>
> >             </servlet:connections>
> >         </servlet:context>
> >     </bean>
> >
> > Perhaps is my syntax wrong, I am still looking for it on the net.
>
> Your syntax is right. I have taken a closer look and found that we have
> changed whole mechanism and
> configuration for it.
>
> Now you need to configure it using properties, the list of them you can
> find there [1]. I hope you
> know how to set them in your block.
>
> Actually, it's perfect work for some volunteer to add this information to
> documentation, for
> example, as a FAQ entry.
>
> [1]
>
> http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/multipart/MultipartConfigurationHelper.java?view=markup
>
> --
> Grzegorz Kossakowski
> Committer and PMC Member of Apache Cocoon
> http://reflectingonthevicissitudes.wordpress.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

Re: "upload-max-size" with no effect

Posted by Jean-Claude Vogel <vo...@gmail.com>.
Yes, it works fine. Thank you and thank to every body who tried to
understand the problem.

I ever not understand why I have to specify these properties, my file to
upload size is less than 1Mb when the default Cocoon max value is 10Mb.
Files to upload with a size less than 100kb have ever been uploaded, only
files bigger than 100kb were not uploaded.

Now I specify 10Mb in a "uploadsettings.properties" configuration file and
it's ok also for files bigger than 100kb. Strange.

Thank again

PS (for ohter users), my property file in
"/META-INF/cocoon/perperties/uploadsettings.properties" contains just :
org.apache.cocoon.uploads.maxsize=10000000
org.apache.cocoon.uploads.enable=true


2008/1/28, Joerg Heinicke <jo...@gmx.de>:
>
> On 28.01.2008 05:34, Grzegorz Kossakowski wrote:
>
> >> Like you said, I tried to add an "upload-max-size" init param in the
> >> Spring configuration of the Cocoon SitemapServlet but I have still the
> >> same error.
> >>
> >> Here is what I wrote :
> >>     <bean id="zzz.ma-adminui.block"
> >> class="org.apache.cocoon.sitemap.SitemapServlet">
> >>         <servlet:context mount-path="/ui"
> >> context-path="blockcontext:/ma-adminui/" >
> >>
> >>             <servlet:init-params>
> >>                 <entry key="upload-max-size" value="10000000" />
> >>             </servlet:init-params>
> >>
> >>             <servlet:connections>
> >>                 <entry key="ajax"
> >> value-ref="org.apache.cocoon.ajax.impl.servlet" />
> >>                 <entry key="forms"
> >> value-ref="org.apache.cocoon.forms.impl.servlet" />
> >>                 <entry key="services" value-ref="zzz.ma-service.block
> "/>
> >>             </servlet:connections>
> >>         </servlet:context>
> >>     </bean>
> >>
> >> Perhaps is my syntax wrong, I am still looking for it on the net.
> >
> > Your syntax is right. I have taken a closer look and found that we have
> changed whole mechanism and
> > configuration for it.
> >
> > Now you need to configure it using properties, the list of them you can
> find there [1]. I hope you
> > know how to set them in your block.
>
> Hmm, I might misss something, but what's the point of enforcing
> splitting configuration into different files? I can see the possible
> advantages of the properties, but not of preventing the user from
> explicitly configuring such a property directly on the bean.
>
> Joerg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

Re: "upload-max-size" with no effect

Posted by Joerg Heinicke <jo...@gmx.de>.
On 28.01.2008 05:34, Grzegorz Kossakowski wrote:

>> Like you said, I tried to add an "upload-max-size" init param in the
>> Spring configuration of the Cocoon SitemapServlet but I have still the
>> same error.
>>
>> Here is what I wrote :
>>     <bean id="zzz.ma-adminui.block"
>> class="org.apache.cocoon.sitemap.SitemapServlet">
>>         <servlet:context mount-path="/ui"
>> context-path="blockcontext:/ma-adminui/" >
>>
>>             <servlet:init-params>
>>                 <entry key="upload-max-size" value="10000000" />
>>             </servlet:init-params>
>>
>>             <servlet:connections>
>>                 <entry key="ajax"
>> value-ref="org.apache.cocoon.ajax.impl.servlet" />
>>                 <entry key="forms"
>> value-ref="org.apache.cocoon.forms.impl.servlet" />
>>                 <entry key="services" value-ref="zzz.ma-service.block"/>
>>             </servlet:connections>
>>         </servlet:context>
>>     </bean>
>>
>> Perhaps is my syntax wrong, I am still looking for it on the net.
> 
> Your syntax is right. I have taken a closer look and found that we have changed whole mechanism and
> configuration for it.
> 
> Now you need to configure it using properties, the list of them you can find there [1]. I hope you
> know how to set them in your block.

Hmm, I might misss something, but what's the point of enforcing 
splitting configuration into different files? I can see the possible 
advantages of the properties, but not of preventing the user from 
explicitly configuring such a property directly on the bean.

Joerg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: "upload-max-size" with no effect

Posted by Grzegorz Kossakowski <gk...@apache.org>.
Jean-Claude Vogel pisze:
> Thank for your reply,
> 
> Like you said, I tried to add an "upload-max-size" init param in the
> Spring configuration of the Cocoon SitemapServlet but I have still the
> same error.
> 
> Here is what I wrote :
>     <bean id="zzz.ma-adminui.block"
> class="org.apache.cocoon.sitemap.SitemapServlet">
>         <servlet:context mount-path="/ui"
> context-path="blockcontext:/ma-adminui/" >
> 
>             <servlet:init-params>
>                 <entry key="upload-max-size" value="10000000" />
>             </servlet:init-params>
> 
>             <servlet:connections>
>                 <entry key="ajax"
> value-ref="org.apache.cocoon.ajax.impl.servlet" />
>                 <entry key="forms"
> value-ref="org.apache.cocoon.forms.impl.servlet" />
>                 <entry key="services" value-ref="zzz.ma-service.block"/>
>             </servlet:connections>
>         </servlet:context>
>     </bean>
> 
> Perhaps is my syntax wrong, I am still looking for it on the net.

Your syntax is right. I have taken a closer look and found that we have changed whole mechanism and
configuration for it.

Now you need to configure it using properties, the list of them you can find there [1]. I hope you
know how to set them in your block.

Actually, it's perfect work for some volunteer to add this information to documentation, for
example, as a FAQ entry.

[1]
http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/multipart/MultipartConfigurationHelper.java?view=markup

-- 
Grzegorz Kossakowski
Committer and PMC Member of Apache Cocoon
http://reflectingonthevicissitudes.wordpress.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: "upload-max-size" with no effect

Posted by Jean-Claude Vogel <vo...@gmail.com>.
Thank for your reply,

Like you said, I tried to add an "upload-max-size" init param in the Spring
configuration of the Cocoon SitemapServlet but I have still the same error.

Here is what I wrote :
    <bean id="zzz.ma-adminui.block" class="
org.apache.cocoon.sitemap.SitemapServlet">
        <servlet:context mount-path="/ui"
context-path="blockcontext:/ma-adminui/" >

            <servlet:init-params>
                <entry key="upload-max-size" value="10000000" />
            </servlet:init-params>

            <servlet:connections>
                <entry key="ajax" value-ref="
org.apache.cocoon.ajax.impl.servlet" />
                <entry key="forms" value-ref="
org.apache.cocoon.forms.impl.servlet" />
                <entry key="services" value-ref="zzz.ma-service.block"/>
            </servlet:connections>
        </servlet:context>
    </bean>

Perhaps is my syntax wrong, I am still looking for it on the net.

Best regards,
JC

2008/1/26, Grzegorz Kossakowski <gk...@apache.org>:
>
> Jean-Claude Vogel pisze:
> > Hello,
> >
> > I would like to upload a file in a Cocoon forms ihm, so I have fixed the
> > limit upload size in my web.xml :
> >     <servlet>
> >         <description>Cocoon blocks dispatcher</description>
> >         <display-name>DispatcherServlet</display-name>
> >         <servlet-name>DispatcherServlet</servlet-name>
> >
> > <servlet-class>org.apache.cocoon.servletservice.DispatcherServlet
> </servlet-class>
> >         <init-param>
> >             <param-name>enable-uploads</param-name>
> >             <param-value>true</param-value>
> >         </init-param>
> >         <init-param>
> >             <param-name>upload-max-size</param-name>
> >             <param-value>10000000</param-value>
> >         </init-param>
> >         <load-on-startup>2</load-on-startup>
> >     </servlet>
> >
> > It works fine when I upload a small file. But when I try to upload a
> > bigger file I am still having the exception :
> > Could somebody explain me what is wrong in my code please ?
>
> Hi Jean,
>
> I'm not sure but I guess that it's SitemapServlet that makes checks for
> upload limits and other
> fancy stuff. If you pass the configuration to the DispatcherServlet it
> never reaches SitemapServlet.
>
> I suggest to move this configuration to declaration of your SitemapServlet
> bean. Try again and
> report back if it still works for you.
>
> Best regards,
>
> --
> Grzegorz Kossakowski
> Committer and PMC Member of Apache Cocoon
> http://reflectingonthevicissitudes.wordpress.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

Re: "upload-max-size" with no effect

Posted by Grzegorz Kossakowski <gk...@apache.org>.
Jean-Claude Vogel pisze:
> Hello,
> 
> I would like to upload a file in a Cocoon forms ihm, so I have fixed the
> limit upload size in my web.xml :
>     <servlet>
>         <description>Cocoon blocks dispatcher</description>
>         <display-name>DispatcherServlet</display-name>
>         <servlet-name>DispatcherServlet</servlet-name>
>        
> <servlet-class>org.apache.cocoon.servletservice.DispatcherServlet</servlet-class>
>         <init-param>
>             <param-name>enable-uploads</param-name>
>             <param-value>true</param-value>
>         </init-param>
>         <init-param>
>             <param-name>upload-max-size</param-name>
>             <param-value>10000000</param-value>
>         </init-param>
>         <load-on-startup>2</load-on-startup>
>     </servlet>
> 
> It works fine when I upload a small file. But when I try to upload a
> bigger file I am still having the exception :
> Could somebody explain me what is wrong in my code please ?

Hi Jean,

I'm not sure but I guess that it's SitemapServlet that makes checks for upload limits and other
fancy stuff. If you pass the configuration to the DispatcherServlet it never reaches SitemapServlet.

I suggest to move this configuration to declaration of your SitemapServlet bean. Try again and
report back if it still works for you.

Best regards,

-- 
Grzegorz Kossakowski
Committer and PMC Member of Apache Cocoon
http://reflectingonthevicissitudes.wordpress.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org