You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Matthew Glubb <ma...@madebykite.com> on 2011/03/18 11:15:46 UTC

CXF and ehcache-web

Hi All,

I'm trying to use ehcache-web 2.0.3 with apache-cxf 2.3.3 and Tomcat 6. There doesn't seem to be much in the way of information online about it and I wondered if anyone else had tried it. I have an issue where for the first, uncached request I get the following error:

net.sf.ehcache.constructs.web.AlreadyCommittedException: Response already committed after doing buildPagebut before writing response from PageInfo.

Subsequent requests are returned correctly by the cache until the cache content goes stale and then we get the same error above.

Googling turns up similar issues that seem to have subsequently been fixed for WebLogic but no issues have been reported for Tomcat.

I'm not massively knowledgeable about the internals of Tomcat's request/response pipeline but it seems to me that when ehcache records a cache miss, it passes the request down the line to the CXF servlet but CXF commits the response before ehcache has a chance to modify the response headers.

I've got a pretty simple web.xml at the moment (see it at the end of this email). Can anyone cast any light on this? How can I ensure that CXF doesn't commit the response before the end of the filter chain?

I've already tried adding:

<dispatcher>REQUEST</dispatcher>
<dispatcher>INCLUDE</dispatcher>
<dispatcher>FORWARD</dispatcher>

to my filter mapping but it didn't appear to make any difference.

Thanks very much,


Matt
	

Matthew Glubb
Technical Partner

email: matthew.glubb@madebykite.com
phone: 44 (0) 7715 754017
skype: mglubb

Kite
http://madebykite.com

--
GPG: 96FF DE0E 0B7B 37F0 7F8D C54C E285 3D8F 5625 9244

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath*:webappContext.xml /WEB-INF/rio-servlet.xml</param-value>
</context-param>
	
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<filter>
    <filter-name>SimplePageCachingFilter</filter-name>
    <filter-class>net.sf.ehcache.constructs.web.filter.SimplePageCachingFilter</filter-class>
    <init-param>
        <param-name>varyHeader</param-name>
	<param-value>true</param-value>
    </init-param>
</filter>
    
<filter-mapping>
    <filter-name>SimplePageCachingFilter</filter-name>
    <url-pattern>/objects/*</url-pattern>
</filter-mapping>
	
<servlet>
    <servlet-name>rio</servlet-name>
    <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
	
<servlet-mapping>
    <servlet-name>rio</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

Re: CXF and ehcache-web

Posted by Matthew Glubb <ma...@madebykite.com>.
No problem, Sergey. Glad it came to some use.

Matt
	

Matthew Glubb
Technical Partner

email: matthew.glubb@madebykite.com
phone: 44 (0) 7715 754017
skype: mglubb

Kite
http://madebykite.com

--
GPG: 96FF DE0E 0B7B 37F0 7F8D C54C E285 3D8F 5625 9244

On 4 May 2011, at 14:57, Sergey Beryozkin wrote:

> Hi Matt,
> 
> Finally added some documentation:
> 
> https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Advanced+Features
> 
> thanks for sending me the test project the other day
> 
> Cheers, Sergey
> 
> On Wed, Mar 23, 2011 at 4:47 PM, Sergey Beryozkin <sb...@gmail.com> wrote:
>> Hi Matt
>> 
>> Good news, thanks, I will add some relevant documentations asap
>> 
>> Cheers, Sergey


Re: CXF and ehcache-web

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi

On Wed, May 4, 2011 at 3:04 PM, Matthew Glubb <ma...@madebykite.com> wrote:
> Thanks for the additional documentation annotations in 2.4.0 btw!
>
Glad they can actually be used :-),

thanks, Sergey

>
> Matthew Glubb
> Technical Partner
>
> email: matthew.glubb@madebykite.com
> phone: 44 (0) 7715 754017
> skype: mglubb
>
> Kite
> http://madebykite.com
>
> --
> GPG: 96FF DE0E 0B7B 37F0 7F8D C54C E285 3D8F 5625 9244
>
> On 4 May 2011, at 14:57, Sergey Beryozkin wrote:
>
>> Hi Matt,
>>
>> Finally added some documentation:
>>
>> https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Advanced+Features
>>
>> thanks for sending me the test project the other day
>>
>> Cheers, Sergey
>>
>> On Wed, Mar 23, 2011 at 4:47 PM, Sergey Beryozkin <sb...@gmail.com> wrote:
>>> Hi Matt
>>>
>>> Good news, thanks, I will add some relevant documentations asap
>>>
>>> Cheers, Sergey
>
>

Re: CXF and ehcache-web

Posted by Matthew Glubb <ma...@madebykite.com>.
Thanks for the additional documentation annotations in 2.4.0 btw!
	

Matthew Glubb
Technical Partner

email: matthew.glubb@madebykite.com
phone: 44 (0) 7715 754017
skype: mglubb

Kite
http://madebykite.com

--
GPG: 96FF DE0E 0B7B 37F0 7F8D C54C E285 3D8F 5625 9244

On 4 May 2011, at 14:57, Sergey Beryozkin wrote:

> Hi Matt,
> 
> Finally added some documentation:
> 
> https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Advanced+Features
> 
> thanks for sending me the test project the other day
> 
> Cheers, Sergey
> 
> On Wed, Mar 23, 2011 at 4:47 PM, Sergey Beryozkin <sb...@gmail.com> wrote:
>> Hi Matt
>> 
>> Good news, thanks, I will add some relevant documentations asap
>> 
>> Cheers, Sergey


Re: CXF and ehcache-web

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Matt,

Finally added some documentation:

https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Advanced+Features

thanks for sending me the test project the other day

Cheers, Sergey

On Wed, Mar 23, 2011 at 4:47 PM, Sergey Beryozkin <sb...@gmail.com> wrote:
> Hi Matt
>
> Good news, thanks, I will add some relevant documentations asap
>
> Cheers, Sergey

Re: CXF and ehcache-web

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Matt

Good news, thanks, I will add some relevant documentations asap

Cheers, Sergey

On Wed, Mar 23, 2011 at 4:09 PM, Matthew Glubb <ma...@madebykite.com> wrote:

> Hi Sergey,
>
> I just wanted to let you know I found the problem. No issue with CXF you'll
> be glad to hear. One of my dependencies was including an old version of
> ehcache.
>
> Thanks very much for your help,
>
>
> Matt
>
>
> Matthew Glubb
> Technical Partner
>
> email: matthew.glubb@madebykite.com
> phone: 44 (0) 7715 754017
> skype: mglubb
>
> Kite
> http://madebykite.com
>

Re: CXF and ehcache-web

Posted by Matthew Glubb <ma...@madebykite.com>.
Hi Sergey,

I just wanted to let you know I found the problem. No issue with CXF you'll be glad to hear. One of my dependencies was including an old version of ehcache.

Thanks very much for your help,


Matt
	

Matthew Glubb
Technical Partner

email: matthew.glubb@madebykite.com
phone: 44 (0) 7715 754017
skype: mglubb

Kite
http://madebykite.com

--
GPG: 96FF DE0E 0B7B 37F0 7F8D C54C E285 3D8F 5625 9244

On 23 Mar 2011, at 12:37, Matthew Glubb wrote:

> Hi Sergey,
> 
> Will do. I'll send you a sample maven project. It's all pretty simple really.
> 
> Matt
> 	
> 
> Matthew Glubb
> Technical Partner
> 
> email: matthew.glubb@madebykite.com
> phone: 44 (0) 7715 754017
> skype: mglubb
> 
> Kite
> http://madebykite.com
> 
> --
> GPG: 96FF DE0E 0B7B 37F0 7F8D C54C E285 3D8F 5625 9244
> 
> On 23 Mar 2011, at 12:13, Sergey Beryozkin wrote:
> 
>> Hi Matt
>> 
>> On Wed, Mar 23, 2011 at 12:07 PM, Matthew Glubb <ma...@madebykite.com> wrote:
>> 
>>> Hi Sergey,
>>> 
>>> I wrote a proof of concept testing both json providers side by side. They
>>> both work perfectly with ehcache-web so I think there must be something
>>> strange going on with my own code. Sorry to waste your time.
>>> 
>>> Great, thanks for this confirmation and no problems at all - I've spent no
>> time on this issue :-)
>> It is still a possibility that your code indirectly exposes some issue with
>> CXF - let us know please if you find something.
>> 
>> Also, if you could share somehow the sample configuration/project then I can
>> add some documentation to the wiki on how to use CXF with the ehcache-web
>> 
>> thanks, Sergey
>> 
>> 
>>> Matt
>>> 
>>> 
>>> Matthew Glubb
>>> Technical Partner
>>> 
>>> email: matthew.glubb@madebykite.com
>>> phone: 44 (0) 7715 754017
>>> skype: mglubb
>>> 
>>> Kite
>>> http://madebykite.com
>>> 
>>> --
>>> GPG: 96FF DE0E 0B7B 37F0 7F8D C54C E285 3D8F 5625 9244
>>> 
>>> On 23 Mar 2011, at 10:11, Sergey Beryozkin wrote:
>>> 
>>>> Hi Matt
>>>> 
>>>> Just curious, did you get a chance to validate the Jackson provider ? We
>>> may
>>>> still get a chance to track the possible CXF issue down before
>>> 2.4.0/2.3.4
>>>> is out,
>>>> 
>>>> thanks, Sergey
>>>> 
>>>> On Mon, Mar 21, 2011 at 5:32 PM, Sergey Beryozkin <sberyozkin@gmail.com
>>>> wrote:
>>>> 
>>>>> Hi Matt
>>>>> 
>>>>> On Mon, Mar 21, 2011 at 5:28 PM, Matthew Glubb <matt@madebykite.com
>>>> wrote:
>>>>> 
>>>>>> Hi Sergey,
>>>>>> 
>>>>>> On 21 Mar 2011, at 17:09, Sergey Beryozkin wrote:
>>>>>> 
>>>>>>> Sorry for a delay.
>>>>>> 
>>>>>> No problem at all. I appreciate the time. It's one of the few things
>>> you
>>>>>> can never restore to someone.
>>>>>> 
>>>>>> 
>>>>> indeed :-)
>>>>> 
>>>>> 
>>>>>>> Do you know if ehcache filters are wrapping the servlet response
>>> stream
>>>>>> ?
>>>>>>> May be in some specific case the flush() is called on the output
>>> stream
>>>>>> in
>>>>>>> one of the CXF providers which may be the cause of this exception ?
>>>>>> 
>>>>>> I believe that they do wrap the response stream. This is to modify the
>>>>>> headers after a cache miss. In the case of a cache hit we wouldn't get
>>> as
>>>>>> far as the servlet.
>>>>>> 
>>>>>> I'm using org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider. I'll look
>>>>>> into it.
>>>>>> 
>>>>>> 
>>>>> you may want to try org.apache.cxf.jaxrs.provider.JSONProvider, just to
>>> see
>>>>> if it's anything to do with providers at all...
>>>>> 
>>>>> 
>>>>>>> If you could open a JIRA and provide a simple maven project for us to
>>>>>>> test/debug then it can help...
>>>>>> 
>>>>>> If the providers don't turn up anything I'll do that.
>>>>>> 
>>>>>> 
>>>>> ok, thanks
>>>>> 
>>>>> Sergey
>>>>> 
>>>>> 
>>>>>> Thanks,
>>>>>> 
>>>>>> 
>>>>>> Matt
>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>>> 
>>>> --
>>>> Sergey Beryozkin
>>>> 
>>>> Application Integration Division of Talend <http://www.talend.com>
>>>> http://sberyozkin.blogspot.com
>>> 
>>> 
> 


Re: CXF and ehcache-web

Posted by Matthew Glubb <ma...@madebykite.com>.
Hi Sergey,

Will do. I'll send you a sample maven project. It's all pretty simple really.

Matt
	

Matthew Glubb
Technical Partner

email: matthew.glubb@madebykite.com
phone: 44 (0) 7715 754017
skype: mglubb

Kite
http://madebykite.com

--
GPG: 96FF DE0E 0B7B 37F0 7F8D C54C E285 3D8F 5625 9244

On 23 Mar 2011, at 12:13, Sergey Beryozkin wrote:

> Hi Matt
> 
> On Wed, Mar 23, 2011 at 12:07 PM, Matthew Glubb <ma...@madebykite.com> wrote:
> 
>> Hi Sergey,
>> 
>> I wrote a proof of concept testing both json providers side by side. They
>> both work perfectly with ehcache-web so I think there must be something
>> strange going on with my own code. Sorry to waste your time.
>> 
>> Great, thanks for this confirmation and no problems at all - I've spent no
> time on this issue :-)
> It is still a possibility that your code indirectly exposes some issue with
> CXF - let us know please if you find something.
> 
> Also, if you could share somehow the sample configuration/project then I can
> add some documentation to the wiki on how to use CXF with the ehcache-web
> 
> thanks, Sergey
> 
> 
>> Matt
>> 
>> 
>> Matthew Glubb
>> Technical Partner
>> 
>> email: matthew.glubb@madebykite.com
>> phone: 44 (0) 7715 754017
>> skype: mglubb
>> 
>> Kite
>> http://madebykite.com
>> 
>> --
>> GPG: 96FF DE0E 0B7B 37F0 7F8D C54C E285 3D8F 5625 9244
>> 
>> On 23 Mar 2011, at 10:11, Sergey Beryozkin wrote:
>> 
>>> Hi Matt
>>> 
>>> Just curious, did you get a chance to validate the Jackson provider ? We
>> may
>>> still get a chance to track the possible CXF issue down before
>> 2.4.0/2.3.4
>>> is out,
>>> 
>>> thanks, Sergey
>>> 
>>> On Mon, Mar 21, 2011 at 5:32 PM, Sergey Beryozkin <sberyozkin@gmail.com
>>> wrote:
>>> 
>>>> Hi Matt
>>>> 
>>>> On Mon, Mar 21, 2011 at 5:28 PM, Matthew Glubb <matt@madebykite.com
>>> wrote:
>>>> 
>>>>> Hi Sergey,
>>>>> 
>>>>> On 21 Mar 2011, at 17:09, Sergey Beryozkin wrote:
>>>>> 
>>>>>> Sorry for a delay.
>>>>> 
>>>>> No problem at all. I appreciate the time. It's one of the few things
>> you
>>>>> can never restore to someone.
>>>>> 
>>>>> 
>>>> indeed :-)
>>>> 
>>>> 
>>>>>> Do you know if ehcache filters are wrapping the servlet response
>> stream
>>>>> ?
>>>>>> May be in some specific case the flush() is called on the output
>> stream
>>>>> in
>>>>>> one of the CXF providers which may be the cause of this exception ?
>>>>> 
>>>>> I believe that they do wrap the response stream. This is to modify the
>>>>> headers after a cache miss. In the case of a cache hit we wouldn't get
>> as
>>>>> far as the servlet.
>>>>> 
>>>>> I'm using org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider. I'll look
>>>>> into it.
>>>>> 
>>>>> 
>>>> you may want to try org.apache.cxf.jaxrs.provider.JSONProvider, just to
>> see
>>>> if it's anything to do with providers at all...
>>>> 
>>>> 
>>>>>> If you could open a JIRA and provide a simple maven project for us to
>>>>>> test/debug then it can help...
>>>>> 
>>>>> If the providers don't turn up anything I'll do that.
>>>>> 
>>>>> 
>>>> ok, thanks
>>>> 
>>>> Sergey
>>>> 
>>>> 
>>>>> Thanks,
>>>>> 
>>>>> 
>>>>> Matt
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>> 
>>> 
>>> --
>>> Sergey Beryozkin
>>> 
>>> Application Integration Division of Talend <http://www.talend.com>
>>> http://sberyozkin.blogspot.com
>> 
>> 


Re: CXF and ehcache-web

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Matt

On Wed, Mar 23, 2011 at 12:07 PM, Matthew Glubb <ma...@madebykite.com> wrote:

> Hi Sergey,
>
> I wrote a proof of concept testing both json providers side by side. They
> both work perfectly with ehcache-web so I think there must be something
> strange going on with my own code. Sorry to waste your time.
>
> Great, thanks for this confirmation and no problems at all - I've spent no
time on this issue :-)
It is still a possibility that your code indirectly exposes some issue with
CXF - let us know please if you find something.

Also, if you could share somehow the sample configuration/project then I can
add some documentation to the wiki on how to use CXF with the ehcache-web

thanks, Sergey


> Matt
>
>
> Matthew Glubb
> Technical Partner
>
> email: matthew.glubb@madebykite.com
> phone: 44 (0) 7715 754017
> skype: mglubb
>
> Kite
> http://madebykite.com
>
> --
> GPG: 96FF DE0E 0B7B 37F0 7F8D C54C E285 3D8F 5625 9244
>
> On 23 Mar 2011, at 10:11, Sergey Beryozkin wrote:
>
> > Hi Matt
> >
> > Just curious, did you get a chance to validate the Jackson provider ? We
> may
> > still get a chance to track the possible CXF issue down before
> 2.4.0/2.3.4
> > is out,
> >
> > thanks, Sergey
> >
> > On Mon, Mar 21, 2011 at 5:32 PM, Sergey Beryozkin <sberyozkin@gmail.com
> >wrote:
> >
> >> Hi Matt
> >>
> >> On Mon, Mar 21, 2011 at 5:28 PM, Matthew Glubb <matt@madebykite.com
> >wrote:
> >>
> >>> Hi Sergey,
> >>>
> >>> On 21 Mar 2011, at 17:09, Sergey Beryozkin wrote:
> >>>
> >>>> Sorry for a delay.
> >>>
> >>> No problem at all. I appreciate the time. It's one of the few things
> you
> >>> can never restore to someone.
> >>>
> >>>
> >> indeed :-)
> >>
> >>
> >>>> Do you know if ehcache filters are wrapping the servlet response
> stream
> >>> ?
> >>>> May be in some specific case the flush() is called on the output
> stream
> >>> in
> >>>> one of the CXF providers which may be the cause of this exception ?
> >>>
> >>> I believe that they do wrap the response stream. This is to modify the
> >>> headers after a cache miss. In the case of a cache hit we wouldn't get
> as
> >>> far as the servlet.
> >>>
> >>> I'm using org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider. I'll look
> >>> into it.
> >>>
> >>>
> >> you may want to try org.apache.cxf.jaxrs.provider.JSONProvider, just to
> see
> >> if it's anything to do with providers at all...
> >>
> >>
> >>>> If you could open a JIRA and provide a simple maven project for us to
> >>>> test/debug then it can help...
> >>>
> >>> If the providers don't turn up anything I'll do that.
> >>>
> >>>
> >> ok, thanks
> >>
> >> Sergey
> >>
> >>
> >>> Thanks,
> >>>
> >>>
> >>> Matt
> >>>
> >>>
> >>>
> >>
> >
> >
> > --
> > Sergey Beryozkin
> >
> > Application Integration Division of Talend <http://www.talend.com>
> > http://sberyozkin.blogspot.com
>
>

Re: CXF and ehcache-web

Posted by Matthew Glubb <ma...@madebykite.com>.
Hi Sergey,

I wrote a proof of concept testing both json providers side by side. They both work perfectly with ehcache-web so I think there must be something strange going on with my own code. Sorry to waste your time.

Matt
	

Matthew Glubb
Technical Partner

email: matthew.glubb@madebykite.com
phone: 44 (0) 7715 754017
skype: mglubb

Kite
http://madebykite.com

--
GPG: 96FF DE0E 0B7B 37F0 7F8D C54C E285 3D8F 5625 9244

On 23 Mar 2011, at 10:11, Sergey Beryozkin wrote:

> Hi Matt
> 
> Just curious, did you get a chance to validate the Jackson provider ? We may
> still get a chance to track the possible CXF issue down before 2.4.0/2.3.4
> is out,
> 
> thanks, Sergey
> 
> On Mon, Mar 21, 2011 at 5:32 PM, Sergey Beryozkin <sb...@gmail.com>wrote:
> 
>> Hi Matt
>> 
>> On Mon, Mar 21, 2011 at 5:28 PM, Matthew Glubb <ma...@madebykite.com>wrote:
>> 
>>> Hi Sergey,
>>> 
>>> On 21 Mar 2011, at 17:09, Sergey Beryozkin wrote:
>>> 
>>>> Sorry for a delay.
>>> 
>>> No problem at all. I appreciate the time. It's one of the few things you
>>> can never restore to someone.
>>> 
>>> 
>> indeed :-)
>> 
>> 
>>>> Do you know if ehcache filters are wrapping the servlet response stream
>>> ?
>>>> May be in some specific case the flush() is called on the output stream
>>> in
>>>> one of the CXF providers which may be the cause of this exception ?
>>> 
>>> I believe that they do wrap the response stream. This is to modify the
>>> headers after a cache miss. In the case of a cache hit we wouldn't get as
>>> far as the servlet.
>>> 
>>> I'm using org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider. I'll look
>>> into it.
>>> 
>>> 
>> you may want to try org.apache.cxf.jaxrs.provider.JSONProvider, just to see
>> if it's anything to do with providers at all...
>> 
>> 
>>>> If you could open a JIRA and provide a simple maven project for us to
>>>> test/debug then it can help...
>>> 
>>> If the providers don't turn up anything I'll do that.
>>> 
>>> 
>> ok, thanks
>> 
>> Sergey
>> 
>> 
>>> Thanks,
>>> 
>>> 
>>> Matt
>>> 
>>> 
>>> 
>> 
> 
> 
> -- 
> Sergey Beryozkin
> 
> Application Integration Division of Talend <http://www.talend.com>
> http://sberyozkin.blogspot.com


Re: CXF and ehcache-web

Posted by Matthew Glubb <ma...@madebykite.com>.
Hi Sergey,

I haven't had a chance to validate the Jackson provider. I'll do it today.

Matt
	

Matthew Glubb
Technical Partner

email: matthew.glubb@madebykite.com
phone: 44 (0) 7715 754017
skype: mglubb

Kite
http://madebykite.com

--
GPG: 96FF DE0E 0B7B 37F0 7F8D C54C E285 3D8F 5625 9244

On 23 Mar 2011, at 10:11, Sergey Beryozkin wrote:

> Hi Matt
> 
> Just curious, did you get a chance to validate the Jackson provider ? We may
> still get a chance to track the possible CXF issue down before 2.4.0/2.3.4
> is out,
> 
> thanks, Sergey
> 
> On Mon, Mar 21, 2011 at 5:32 PM, Sergey Beryozkin <sb...@gmail.com>wrote:
> 
>> Hi Matt
>> 
>> On Mon, Mar 21, 2011 at 5:28 PM, Matthew Glubb <ma...@madebykite.com>wrote:
>> 
>>> Hi Sergey,
>>> 
>>> On 21 Mar 2011, at 17:09, Sergey Beryozkin wrote:
>>> 
>>>> Sorry for a delay.
>>> 
>>> No problem at all. I appreciate the time. It's one of the few things you
>>> can never restore to someone.
>>> 
>>> 
>> indeed :-)
>> 
>> 
>>>> Do you know if ehcache filters are wrapping the servlet response stream
>>> ?
>>>> May be in some specific case the flush() is called on the output stream
>>> in
>>>> one of the CXF providers which may be the cause of this exception ?
>>> 
>>> I believe that they do wrap the response stream. This is to modify the
>>> headers after a cache miss. In the case of a cache hit we wouldn't get as
>>> far as the servlet.
>>> 
>>> I'm using org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider. I'll look
>>> into it.
>>> 
>>> 
>> you may want to try org.apache.cxf.jaxrs.provider.JSONProvider, just to see
>> if it's anything to do with providers at all...
>> 
>> 
>>>> If you could open a JIRA and provide a simple maven project for us to
>>>> test/debug then it can help...
>>> 
>>> If the providers don't turn up anything I'll do that.
>>> 
>>> 
>> ok, thanks
>> 
>> Sergey
>> 
>> 
>>> Thanks,
>>> 
>>> 
>>> Matt
>>> 
>>> 
>>> 
>> 
> 
> 
> -- 
> Sergey Beryozkin
> 
> Application Integration Division of Talend <http://www.talend.com>
> http://sberyozkin.blogspot.com


Re: CXF and ehcache-web

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Matt

Just curious, did you get a chance to validate the Jackson provider ? We may
still get a chance to track the possible CXF issue down before 2.4.0/2.3.4
is out,

thanks, Sergey

On Mon, Mar 21, 2011 at 5:32 PM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Hi Matt
>
> On Mon, Mar 21, 2011 at 5:28 PM, Matthew Glubb <ma...@madebykite.com>wrote:
>
>> Hi Sergey,
>>
>> On 21 Mar 2011, at 17:09, Sergey Beryozkin wrote:
>>
>> > Sorry for a delay.
>>
>> No problem at all. I appreciate the time. It's one of the few things you
>> can never restore to someone.
>>
>>
> indeed :-)
>
>
>> > Do you know if ehcache filters are wrapping the servlet response stream
>> ?
>> > May be in some specific case the flush() is called on the output stream
>> in
>> > one of the CXF providers which may be the cause of this exception ?
>>
>> I believe that they do wrap the response stream. This is to modify the
>> headers after a cache miss. In the case of a cache hit we wouldn't get as
>> far as the servlet.
>>
>> I'm using org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider. I'll look
>> into it.
>>
>>
> you may want to try org.apache.cxf.jaxrs.provider.JSONProvider, just to see
> if it's anything to do with providers at all...
>
>
>>  > If you could open a JIRA and provide a simple maven project for us to
>> > test/debug then it can help...
>>
>> If the providers don't turn up anything I'll do that.
>>
>>
> ok, thanks
>
> Sergey
>
>
>> Thanks,
>>
>>
>> Matt
>>
>>
>>
>


-- 
Sergey Beryozkin

Application Integration Division of Talend <http://www.talend.com>
http://sberyozkin.blogspot.com

Re: CXF and ehcache-web

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Matt

On Mon, Mar 21, 2011 at 5:28 PM, Matthew Glubb <ma...@madebykite.com> wrote:

> Hi Sergey,
>
> On 21 Mar 2011, at 17:09, Sergey Beryozkin wrote:
>
> > Sorry for a delay.
>
> No problem at all. I appreciate the time. It's one of the few things you
> can never restore to someone.
>
>
indeed :-)


> > Do you know if ehcache filters are wrapping the servlet response stream ?
> > May be in some specific case the flush() is called on the output stream
> in
> > one of the CXF providers which may be the cause of this exception ?
>
> I believe that they do wrap the response stream. This is to modify the
> headers after a cache miss. In the case of a cache hit we wouldn't get as
> far as the servlet.
>
> I'm using org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider. I'll look
> into it.
>
>
you may want to try org.apache.cxf.jaxrs.provider.JSONProvider, just to see
if it's anything to do with providers at all...


> > If you could open a JIRA and provide a simple maven project for us to
> > test/debug then it can help...
>
> If the providers don't turn up anything I'll do that.
>
>
ok, thanks

Sergey


> Thanks,
>
>
> Matt
>
>
>

Re: CXF and ehcache-web

Posted by Matthew Glubb <ma...@madebykite.com>.
Hi Sergey,

On 21 Mar 2011, at 17:09, Sergey Beryozkin wrote:

> Sorry for a delay.

No problem at all. I appreciate the time. It's one of the few things you can never restore to someone.

> Do you know if ehcache filters are wrapping the servlet response stream ?
> May be in some specific case the flush() is called on the output stream in
> one of the CXF providers which may be the cause of this exception ?

I believe that they do wrap the response stream. This is to modify the headers after a cache miss. In the case of a cache hit we wouldn't get as far as the servlet.

I'm using org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider. I'll look into it.

> If you could open a JIRA and provide a simple maven project for us to
> test/debug then it can help...

If the providers don't turn up anything I'll do that.

Thanks,


Matt



> 
> thanks, Sergey
> 
> 
>> 
>> Matt
>> 
>> 
>> Matthew Glubb
>> Technical Partner
>> 
>> email: matthew.glubb@madebykite.com
>> phone: 44 (0) 7715 754017
>> skype: mglubb
>> 
>> Kite
>> http://madebykite.com
>> 
>> --
>> GPG: 96FF DE0E 0B7B 37F0 7F8D C54C E285 3D8F 5625 9244
>> 
>> <context-param>
>>   <param-name>contextConfigLocation</param-name>
>>   <param-value>classpath*:webappContext.xml
>> /WEB-INF/rio-servlet.xml</param-value>
>> </context-param>
>> 
>> <listener>
>> 
>> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>> </listener>
>> 
>> <filter>
>>   <filter-name>SimplePageCachingFilter</filter-name>
>> 
>> <filter-class>net.sf.ehcache.constructs.web.filter.SimplePageCachingFilter</filter-class>
>>   <init-param>
>>       <param-name>varyHeader</param-name>
>>       <param-value>true</param-value>
>>   </init-param>
>> </filter>
>> 
>> <filter-mapping>
>>   <filter-name>SimplePageCachingFilter</filter-name>
>>   <url-pattern>/objects/*</url-pattern>
>> </filter-mapping>
>> 
>> <servlet>
>>   <servlet-name>rio</servlet-name>
>> 
>> <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
>>   <load-on-startup>1</load-on-startup>
>> </servlet>
>> 
>> <servlet-mapping>
>>   <servlet-name>rio</servlet-name>
>>   <url-pattern>/*</url-pattern>
>> </servlet-mapping>


Re: CXF and ehcache-web

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Matt

Sorry for a delay.


On Fri, Mar 18, 2011 at 10:15 AM, Matthew Glubb <ma...@madebykite.com> wrote:

> Hi All,
>
> I'm trying to use ehcache-web 2.0.3 with apache-cxf 2.3.3 and Tomcat 6.
> There doesn't seem to be much in the way of information online about it and
> I wondered if anyone else had tried it. I have an issue where for the first,
> uncached request I get the following error:
>
> net.sf.ehcache.constructs.web.AlreadyCommittedException: Response already
> committed after doing buildPagebut before writing response from PageInfo.
>
> Subsequent requests are returned correctly by the cache until the cache
> content goes stale and then we get the same error above.
>
> Googling turns up similar issues that seem to have subsequently been fixed
> for WebLogic but no issues have been reported for Tomcat.
>
> I'm not massively knowledgeable about the internals of Tomcat's
> request/response pipeline but it seems to me that when ehcache records a
> cache miss, it passes the request down the line to the CXF servlet but CXF
> commits the response before ehcache has a chance to modify the response
> headers.
>
>
Do you know if ehcache filters are wrapping the servlet response stream ?
May be in some specific case the flush() is called on the output stream in
one of the CXF providers which may be the cause of this exception ?


> I've got a pretty simple web.xml at the moment (see it at the end of this
> email). Can anyone cast any light on this? How can I ensure that CXF doesn't
> commit the response before the end of the filter chain?
>
> I've already tried adding:
>
> <dispatcher>REQUEST</dispatcher>
> <dispatcher>INCLUDE</dispatcher>
> <dispatcher>FORWARD</dispatcher>
>
> to my filter mapping but it didn't appear to make any difference.
>
> Thanks very much,
>
>
If you could open a JIRA and provide a simple maven project for us to
test/debug then it can help...

thanks, Sergey


>
> Matt
>
>
> Matthew Glubb
> Technical Partner
>
> email: matthew.glubb@madebykite.com
> phone: 44 (0) 7715 754017
> skype: mglubb
>
> Kite
> http://madebykite.com
>
> --
> GPG: 96FF DE0E 0B7B 37F0 7F8D C54C E285 3D8F 5625 9244
>
> <context-param>
>    <param-name>contextConfigLocation</param-name>
>    <param-value>classpath*:webappContext.xml
> /WEB-INF/rio-servlet.xml</param-value>
> </context-param>
>
> <listener>
>
>  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> </listener>
>
> <filter>
>    <filter-name>SimplePageCachingFilter</filter-name>
>
>  <filter-class>net.sf.ehcache.constructs.web.filter.SimplePageCachingFilter</filter-class>
>    <init-param>
>        <param-name>varyHeader</param-name>
>        <param-value>true</param-value>
>    </init-param>
> </filter>
>
> <filter-mapping>
>    <filter-name>SimplePageCachingFilter</filter-name>
>    <url-pattern>/objects/*</url-pattern>
> </filter-mapping>
>
> <servlet>
>    <servlet-name>rio</servlet-name>
>
>  <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
>    <load-on-startup>1</load-on-startup>
> </servlet>
>
> <servlet-mapping>
>    <servlet-name>rio</servlet-name>
>    <url-pattern>/*</url-pattern>
> </servlet-mapping>