Announcement Announcement Module
Collapse

Spring Dynamic Modules forum decommissioned in favor of Eclipse Gemini Blueprint

With the official first release of Eclipse Gemini Blueprint shipped, the migration of the Spring Dynamic Modules code base to the Eclipse Foundation, as part of the Gemini project, has been completed.

As such, this forum has been decommissioned in favour of the Eclipse Gemini forums.
See more
See less
ApplicationContextAware issue Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ApplicationContextAware issue

    Hi,
    I'm using spring ApplicationContextAware to set the Application context to my web services endpoint. There's no exception when I install and start the bundle. When I'm trying to call the service, I'getting a null pointer exception as the application context is showing up as "null". Here's the app context entry :
    Code:
    <jaxws:endpoint id="taxonomyquery"  implementor="com.test.taxonomy.soap.query.service.TaxonomySoapQueryServiceImpl"
      address="/taxonomyquery" />
    And here's my sample code:
    Code:
    @WebService(endpointInterface = "com.test.taxonomy.soap.query.service.ITaxonomySoapQueryService")
    public class TaxonomySoapQueryServiceImpl implements ITaxonomySoapQueryService, ApplicationContextAware {
    
     private static ApplicationContext ctx = null;
    
     private static Logger LOGGER = LoggerFactory.getLogger(TaxonomySoapQueryServiceImpl.class);
     
     @Override
     public void setApplicationContext(ApplicationContext ctx) throws BeansException {
      this.ctx = ctx;
     } 
    
     public ProductReleaseResponse queryProductRelease(ProductReleaseRequest req) {
      ProductReleaseResponse response = new ProductReleaseResponse ();
      try {
       req.status = RequestHelper.transformStatus(req.status);
       ITaxonomySoapPluginQuery tp = (ITaxonomySoapPluginQuery) ctx.getBean("taxonomyQueryPlugin");
       response = tp.queryProductRelease(req);
      }
      catch (Exception ex) {
       LOGGER.error(ex.getMessage());
       response.status = "ERROR";
      }
      return response;
     }
    The service is starting without any issues, which prompted me to believe that the Application Context should have been set correctly.

    I've also tried using BeanfactoryAware, but got the same exception.

    Any pointer will be appreciated.

    - Thanks

  • #2
    My bad, I declared it wrong in the spring config.

    Code:
    <jaxws:endpoint id="taxonomyquery"
      implementor="#taxonomyqueryImpl"
      address="/taxonomyquery" />
    
    <bean id="taxonomyqueryImpl" class="com.test.taxonomy.soap.query.service.TaxonomySoapQueryServiceImpl"/>
    This resolved the issue

    Comment

    Working...
    X