Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Dilip Ganesh
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
 
H Paul
Ranch Hand
Posts: 471
4
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic