File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Service layer injection is not working after i exposed service layer as webservice Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Service layer injection is not working after i exposed service layer as webservice" Watch "Service layer injection is not working after i exposed service layer as webservice" New topic
Author

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

Dilip Ganesh
Greenhorn

Joined: Sep 30, 2011
Posts: 24
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

Joined: Jul 26, 2011
Posts: 381
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

Joined: Sep 30, 2011
Posts: 24
Thank you so much for your guidance.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Service layer injection is not working after i exposed service layer as webservice
 
Similar Threads
login form with database and spring security
I am getting org.springframework.orm.hibernate3.HibernateSystemException: Unknown entity:
HibernateDaoSupport and Transaction
Dependency injection problem
parent key not found, Save two connected objects