Hi friends,
I am using jersey with Spring for Web Services and i have a simple POST method where a user can send username and password to validate himself. The method for that is
It always throw NullPointerException at the line where ij.getData() method gets called,(It works fine in other Controllers). But when i remove it and do other processing that doesnt involve Hibernate it'll work. Say, i check these two variables like these
I've heard that jersey isn't compatible with Hibernate. Is that so? If so then what can i do to get it work around? Please help me guys.
Never try to be a hard-worker. Be a smart-worker.
My Blog
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35223
7
posted
0
I've heard that jersey isn't compatible with Hibernate.
That sounds dubious. When (and how) is the "ij" object initialized to something other than null?
Ulf Dittmer wrote:Moving to a forum appropriate for Spring questions.
I didn't think i would have anything to do with Spring as other parts of my code , excluding this is working fine. But when i add Hibernate code in Jersey Resource class, it shows this error. The complete stacktrace is
Even when i change from Jersey to RESTEasy, it won't work. Still showing NullPointerException error. Please someone help me get out from this issue...
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35223
7
posted
0
How have you made sure that Spring is otherwise working fine? I imagine that there is some kind of initialization that needs to happen - does that run, and run successfully? Can you test that other Spring beans -that have nothing to do with Jersey- are being injected OK?
Ulf Dittmer wrote:How have you made sure that Spring is otherwise working fine? I imagine that there is some kind of initialization that needs to happen - does that run, and run successfully? Can you test that other Spring beans -that have nothing to do with Jersey- are being injected OK?
Yes, rest of them are working fine and when i try to add jersey with Hibernate, it gives me such an error.
sachin burange
Ranch Hand
Joined: Jun 24, 2008
Posts: 41
posted
0
Try adding getters and setters ij object.
and add AutoWire keyword in top of setter method.
@Autowired
public void setWebServiceImpl (Database dbase){
this.dbase = dbase;
}
Is that how Spring works - the name of a parameter is associated to the ID of a bean? Because otherwise I don't see how this could work. Or is it looking through all beans that implement the "Database" interface?