Announcement Announcement Module
Collapse
No announcement yet.
JAX-WS autowiring doesn't work on WebLogic Server Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JAX-WS autowiring doesn't work on WebLogic Server

    Hi,

    Recently I'm trying to add Spring's autowiring support to my JAX-WS web services by having them inherit from SpringBeanAutowiringSupport, i.e.

    #WebService
    public class Foo extends SpringBeanAutowiringSupport {

    #Autowired
    private Bar bar;

    }

    And also, define these services in web.xml:

    <listener>
    <listener-class>org.springframework.web.context.ContextLoade rListener</listener-class>
    </listener>

    <servlet>
    <servlet-name>Foo</servlet-name>
    <servlet-class>xxx.Foo</servlet-class>
    <load-on-startup>0</load-on-startup>
    </servlet>

    But however, at runtime I found the dependency injection never happened. After looking into Spring's code, I guess the problem might be that Spring probably requires that my WS servlet and ContextLoaderListener should be able to get access to exactly the same thread context class loader (i.e. the classloader for the webapp), but when weblogic processes my servlet, it temporarily sets the thread context class loader to a dedicated JAXWS class loader which inherits from the regular webapp class loader, and this causes that my servlet can't share the spring application context of the webapp, so that the DI gets ignored.

    If I'm not doing anything wrong, I just wonder if there's any solution on the spring side?

    Thanks a lot!

  • #2
    I am trying to do the same thing and it doesnt seem to work. Has anyone tried using the SpringBeanAutowiringSupport on endpoint and got the injection working? I have spent a lot of time on this and am going nowhere. I am using weblogic 10.3 onJava 6

    Comment


    • #3
      Hi,

      I doesn't work for me either. I am using tc Server v6.0 with Spring 2.5.6.SEC01 and Apache CXF 2.2.4

      My web.xml is:
      Code:
      <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
          classpath:org/example/remoting/jaxw/cxf-context.xml</param-value>
         </context-param>
         <listener>
           <listenerclass>
            org.springframework.web.context.ContextLoaderListener
          </listener-class>
      	</listener>
      	<servlet>
      	<servlet-name>CXFServlet</servlet-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>/cxf/*</url-pattern>
      	</servlet-mapping>
      The cxf-context.xml is:
      Code:
      <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" />
      
      <context:annotation-config />
      
      <bean id="helloWorld" class="org.example.remoting.SimpleHelloWorld" />
      
      <jaxws:endpoint id="helloWorldService"
        implementor="org.example.remoting.jaxws.HelloWorldEndpoint" address="/helloWorldService" />
      My endpoint implementation is
      Code:
      @WebService
      public class HelloWorldEndpoint extends SpringBeanAutowiringSupport implements RemoteHelloWorld{
      
      	@Autowired
      	private HelloWorld helloWorld;
      	
      	@Override
      	public String getMessage() throws RemoteException {
      		return helloWorld.getMessage();
      	}
      }
      In the logs I see:
      Code:
      DEBUG: org.springframework.web.context.support.SpringBeanAutowiringSupport - Current WebApplicationContext is not available for processing of HelloWorldEndpoint: Make sure this class gets constructed in a Spring web application. Proceeding without injection.
      Zoltan

      Comment


      • #4
        There is a bug opened for that in JIRA: http://jira.springframework.org/browse/SPR-5652

        Comment

        Working...
        X