You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Abid Hussain <ab...@abid76.de> on 2008/05/13 11:37:41 UTC

do i need ContextLoaderListener?

Hi everybody,

I'm using tomcat 5.5.x. In my web.xml I put the following lines, just 
because it was said so in the cxf-documentation:
<listener>
	<listener-class>
		org.springframework.web.context.ContextLoaderListener
	</listener-class>
</listener>

As far as I understood, the ContextLoaderListener is used when the 
context of the webapp is reloaded, which only happens if the content of 
WEB-INF/classes (resp. WEB-INF/lib) changes.

The only way of deployment I use is by war-files. So am I right, that 
the registration of the ContextLoaderListener in web.xml is not needed 
in this case?

Regards,

Abid

-- 

Abid Hussain
Mail: abid.hussain@abid76.de
Web: http://www.abid76.de

Re: do i need ContextLoaderListener?

Posted by Glen Mazza <gl...@verizon.net>.
I would say yes, as you're doing the second configuration option (manual
declaration and loading of CXF modules) as explained here:
http://www.jroller.com/gmazza/date/20080417#WFstep7 and done here:
http://www.jroller.com/gmazza/date/20080417#WFstep8

If needed, you can load multiple config files, BTW, as shown here:
http://www.jroller.com/gmazza/date/20061128

HTH,
Glen


2008-05-14 Abid Hussain wrote:
> Hi Daniel,
> 
> I don't use a cxf-servlet.xml file. Does that mean, I need to declare a 
> ContextLoaderListener in web.xml (my web.xml and cxf.xml below)?
> 
> For which purpose is the ContextLoaderListener needed?
> 
> Regards,
> 
> Abid
> 
> My web.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app id="WebApp_ID" version="2.4"
> 	xmlns="http://java.sun.com/xml/ns/j2ee"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
> 	<context-param>
> 		<param-name>contextConfigLocation</param-name>
> 		<param-value>WEB-INF/classes/cxf.xml</param-value>
> 	</context-param>
> 
> 	<display-name>Modulverwaltung</display-name>
> 	<servlet>
> 		<display-name>Controller</display-name>
> 		<servlet-name>controller</servlet-name>
> 		<servlet-class>
> 			modulverwaltung.controller.Controller
> 		</servlet-class>
> 		<init-param>
> 			<param-name>log4j-init</param-name>
> 			<param-value>WEB-INF/classes/log4j.properties</param-value>
> 		</init-param>
> 		<load-on-startup>1</load-on-startup>
> 	</servlet>
> 	<servlet>
> 		<display-name>CXF Servlet</display-name>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<servlet-class>
> 			org.apache.cxf.transport.servlet.CXFServlet
> 		</servlet-class>
> 	</servlet>
> 	
> 	<servlet-mapping>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<url-pattern>/services/*</url-pattern>
> 	</servlet-mapping>
> 	<servlet-mapping>
> 		<servlet-name>controller</servlet-name>
> 		<url-pattern>/controller</url-pattern>
> 	</servlet-mapping>
> 
> 	<session-config>
> 		<session-timeout>30</session-timeout>
> 	</session-config>
> 
> 	<jsp-config>
> 		<!-- ... -->
> 	</jsp-config>
> </web-app>
> 
> My cxf.xml:
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:sec="http://cxf.apache.org/configuration/security"
> 	xmlns:http="http://cxf.apache.org/transports/http/configuration"
> 	xsi:schemaLocation="http://cxf.apache.org/configuration/security 
> http://cxf.apache.org/schemas/configuration/security.xsd
>            http://cxf.apache.org/transports/http/configuration 
> http://cxf.apache.org/schemas/configuration/http-conf.xsd
>            http://www.springframework.org/schema/beans 
> http://www.springframework.org/schema/beans/spring-beans.xsd
>            http://cxf.apache.org/jaxws 
> http://cxf.apache.org/schemas/jaxws.xsd">
> 
> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
> 
> 	<http:conduit
> 		name="{http://ws.kvv.mi.fuberlin.de/}KvvServiceImplService.http-conduit">
> 		<http:tlsClientParameters secureSocketProtocol="SSL" />
> 	</http:conduit>
> 	<jaxws:endpoint id="moduleServiceImpl"
> 		implementor="modulverwaltung.service.ModuleServiceImpl"
> 		address="/ModuleService" />
> </beans>
> 
> 
> Daniel Kulp schrieb:
> > 
> > If you are using a cxf-servlet.xml type thing to define your endpoint 
> > beans, then no, you don't need it.
> > 
> > Dan
> > 
> > 
> > On May 13, 2008, at 5:37 AM, Abid Hussain wrote:
> > 
> >> Hi everybody,
> >>
> >> I'm using tomcat 5.5.x. In my web.xml I put the following lines, just 
> >> because it was said so in the cxf-documentation:
> >> <listener>
> >>     <listener-class>
> >>         org.springframework.web.context.ContextLoaderListener
> >>     </listener-class>
> >> </listener>
> >>
> >> As far as I understood, the ContextLoaderListener is used when the 
> >> context of the webapp is reloaded, which only happens if the content 
> >> of WEB-INF/classes (resp. WEB-INF/lib) changes.
> >>
> >> The only way of deployment I use is by war-files. So am I right, that 
> >> the registration of the ContextLoaderListener in web.xml is not needed 
> >> in this case?
> >>
> >> Regards,
> >>
> >> Abid
> >>
> >> -- 
> >>
> >> Abid Hussain
> >> Mail: abid.hussain@abid76.de
> >> Web: http://www.abid76.de
> > 
> > ---
> > Daniel Kulp
> > dkulp@apache.org
> > http://www.dankulp.com/blog
> > 
> > 
> > 
> > 
> > 
> 


Re: do i need ContextLoaderListener?

Posted by Abid Hussain <ab...@abid76.de>.
Hi Daniel,

I don't use a cxf-servlet.xml file. Does that mean, I need to declare a 
ContextLoaderListener in web.xml (my web.xml and cxf.xml below)?

For which purpose is the ContextLoaderListener needed?

Regards,

Abid

My web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
	xmlns="http://java.sun.com/xml/ns/j2ee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>WEB-INF/classes/cxf.xml</param-value>
	</context-param>

	<display-name>Modulverwaltung</display-name>
	<servlet>
		<display-name>Controller</display-name>
		<servlet-name>controller</servlet-name>
		<servlet-class>
			modulverwaltung.controller.Controller
		</servlet-class>
		<init-param>
			<param-name>log4j-init</param-name>
			<param-value>WEB-INF/classes/log4j.properties</param-value>
		</init-param>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet>
		<display-name>CXF Servlet</display-name>
		<servlet-name>CXFServlet</servlet-name>
		<servlet-class>
			org.apache.cxf.transport.servlet.CXFServlet
		</servlet-class>
	</servlet>
	
	<servlet-mapping>
		<servlet-name>CXFServlet</servlet-name>
		<url-pattern>/services/*</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>controller</servlet-name>
		<url-pattern>/controller</url-pattern>
	</servlet-mapping>

	<session-config>
		<session-timeout>30</session-timeout>
	</session-config>

	<jsp-config>
		<!-- ... -->
	</jsp-config>
</web-app>

My cxf.xml:
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:jaxws="http://cxf.apache.org/jaxws"
	xmlns:sec="http://cxf.apache.org/configuration/security"
	xmlns:http="http://cxf.apache.org/transports/http/configuration"
	xsi:schemaLocation="http://cxf.apache.org/configuration/security 
http://cxf.apache.org/schemas/configuration/security.xsd
           http://cxf.apache.org/transports/http/configuration 
http://cxf.apache.org/schemas/configuration/http-conf.xsd
           http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
           http://cxf.apache.org/jaxws 
http://cxf.apache.org/schemas/jaxws.xsd">

	<import resource="classpath:META-INF/cxf/cxf.xml" />
	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

	<http:conduit
		name="{http://ws.kvv.mi.fuberlin.de/}KvvServiceImplService.http-conduit">
		<http:tlsClientParameters secureSocketProtocol="SSL" />
	</http:conduit>
	<jaxws:endpoint id="moduleServiceImpl"
		implementor="modulverwaltung.service.ModuleServiceImpl"
		address="/ModuleService" />
</beans>


Daniel Kulp schrieb:
> 
> If you are using a cxf-servlet.xml type thing to define your endpoint 
> beans, then no, you don't need it.
> 
> Dan
> 
> 
> On May 13, 2008, at 5:37 AM, Abid Hussain wrote:
> 
>> Hi everybody,
>>
>> I'm using tomcat 5.5.x. In my web.xml I put the following lines, just 
>> because it was said so in the cxf-documentation:
>> <listener>
>>     <listener-class>
>>         org.springframework.web.context.ContextLoaderListener
>>     </listener-class>
>> </listener>
>>
>> As far as I understood, the ContextLoaderListener is used when the 
>> context of the webapp is reloaded, which only happens if the content 
>> of WEB-INF/classes (resp. WEB-INF/lib) changes.
>>
>> The only way of deployment I use is by war-files. So am I right, that 
>> the registration of the ContextLoaderListener in web.xml is not needed 
>> in this case?
>>
>> Regards,
>>
>> Abid
>>
>> -- 
>>
>> Abid Hussain
>> Mail: abid.hussain@abid76.de
>> Web: http://www.abid76.de
> 
> ---
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
> 
> 
> 
> 
> 

-- 

Abid Hussain
Mail: abid.hussain@abid76.de
Web: http://www.abid76.de

Re: do i need ContextLoaderListener?

Posted by Glen Mazza <gl...@verizon.net>.
A cxf-servlet.xml file is read by default, so it does not need to be
explicitly listed if you are using it.  But it loads all the possible
CXF modules, which may be more than what you need.  See steps #7 and #8
for an alternative loading method which *does* require you to explicitly
list the CXF config file:

http://www.jroller.com/gmazza/date/20080417#WFstep7

HTH,
Glen


2008-05-14 John-M Baker wrote:
> Daniel.
> 
> Really?  I thought a context loader was required to kick off Spring, but 
> I'm using other Spring related stuff too:  Here's an example:
> 
>   <context-param>
>     <param-name>contextConfigLocation</param-name>
>     <param-value>
>       classpath:configuration-context.xml 
>       classpath:cxf-server-context.xml 
>       classpath:datasource-ldap.xml 
>     </param-value>
>   </context-param>
> 
>   <!-- Loads the Spring application context -->
>   <listener>
>  
> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>   </listener>
> 
>   <servlet>
>     <servlet-name>CXFServlet</servlet-name>
>     <display-name>CXF Servlet</display-name>
>     <servlet-class>
>       org.apache.cxf.transport.servlet.CXFServlet
>     </servlet-class>
>     <load-on-startup>1</load-on-startup>
>   </servlet> 
>   <servlet-mapping>
>     <servlet-name>CXFServlet</servlet-name>
>     <url-pattern>/integration/*</url-pattern>
>   </servlet-mapping> 
> 
> John Baker
> -- 
> Web SSO 
> IT Infrastructure 
> Deutsche Bank London
> 
> URL:  http://websso.cto.gt.intranet.db.com
> 
> 
> 
> 
> Daniel Kulp <dk...@apache.org> 
> 13/05/2008 18:40
> Please respond to
> users@cxf.apache.org
> 
> 
> To
> users@cxf.apache.org
> cc
> 
> Subject
> Re: do i need ContextLoaderListener?
> 
> 
> 
> 
> 
> 
> 
> If you are using a cxf-servlet.xml type thing to define your endpoint 
> beans, then no, you don't need it.
> 
> Dan
> 
> 
> On May 13, 2008, at 5:37 AM, Abid Hussain wrote:
> 
> > Hi everybody,
> >
> > I'm using tomcat 5.5.x. In my web.xml I put the following lines, 
> > just because it was said so in the cxf-documentation:
> > <listener>
> >                <listener-class>
> > org.springframework.web.context.ContextLoaderListener
> >                </listener-class>
> > </listener>
> >
> > As far as I understood, the ContextLoaderListener is used when the 
> > context of the webapp is reloaded, which only happens if the content 
> > of WEB-INF/classes (resp. WEB-INF/lib) changes.
> >
> > The only way of deployment I use is by war-files. So am I right, 
> > that the registration of the ContextLoaderListener in web.xml is not 
> > needed in this case?
> >
> > Regards,
> >
> > Abid
> >
> > -- 
> >
> > Abid Hussain
> > Mail: abid.hussain@abid76.de
> > Web: http://www.abid76.de
> 
> ---
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
> 
> 
> 
> 
> 
> 
> 
> ---
> 
> This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
> 
> Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures.


Re: do i need ContextLoaderListener?

Posted by Daniel Kulp <dk...@apache.org>.
On May 14, 2008, at 10:57 AM, Eoghan Glynn wrote:
> Its also worth noting that you should use the spring context loader  
> listener approach if one of your beans has a dependency on the "cxf"  
> Bus bean (for example takes a reference to this bean via a property).
>
> AFAIK it may lead to some confusing side-effects if you take the  
> simpler approach of defining a cxf-servlet.xml and pulling in  
> everything by default.

Right, this is the full symptom of my comment about "since cxf- 
servlet.xml is processed in a child context, some things don't get  
injected quite the same as the definitions in the parent context  
aren't available in the subcontext".    Basically, definitions by name/ 
id from the parent context are not available when processing the child  
context.   You can probably get around the "Bus" issue by creating a  
spring bean definition for a bus that calls the  
"BusFactory.getThreadDefaultBus()" for the factory method to grab the  
Bus that was created from the first part, but pretty much anything  
else that may be needed inthe parent context aren't available either.

Still, it's not ideal (actually, a little sucky) and I'd definitely  
recommend the context listener approach unless the needs are very  
simplistic.  Most pure jaxws things with no CXF specific stuff would  
qualify.   FYI: the JAX-WS TCK setup we currently use uses the non- 
context listener approach which is why I'm pretty sure most "pure  
jaxws" things can work that way.

That said, one of the "problems" with the context-listener approach is  
that we don't document (very well) the full list of stuff that can be  
imported.   For example, if you need ws-addressing or ws-rm, you need  
to import those cxf-extension things, but I'm not sure how well that's  
documented.   With 2.0.6/2.1, we do have a cxf-all.xml (in the bundle  
jar only) that you can use to get everything, but then you have the  
downside of the startup/memory usage.    We probably need a page on  
the docs to document them all.   For example, the cxf-all contains:

     <import resource="classpath:META-INF/cxf/cxf.xml"/>
     <import resource="classpath:META-INF/cxf/cxf-extension-corba.xml"/>
     <import resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml"/>
     <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
     <import resource="classpath:META-INF/cxf/cxf-extension-xml.xml"/>
     <import resource="classpath:META-INF/cxf/cxf-extension-addr.xml"/>
     <import resource="classpath:META-INF/cxf/cxf-extension-javascript- 
client.xml"/>
     <import resource="classpath:META-INF/cxf/cxf-extension-local.xml"/>
     <import resource="classpath:META-INF/cxf/cxf-extension- 
management.xml"/>
     <import resource="classpath:META-INF/cxf/cxf-extension-http- 
jetty.xml"/>
     <import resource="classpath:META-INF/cxf/cxf-extension-jms.xml"/>
     <import resource="classpath:META-INF/cxf/cxf-extension-object- 
binding.xml"/>
     <import resource="classpath:META-INF/cxf/cxf-extension-http- 
binding.xml"/>
     <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs- 
binding.xml"/>
     <import resource="classpath:META-INF/cxf/cxf-extension- 
policy.xml"/>
     <import resource="classpath:META-INF/cxf/cxf-extension-rm.xml"/>

And that doesn't include the cxf-extension-http or others that the  
above may be importing.  (http-jetty imports http).

Dan



>
> Cheers,
> Eoghan
>
> Daniel Kulp wrote:
>> Yea, really.  :-)
>> Seriously, if the there isn't a spring context listener, we'll  
>> create a default bus using our default bus configurations and grab  
>> the WEB-INF/cxf-servlet.xml file to load the cxf spring bean  
>> definitions. (jaxws:endpoint things for example).
>> This is "simple" to configure.   I think all of our samples if you  
>> do "ant war" in them, it generates a war that does it this way.     
>> I'd like to change the samples to using the spring context way of  
>> doing it, just never got around to it.
>> The downside is that application startup is slower and memory usage  
>> is higher.   The default bus created this way grabs ALL the cxf- 
>> extension-* stuff which is quite possibly more than you need.    
>> This takes a bit longer to initialize.   Also, since cxf- 
>> servlet.xml is processed in a child context, some things don't get  
>> injected quite the same as the definitions in the parent context  
>> aren't available in the subcontext.   It's something to be aware of.
>> Dan
>> On May 14, 2008, at 3:17 AM, John-M Baker wrote:
>>> Daniel.
>>>
>>> Really?  I thought a context loader was required to kick off  
>>> Spring, but
>>> I'm using other Spring related stuff too:  Here's an example:
>>>
>>> <context-param>
>>>   <param-name>contextConfigLocation</param-name>
>>>   <param-value>
>>>     classpath:configuration-context.xml
>>>     classpath:cxf-server-context.xml
>>>     classpath:datasource-ldap.xml
>>>   </param-value>
>>> </context-param>
>>>
>>> <!-- Loads the Spring application context -->
>>> <listener>
>>>
>>> <listener-class>org.springframework.web.context.ContextLoaderListener 
>>> </listener-class>
>>> </listener>
>>>
>>> <servlet>
>>>   <servlet-name>CXFServlet</servlet-name>
>>>   <display-name>CXF Servlet</display-name>
>>>   <servlet-class>
>>>     org.apache.cxf.transport.servlet.CXFServlet
>>>   </servlet-class>
>>>   <load-on-startup>1</load-on-startup>
>>> </servlet>
>>> <servlet-mapping>
>>>   <servlet-name>CXFServlet</servlet-name>
>>>   <url-pattern>/integration/*</url-pattern>
>>> </servlet-mapping>
>>>
>>> John Baker
>>> -- 
>>> Web SSO
>>> IT Infrastructure
>>> Deutsche Bank London
>>>
>>> URL:  http://websso.cto.gt.intranet.db.com
>>>
>>>
>>>
>>>
>>> Daniel Kulp <dk...@apache.org>
>>> 13/05/2008 18:40
>>> Please respond to
>>> users@cxf.apache.org
>>>
>>>
>>> To
>>> users@cxf.apache.org
>>> cc
>>>
>>> Subject
>>> Re: do i need ContextLoaderListener?
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> If you are using a cxf-servlet.xml type thing to define your  
>>> endpoint
>>> beans, then no, you don't need it.
>>>
>>> Dan
>>>
>>>
>>> On May 13, 2008, at 5:37 AM, Abid Hussain wrote:
>>>
>>>> Hi everybody,
>>>>
>>>> I'm using tomcat 5.5.x. In my web.xml I put the following lines,
>>>> just because it was said so in the cxf-documentation:
>>>> <listener>
>>>>              <listener-class>
>>>> org.springframework.web.context.ContextLoaderListener
>>>>              </listener-class>
>>>> </listener>
>>>>
>>>> As far as I understood, the ContextLoaderListener is used when the
>>>> context of the webapp is reloaded, which only happens if the  
>>>> content
>>>> of WEB-INF/classes (resp. WEB-INF/lib) changes.
>>>>
>>>> The only way of deployment I use is by war-files. So am I right,
>>>> that the registration of the ContextLoaderListener in web.xml is  
>>>> not
>>>> needed in this case?
>>>>
>>>> Regards,
>>>>
>>>> Abid
>>>>
>>>> -- 
>>>>
>>>> Abid Hussain
>>>> Mail: abid.hussain@abid76.de
>>>> Web: http://www.abid76.de
>>>
>>> ---
>>> Daniel Kulp
>>> dkulp@apache.org
>>> http://www.dankulp.com/blog
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> ---
>>>
>>> This e-mail may contain confidential and/or privileged  
>>> information. If you are not the intended recipient (or have  
>>> received this e-mail in error) please notify the sender  
>>> immediately and delete this e-mail. Any unauthorized copying,  
>>> disclosure or distribution of the material in this e-mail is  
>>> strictly forbidden.
>>>
>>> Please refer to http://www.db.com/en/content/eu_disclosures.htm  
>>> for additional EU corporate and regulatory disclosures.
>> ---
>> Daniel Kulp
>> dkulp@apache.org
>> http://www.dankulp.com/blog
>
> ----------------------------
> IONA Technologies PLC (registered in Ireland)
> Registered Number: 171387
> Registered Address: The IONA Building, Shelbourne Road, Dublin 4,  
> Ireland

---
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog





Re: do i need ContextLoaderListener?

Posted by Eoghan Glynn <eg...@iona.com>.

Its also worth noting that you should use the spring context loader 
listener approach if one of your beans has a dependency on the "cxf" Bus 
bean (for example takes a reference to this bean via a property).

AFAIK it may lead to some confusing side-effects if you take the simpler 
approach of defining a cxf-servlet.xml and pulling in everything by default.

Cheers,
Eoghan

Daniel Kulp wrote:
> 
> Yea, really.  :-)
> 
> Seriously, if the there isn't a spring context listener, we'll create a 
> default bus using our default bus configurations and grab the 
> WEB-INF/cxf-servlet.xml file to load the cxf spring bean definitions. 
> (jaxws:endpoint things for example).
> 
> This is "simple" to configure.   I think all of our samples if you do 
> "ant war" in them, it generates a war that does it this way.    I'd like 
> to change the samples to using the spring context way of doing it, just 
> never got around to it.
> 
> The downside is that application startup is slower and memory usage is 
> higher.   The default bus created this way grabs ALL the cxf-extension-* 
> stuff which is quite possibly more than you need.   This takes a bit 
> longer to initialize.   Also, since cxf-servlet.xml is processed in a 
> child context, some things don't get injected quite the same as the 
> definitions in the parent context aren't available in the subcontext.   
> It's something to be aware of.
> 
> 
> Dan
> 
> 
> 
> On May 14, 2008, at 3:17 AM, John-M Baker wrote:
> 
>> Daniel.
>>
>> Really?  I thought a context loader was required to kick off Spring, but
>> I'm using other Spring related stuff too:  Here's an example:
>>
>>  <context-param>
>>    <param-name>contextConfigLocation</param-name>
>>    <param-value>
>>      classpath:configuration-context.xml
>>      classpath:cxf-server-context.xml
>>      classpath:datasource-ldap.xml
>>    </param-value>
>>  </context-param>
>>
>>  <!-- Loads the Spring application context -->
>>  <listener>
>>
>> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
>>
>>  </listener>
>>
>>  <servlet>
>>    <servlet-name>CXFServlet</servlet-name>
>>    <display-name>CXF Servlet</display-name>
>>    <servlet-class>
>>      org.apache.cxf.transport.servlet.CXFServlet
>>    </servlet-class>
>>    <load-on-startup>1</load-on-startup>
>>  </servlet>
>>  <servlet-mapping>
>>    <servlet-name>CXFServlet</servlet-name>
>>    <url-pattern>/integration/*</url-pattern>
>>  </servlet-mapping>
>>
>> John Baker
>> -- 
>> Web SSO
>> IT Infrastructure
>> Deutsche Bank London
>>
>> URL:  http://websso.cto.gt.intranet.db.com
>>
>>
>>
>>
>> Daniel Kulp <dk...@apache.org>
>> 13/05/2008 18:40
>> Please respond to
>> users@cxf.apache.org
>>
>>
>> To
>> users@cxf.apache.org
>> cc
>>
>> Subject
>> Re: do i need ContextLoaderListener?
>>
>>
>>
>>
>>
>>
>>
>> If you are using a cxf-servlet.xml type thing to define your endpoint
>> beans, then no, you don't need it.
>>
>> Dan
>>
>>
>> On May 13, 2008, at 5:37 AM, Abid Hussain wrote:
>>
>>> Hi everybody,
>>>
>>> I'm using tomcat 5.5.x. In my web.xml I put the following lines,
>>> just because it was said so in the cxf-documentation:
>>> <listener>
>>>               <listener-class>
>>> org.springframework.web.context.ContextLoaderListener
>>>               </listener-class>
>>> </listener>
>>>
>>> As far as I understood, the ContextLoaderListener is used when the
>>> context of the webapp is reloaded, which only happens if the content
>>> of WEB-INF/classes (resp. WEB-INF/lib) changes.
>>>
>>> The only way of deployment I use is by war-files. So am I right,
>>> that the registration of the ContextLoaderListener in web.xml is not
>>> needed in this case?
>>>
>>> Regards,
>>>
>>> Abid
>>>
>>> -- 
>>>
>>> Abid Hussain
>>> Mail: abid.hussain@abid76.de
>>> Web: http://www.abid76.de
>>
>> ---
>> Daniel Kulp
>> dkulp@apache.org
>> http://www.dankulp.com/blog
>>
>>
>>
>>
>>
>>
>>
>> ---
>>
>> This e-mail may contain confidential and/or privileged information. If 
>> you are not the intended recipient (or have received this e-mail in 
>> error) please notify the sender immediately and delete this e-mail. 
>> Any unauthorized copying, disclosure or distribution of the material 
>> in this e-mail is strictly forbidden.
>>
>> Please refer to http://www.db.com/en/content/eu_disclosures.htm for 
>> additional EU corporate and regulatory disclosures.
> 
> ---
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
> 
> 
> 

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

Re: do i need ContextLoaderListener?

Posted by Daniel Kulp <dk...@apache.org>.
Yea, really.  :-)

Seriously, if the there isn't a spring context listener, we'll create  
a default bus using our default bus configurations and grab the WEB- 
INF/cxf-servlet.xml file to load the cxf spring bean definitions.  
(jaxws:endpoint things for example).

This is "simple" to configure.   I think all of our samples if you do  
"ant war" in them, it generates a war that does it this way.    I'd  
like to change the samples to using the spring context way of doing  
it, just never got around to it.

The downside is that application startup is slower and memory usage is  
higher.   The default bus created this way grabs ALL the cxf-extension- 
* stuff which is quite possibly more than you need.   This takes a bit  
longer to initialize.   Also, since cxf-servlet.xml is processed in a  
child context, some things don't get injected quite the same as the  
definitions in the parent context aren't available in the  
subcontext.   It's something to be aware of.


Dan



On May 14, 2008, at 3:17 AM, John-M Baker wrote:

> Daniel.
>
> Really?  I thought a context loader was required to kick off Spring,  
> but
> I'm using other Spring related stuff too:  Here's an example:
>
>  <context-param>
>    <param-name>contextConfigLocation</param-name>
>    <param-value>
>      classpath:configuration-context.xml
>      classpath:cxf-server-context.xml
>      classpath:datasource-ldap.xml
>    </param-value>
>  </context-param>
>
>  <!-- Loads the Spring application context -->
>  <listener>
>
> <listener- 
> class>org.springframework.web.context.ContextLoaderListener</ 
> listener-class>
>  </listener>
>
>  <servlet>
>    <servlet-name>CXFServlet</servlet-name>
>    <display-name>CXF Servlet</display-name>
>    <servlet-class>
>      org.apache.cxf.transport.servlet.CXFServlet
>    </servlet-class>
>    <load-on-startup>1</load-on-startup>
>  </servlet>
>  <servlet-mapping>
>    <servlet-name>CXFServlet</servlet-name>
>    <url-pattern>/integration/*</url-pattern>
>  </servlet-mapping>
>
> John Baker
> -- 
> Web SSO
> IT Infrastructure
> Deutsche Bank London
>
> URL:  http://websso.cto.gt.intranet.db.com
>
>
>
>
> Daniel Kulp <dk...@apache.org>
> 13/05/2008 18:40
> Please respond to
> users@cxf.apache.org
>
>
> To
> users@cxf.apache.org
> cc
>
> Subject
> Re: do i need ContextLoaderListener?
>
>
>
>
>
>
>
> If you are using a cxf-servlet.xml type thing to define your endpoint
> beans, then no, you don't need it.
>
> Dan
>
>
> On May 13, 2008, at 5:37 AM, Abid Hussain wrote:
>
>> Hi everybody,
>>
>> I'm using tomcat 5.5.x. In my web.xml I put the following lines,
>> just because it was said so in the cxf-documentation:
>> <listener>
>>               <listener-class>
>> org.springframework.web.context.ContextLoaderListener
>>               </listener-class>
>> </listener>
>>
>> As far as I understood, the ContextLoaderListener is used when the
>> context of the webapp is reloaded, which only happens if the content
>> of WEB-INF/classes (resp. WEB-INF/lib) changes.
>>
>> The only way of deployment I use is by war-files. So am I right,
>> that the registration of the ContextLoaderListener in web.xml is not
>> needed in this case?
>>
>> Regards,
>>
>> Abid
>>
>> -- 
>>
>> Abid Hussain
>> Mail: abid.hussain@abid76.de
>> Web: http://www.abid76.de
>
> ---
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
>
>
>
>
>
>
>
> ---
>
> This e-mail may contain confidential and/or privileged information.  
> If you are not the intended recipient (or have received this e-mail  
> in error) please notify the sender immediately and delete this e- 
> mail. Any unauthorized copying, disclosure or distribution of the  
> material in this e-mail is strictly forbidden.
>
> Please refer to http://www.db.com/en/content/eu_disclosures.htm for  
> additional EU corporate and regulatory disclosures.

---
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog





Re: do i need ContextLoaderListener?

Posted by John-M Baker <jo...@db.com>.
Daniel.

Really?  I thought a context loader was required to kick off Spring, but 
I'm using other Spring related stuff too:  Here's an example:

  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
      classpath:configuration-context.xml 
      classpath:cxf-server-context.xml 
      classpath:datasource-ldap.xml 
    </param-value>
  </context-param>

  <!-- Loads the Spring application context -->
  <listener>
 
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>

  <servlet>
    <servlet-name>CXFServlet</servlet-name>
    <display-name>CXF Servlet</display-name>
    <servlet-class>
      org.apache.cxf.transport.servlet.CXFServlet
    </servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet> 
  <servlet-mapping>
    <servlet-name>CXFServlet</servlet-name>
    <url-pattern>/integration/*</url-pattern>
  </servlet-mapping> 

John Baker
-- 
Web SSO 
IT Infrastructure 
Deutsche Bank London

URL:  http://websso.cto.gt.intranet.db.com




Daniel Kulp <dk...@apache.org> 
13/05/2008 18:40
Please respond to
users@cxf.apache.org


To
users@cxf.apache.org
cc

Subject
Re: do i need ContextLoaderListener?







If you are using a cxf-servlet.xml type thing to define your endpoint 
beans, then no, you don't need it.

Dan


On May 13, 2008, at 5:37 AM, Abid Hussain wrote:

> Hi everybody,
>
> I'm using tomcat 5.5.x. In my web.xml I put the following lines, 
> just because it was said so in the cxf-documentation:
> <listener>
>                <listener-class>
> org.springframework.web.context.ContextLoaderListener
>                </listener-class>
> </listener>
>
> As far as I understood, the ContextLoaderListener is used when the 
> context of the webapp is reloaded, which only happens if the content 
> of WEB-INF/classes (resp. WEB-INF/lib) changes.
>
> The only way of deployment I use is by war-files. So am I right, 
> that the registration of the ContextLoaderListener in web.xml is not 
> needed in this case?
>
> Regards,
>
> Abid
>
> -- 
>
> Abid Hussain
> Mail: abid.hussain@abid76.de
> Web: http://www.abid76.de

---
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog







---

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures.

Re: do i need ContextLoaderListener?

Posted by Daniel Kulp <dk...@apache.org>.
If you are using a cxf-servlet.xml type thing to define your endpoint  
beans, then no, you don't need it.

Dan


On May 13, 2008, at 5:37 AM, Abid Hussain wrote:

> Hi everybody,
>
> I'm using tomcat 5.5.x. In my web.xml I put the following lines,  
> just because it was said so in the cxf-documentation:
> <listener>
> 	<listener-class>
> 		org.springframework.web.context.ContextLoaderListener
> 	</listener-class>
> </listener>
>
> As far as I understood, the ContextLoaderListener is used when the  
> context of the webapp is reloaded, which only happens if the content  
> of WEB-INF/classes (resp. WEB-INF/lib) changes.
>
> The only way of deployment I use is by war-files. So am I right,  
> that the registration of the ContextLoaderListener in web.xml is not  
> needed in this case?
>
> Regards,
>
> Abid
>
> -- 
>
> Abid Hussain
> Mail: abid.hussain@abid76.de
> Web: http://www.abid76.de

---
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog