Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Support javax.xml.ws.Endpoint with Equinox + Jetty7
Support javax.xml.ws.Endpoint with Equinox + Jetty7 [message #551002] Wed, 04 August 2010 19:43
Mike Norman is currently offline Mike Norman
Messages: 35
Registered: July 2009
Member
I am trying to configure a series of bundles to support javax.xml.ws.Endpoint in Equinox.

Using the 'containerless' JavaSE 6 support for Endpoints, I can get a BundleActivator to start up and
build a javax.xml.ws.Endpoint and a javax.xml.ws.Service

However, the built-in com.sun.net.httpserver.HttpServer is not very production-ready so I
wish to replace it with Jetty. There is an SPI System property:
System.setProperty("com.sun.net.httpserver.HttpServerProvider",
    "org.eclipse.jetty.jaxws2spi.JettyHttpServerProvider");

However, no matter how I configure my bundles, I always get a ClassNotFoundException.

My 'main' bundle is setup as follows:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: HelloWorld
Bundle-SymbolicName: hello.world
Bundle-Version: 1.0.0
Bundle-Activator: test.Activator
Import-Package: org.osgi.framework;version="1.3.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: javax.servlet,
 org.apache.derby,
 org.eclipse.persistence.antlr,
 org.eclipse.persistence.asm,
 org.eclipse.persistence.core


package test;

//java eXtension imports
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPMessage;
import javax.xml.ws.Endpoint;
import javax.xml.ws.Provider;
import javax.xml.ws.Service;
import javax.xml.ws.WebServiceProvider;
import javax.xml.ws.ServiceMode;
import static javax.xml.ws.Service.Mode.MESSAGE;
import static javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING;

//EclipseLink imports
import org.eclipse.persistence.internal.dbws.ProviderHelper;
import org.eclipse.persistence.sessions.Session;

//OSGi imports
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

//test imports
import static test.Constants.ENDPOINT_ADDRESS;
import static test.Constants.TEST_PORT;
import static test.Constants.TEST_SERVICE_NAMESPACE;
import static test.Constants.TEST_SERVICE;

@WebServiceProvider(
    targetNamespace = TEST_SERVICE_NAMESPACE,
    serviceName = TEST_SERVICE,
    portName = TEST_PORT
)
@ServiceMode(MESSAGE)
public class Activator extends ProviderHelper implements BundleActivator, Provider<SOAPMessage> {

	private static BundleContext context;
	private static Endpoint endpoint = null;
	private static QName portQName = null;
	private static Service testService = null;

	static BundleContext getContext() {
		return context;
	}

	public void start(BundleContext bundleContext) throws Exception {
		Activator.context = bundleContext;
		System.setProperty("com.sun.net.httpserver.HttpServerProvider",
			"org.eclipse.jetty.jaxws2spi.JettyHttpServerProvider");

		super.init(getClass().getClassLoader(), null, false);
		endpoint = Endpoint.create(this);
		endpoint.publish(ENDPOINT_ADDRESS);
		QName serviceQName = new QName(TEST_SERVICE_NAMESPACE, TEST_SERVICE);
		portQName = new QName(TEST_SERVICE_NAMESPACE, TEST_PORT);
		testService = Service.create(serviceQName);
		testService.addPort(portQName, SOAP11HTTP_BINDING, ENDPOINT_ADDRESS);
		System.out.println("Hello, world");
	}
...

The JettyHttpServerProvider 'bridge' class is in a framework Extension Bundle:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: jaxws2spi
Bundle-SymbolicName: jaxws2spi
Bundle-Version: 1.0.0
Private-Package: .
Export-Package: org.eclipse.jetty.jaxws2spi,
   com.sun.net.httpserver,
   com.sun.net.httpserver.spi
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Fragment-Host: system.bundle;extension:=framework



The confusing this is that when I take out the SPI 'switch', everything works fine - it is just that somehow when we want to load JettyHttpServerProvider that things fail.


Any help would be greatly appreciated,

Mike Norman
Previous Topic:disable adding dependencies in final p2 feature build artefact?
Next Topic:Jetty Configuration
Goto Forum:
  


Current Time: Thu Oct 23 15:15:57 GMT 2014

Powered by FUDForum. Page generated in 0.01873 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software