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 <[EMAIL PROTECTED]>
13/05/2008 18:40
Please respond to
[email protected]


To
[email protected]
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: [EMAIL PROTECTED]
Web: http://www.abid76.de

---
Daniel Kulp
[EMAIL PROTECTED]
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
[EMAIL PROTECTED]
http://www.dankulp.com/blog




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

Reply via email to