This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have David & Dawn Griffiths on-line!
See this thread for details.
Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Spring Dependence Injection in JAX-WS (@WebService) + Tomcat 7 - does not working - returns NPE

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I would like to inject (@Autowired or @Resource) beans created by Spring (3.x or 4.x) in a class that implements a JAX-WS (reference implementation) interface.

Tested and works on Tomcat 6 but in Tomcat 7, it seems that something on the container has changed and the contexts are different.

I have used the proposed integration (which even has bad documentation) as suggested in: http://www.mkyong.com/webservices/jax-ws/jax-ws-spring-integration-example/

In this example, the sun-jaxws.xml file is replaced by a Spring configuration file. However, in my example I'm doing everything with @Configuration because I was trying to avoid XMLs.
I do not know how to make this change to the JAX-WS Endpoint be able to use a bean injected by Spring, without me having to use the applicationContext.getBean ("myBean").

ps.: I have read about every kind of solution, believe me! Some suggest extending SpringBeanAutowiringSupport, others put a @PostConstructor method, but nothing works in Tomcat 7, when I send a SOAP request, my WebService class has no beans in it (NPE).

It is a definition of container? There's no way to do it? That is the main question, so I can give up forever. ;)


------------
Another possible solution: does anyone knows how to do this:

<wss:binding url="/hello">
<wss:service>
<ws:service bean="#helloWorldWS"/>
</wss:service>
</wss:binding>

in a java @Configuration class?
------------

Thank you
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic