Announcement Announcement Module
Collapse
No announcement yet.
spring load Context problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment


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

      Comment


      • #4
        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

        Comment

        Working...
        X