I've finished working on some lengthy method launched from the client side using GWT-RPC. doSomething()
Suppose the following classes: (copied from GWT: invoke the same RPC-methods on the server-side as on the client-side)
//MyClassService.java - client package
@RemoteServiceRelativePath("myService")
public interface MyClassService extends RemoteService{
public doSomething();
}
//MyClassServiceAsync.java - client package
public interface MyClassServiceAsync{
public void doSomething(AsyncCallback<Void> callback);
}
//MyClassServiceImpl.java - server package
public class MyClassServiceImpl extends RemoteServiceServlet implements MyClassService{
@Override
public void doSomething()
{
//interacts with DB and another stuff
}
}
Now I'd wish to launch the very same method from my ScheduledTask infrastructure but I don't know if this is posible. The ScheduledTask infrastructure is in the server side. I've barely worked the networking side of any language and I'm lost. So far I've tried:
MyClassServiceImpl a = new MyClassServiceImpl();
a.doSomething();
The problem appear (NullPointerException) as soon as it hits the first doSomething() line with some call to getServletConfig().getServletContext() as it returns null.
Plus, MyClassServiceImpl init() method which I've overrided so it reads some params from web.xml, is also not invoked.
Thx in advance!