Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Service layer injection is not working after i exposed service layer as webservice

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi to all,

I have one service class to do the DB operations through the DAO classes , i inject the DAO object using spring. It is working fine.
After that i exposed the same service method as a webservice method using JAX-WS annotation. After that it is not working it saying my dao object not get injected , so i am getting nullpointerexception. the way i am doing is correct or not?

My Service class is




My Spring xml is




Please help me Thanks in advance
 
Ranch Hand
Posts: 491
5
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Your web service class is NOT managed/under control of Spring IoC container. So there is no DI. That's why NPE.

2. If you want your web service class to be mananged by Spring.
If you use Metro JAX-WS RI, then Metro JAX-WS RI ext has integration with Spring.
Spring will manage your web service class. So DI will be possible/OK.

See this sample
http://www.mkyong.com/webservices/jax-ws/jax-ws-spring-integration-example/

http://jax-ws-commons.java.net/spring/
 
Dilip Ganesh
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much for your guidance.
 
The human mind is a dangerous plaything. This tiny ad is pretty safe:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic