Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8892663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:03:46+00:00 2026-06-14T23:03:46+00:00

I have some integration issues regarding the mentioned classes but only with too new

  • 0

I have some integration issues regarding the mentioned classes but only with “too new” tomcat versions.

The base setup:
web.xml

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

    <display-name>FooService</display-name>

    <servlet>
        <servlet-name>jax-ws</servlet-name>
        <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            classpath:/applicationContext.xml
        </param-value>
    </context-param>

    <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>
</web-app>

FooServiceImpl:

@WebService(serviceName = ServiceInfo.SERVICENAME, targetNamespace = ServiceInfo.TARGETNAMESPACE, endpointInterface = "bar.FooService")
@HandlerChain(file = "/handler-chain.xml")
public class FooServiceImpl extends SpringBeanAutowiringSupport implements FooService {

    @Autowired
    private Bar bar;

    << some methods using the injected bar singleton >>

JAX-WS dependency: compile ‘com.sun.xml.ws:jaxws-rt:2.2.7’
Spring version: 3.1.2.RELEASE

With Tomcat 7.0.22 I don’t have the problem. The declared webapp version in the web.xml is 2.5. Tomcat 7.0.22 doesn’t process the WSServletContainerInitializer. So as declared in web.xml, ContextLoaderListener is initialized first, so an instance of Bar will be available in the WebApplicationContext. Then WSServletContextListener instantiates FooServiceImpl, aoutowiring works and everybody is happy.

But… My colleague tried it with Tomcat 7.0.30 and the autowiring didn’t work (7.0.32 gives the same problem, currently this is the newest). It really couldn’t work, because the new Tomcat version has processed WSServletContainerInitializer, not taking into account the 2.5 webapp version (and metadata-complete=”true”).

I’ve found a possible solution. I commented out the body of the web.xml, changed webapp version to 3.0 and created a WebapplicationInitializer:

public class MyInitializer implements WebApplicationInitializer {

    @Override
    public void onStartup(ServletContext servletContext) throws ServletException {
        ContextLoader loader = new ContextLoader();
        loader.initWebApplicationContext(servletContext);
    }

}

This worked perfectly for me. But not for my colleague… If he tried to run the app, WSServletContainerInitializer fired first which created exactly the same wiring problem as above.

Obviously we can “hack” the problem getting rid of SpringBeanAutowiringSupport and inject Bar manually from a getter or a web method, or any similar way. But SpringBeanAutowiringSupport would be much clearer, so we would like to use it if there’s a good solution for the above problems.

UPDATE: this causes the problems: https://issues.apache.org/bugzilla/show_bug.cgi?id=53619

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T23:03:48+00:00Added an answer on June 14, 2026 at 11:03 pm

    for me the solution was to invoke the following when the autowired reference is null

    processInjectionBasedOnCurrentContext(this);
    

    I hope it helps for all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am integrating PayPal in my website But I have some issues in it.
In using our TeamCity Continuous Integration server we have uncovered some issues that we
I have some long running scripts with breaks requiring input/interaction to continue but when
I had issues with debugging some very complex integration test in our application. The
I have two very annoying issues with Maven-Eclipse integration, from time to time it
I have been trying to connect to some web services using WCF but I
I'm having some issues with jenkins and gerrit. We have some jobs that verifies
I have some jquery/php interaction set up on a page. It submits some data
I have some knowledge about Human computer interaction and some basic knowledge programming scripts
Unfortunately I have to do some interaction with IBM's UniData database system. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.