Results 1 to 4 of 4

Thread: spring load Context problem

  1. #1
    Join Date
    Jan 2008
    Posts
    4

    Default spring load Context problem

    In a standalone CXF ws, I will use the following to start Spring and loads my_cxf.xml file.

    Code:
    <web-app>
    	<context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>WEB-INF/my_cxf.xml</param-value>
    	</context-param>
    
    	<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>/*</url-pattern>
    	</servlet-mapping>
    </web-app>
    Now I need to integrate CXF into my existing application. My existing applicationt has is a customized MySpringLoader in place. Thus I can't use ContextLoaderListener to load cxf anymore.

    Code:
    	<servlet>
    		<servlet-name>context</servlet-name>
    		<servlet-class>
    			com.mycompany.MySpringLoader 
    		</servlet-class>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
    
    
    public class MySpringLoader extends ContextLoaderServlet
    {
    
      public void init() throws ServletException
      {
        super.init();
        WebApplicationContext context = WebApplicationContextUtils.getRequiredWebApplicationContext(this
          .getServletContext());
    
        // customized initialize the factory for the spring impl of SystemServices
      }
    }
    How can I plug in my code to initialize CXF model(which normal is doned throught ContextLoaderListener)?

  2. #2

    Default

    Maybe I don't understand what you're doing, but is it possible to load your servlet with the startup order of 2?
    Code:
    <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>2</load-on-startup>
    </servlet>
    http://static.springframework.org/sp...context-create

  3. #3
    Join Date
    Jan 2008
    Posts
    4

    Default

    I can't use MySpringLoader to load CXF. I want to use normal Spring loader.

  4. #4
    Join Date
    Oct 2008
    Posts
    1

    Default

    Thanks dxxvi this solved my problem we have to use JSF, Spring, and CXf in same webapp, so we couldn't use context listener have to use ContextLoaderServlet.

    Thanks again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •