I have created a Servlet class which extends Apache Wink 1.4 RestServlet. I am implementing a collection of REST services, and would prefer to use one of the available JAX-RS frameworks (Jersey, Wink, Restlet, …). Apache Wink is the simplest to extend and initialize without declarative configuration (no web.xml). I have built a Module with the Gateway context, and can compile, build and install the .modl file. However, when I attempt to invoke the newly registered servlet, I get the following message:
This message is indicative of a classloading issue. Is it possible to change my dependency on Apache Wink to be provided (rather than compiled), and then include the Apache Wink jars on a global classloader in the Ignition Gateway?
You could drop the wink jar(s) into the lib/core/gateway folder of the installation… I’m not sure that’s an ideal approach to take though.
I’d look into the class loading issue a little more - I’d only expect to see the error you see if either:
a) Wink is already on the classpath.
b) You’ve reloaded/restarted your module, and upon shutdown wink was not totally shutdown/removed, and now there’s a leaked reference somewhere causing the error you’re seeing.
I have hit similar problems in the past when I registered a module listener class with an Ignition platform service (such as the redundancy manager), and then forget to unregister the listener later during module shutdown. It throws this type of error when you restart the module in the Gateway.