cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Médérick Thebault <>
Subject Cxf spring and bean defined with "request" scope level.
Date Wed, 15 Sep 2010 12:34:12 GMT
Good morning,

I was thinking my problem is related to CXF and Spring integration/configuration, but after
some tries, I am a bit puzzled.

Here is the deal : In a webservice, I would like to get a bean defined in some beans.xml file
as it is defined in Spring 
and which is scope is "request".

<beans xmlns=""

     <bean id="test" class="pricing.beans.Ancestor" scope="request">

Environment :
Web service with cxf 2.2.10 with spring conf.

Reading Spring documentation @
shows :

_The other scopes, namely request, session, and global session are for use only in web-based
applications (and can be 
used irrespective of which particular web application framework you are using, if indeed any).
In the interest of 
keeping related concepts together in one place in the reference documentation, these scopes
are described here.

[Note]	Note :
The scopes that are described in the following paragraphs are only available if you are using
a web-aware Spring 
ApplicationContext implementation (such as XmlWebApplicationContext). If you try using these
next scopes with regular 
Spring IoC containers such as the XmlBeanFactory or ClassPathXmlApplicationContext, you will
get an 
IllegalStateException complaining about an unknown bean scope._

When trying to get a bean, I get the error mentioned, ie "No Scope registered for scope 'request'".

         ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml"); //No
exception here, beans.xml found.
         Ancestor anc = (Ancestor) context.getBean("test"); // Exception cast here with
		java.lang.IllegalStateException: No Scope registered for scope 'request' error message

That means I can not use this? Is there another way to achieve this, I mean getting a new
Bean provided by CXF/Spring 
for each HttpRequest?

Thanx for your help,


<div style="width:60%;">
<p style="font-size:10px; font-family:Verdana;line-height:10px;color:grey;">
<b>Bretagne Angleterre Irlande (Groupe Brittany Ferries - Serestel)</b><BR><BR>
Siège social : Port du Bloscon BP 72 29688 Roscoff cedex France - Tél + 33 2 98 29 28 00
- Fax + 33 2 98 29 27 00<BR>
Société Anonyme à directoire et conseil de surveillance au capital de 22.831.056 &euro;<BR>
RCS Brest 927 250 217 - Code APE 5010Z - Registre des Opérateurs de Voyages et de Séjours
 N&deg; IMO29100011<BR><BR>

Ce message et toutes les pièces jointes peuvent contenir des informations confidentielles
à l'intention exclusive de ses destinataires.<BR> 
Si vous le recevez par erreur, merci de bien vouloir nous en informer, et le supprimer.<BR>
This message and any attachments may contain confidential information for the intended recipient
If you have received it in error, please contact us, and delete it.<BR>
<div style="width:60%;">

View raw message