You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by J- MAN <jm...@hotmail.com> on 2013/02/06 23:08:56 UTC

Autowired spring bean not working in tomcat 7.0.35 with jax-ws

Hi,
On tomcat 7.0.35 when i have 2 listeners (jax-ws and spring) in my web.xml my spring beans do not get initialized.  It seems as though it initializes my the jax-ws webservice class via sun-jaxws.xml before initializing my beans.  It works fine in Tomcat 6, any way to get this to work in Tomcat 7?
web.xml snippet is below.
Any ideas?

<?xml version="1.0" encoding="UTF-8"?><web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

	<!-- The definition of the Root Spring Container shared by all Servlets 		and Filters HD -->	<context-param>		<param-name>contextConfigLocation</param-name>		<param-value>classpath:webservices_context.xml</param-value>	</context-param>
	<!-- Creates the Spring Container shared by all Servlets and Filters HD -->	<listener>		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>	</listener>

<listener>        <listener-class>                com.sun.xml.ws.transport.http.servlet.WSServletContextListener        </listener-class>    </listener>
<servlet>		<servlet-name>testService</servlet-name>		        <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>        <load-on-startup>1</load-on-startup>	</servlet>    	<servlet-mapping>		<servlet-name>testService</servlet-name>		<url-pattern>/ws/*</url-pattern>			</servlet-mapping>

</web-app> 		 	   		  

Re: Autowired spring bean not working in tomcat 7.0.35 with jax-ws

Posted by Konstantin Kolinko <kn...@gmail.com>.
2013/2/7 J- MAN <jm...@hotmail.com>:
>
> Hi,
> On tomcat 7.0.35 when i have 2 listeners (jax-ws and spring) in my web.xml my spring beans do not get initialized.  It seems as though it initializes my the jax-ws webservice class via sun-jaxws.xml before initializing my beans.  It works fine in Tomcat 6, any way to get this to work in Tomcat 7?
> web.xml snippet is below.
> Any ideas?
>
> <?xml version="1.0" encoding="UTF-8"?><web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
>
>         <!-- The definition of the Root Spring Container shared by all Servlets                 and Filters HD -->      <context-param>         <param-name>contextConfigLocation</param-name>          <param-value>classpath:webservices_context.xml</param-value>    </context-param>
>         <!-- Creates the Spring Container shared by all Servlets and Filters HD -->     <listener>              <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>  </listener>
>
> <listener>        <listener-class>                com.sun.xml.ws.transport.http.servlet.WSServletContextListener        </listener-class>    </listener>
> <servlet>               <servlet-name>testService</servlet-name>                        <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>        <load-on-startup>1</load-on-startup>      </servlet>      <servlet-mapping>               <servlet-name>testService</servlet-name>                <url-pattern>/ws/*</url-pattern>                        </servlet-mapping>
>
> </web-app>


1. You suspect that your listeners are called in wrong order?
In what order do you expect them to be called?

2. Try "logEffectiveWebXml" option on Context

3. What are your evidences?

4. If you cannot get much from logging, maybe debugging would help
http://wiki.apache.org/tomcat/FAQ/Developing#Debugging

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org