public class ServerActivator implements BundleActivator {
private ServiceRegistration reg;
public void start(BundleContext bc) throws Exception {
Test2Service svc = new Test2ServiceImpl();
// Dynamically assign a free port
int freePort = new ServerSocket(0).getLocalPort();
String url = "http://localhost:" + freePort + "/test2";
System.out.println("*** Server using URL: " + url);