views:

26

answers:

1

We have created a web service using JAX-WS and ProSyst OSGi. Accessing the service with the following code works fine in a standalone Java application as well as in the ProSyst framework.

this.service = new MyServicePortService(
            new URL("http://" + host + ":" + port + "/MyService?wsdl"),
            new QName("http://myservice.example.com/", "MyServicePortService"));
this.client = this.service.getMyServicePort();

AS JAX-WS needs some packages from javax.* and others I have to make them exported by the framework bundle. This is done by telling the ProSyst framework to export them via its configuration but could also be done by writing an extension bundle with the following export statement: (what we have done for equinox.)

Export-Package
  com.sun.net.ssl.internal.ssl          
  com.sun.xml                           
  com.sun.xml.internal.bind.api         
  javax.crypto                          
  javax.crypto.spec                     
  javax.jw                              
  javax.naming                          
  javax.naming.directory                
  javax.naming.event                    
  javax.naming.ldap                     
  javax.naming.spi                      
  javax.net                             
  javax.net.ssl                         
  javax.security.cert                   
  javax.transaction.xa                  
  javax.xml.bind.util                   
  javax.xml.stream                      
  javax.xml.transform.stax              
  javax.xml.ws                          
  org.apache.log4j                      
  sun.security.action

My understanding is, that this should also work in Equinox, as they use the same JVM. So if those bundles are accessible, JAX-WS should work in both.

However, calling this.service.getMyServicePort() will result in the following exception:

java.lang.IllegalArgumentException: interface com.sun.xml.internal.ws.developer.WSBindingProvider is not visible from class loader
    at java.lang.reflect.Proxy.getProxyClass(Proxy.java:353)
    at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.createEndpointIFBaseProxy(WSServiceDelegate.java:546)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:292)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:274)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:267)
    at javax.xml.ws.Service.getPort(Service.java:92)
    at com.example.myservice.MyServicePortService.MyServicePort(MyServicePortService.java:56)
    at com.example.myservice.MyServicePort.<init>(MyServicePort.java:36)
    at com.example.myservice.ClientActivator.activate(ClientActivator.java:78)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:230)
    at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:140)
    at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:330)
    at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:560)
    at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:182)
    at org.eclipse.equinox.internal.ds.Resolver.buildNewlySatisfied(Resolver.java:393)
    at org.eclipse.equinox.internal.ds.Resolver.enableComponents(Resolver.java:176)
    at org.eclipse.equinox.internal.ds.SCRManager.performWork(SCRManager.java:791)
    at org.eclipse.equinox.internal.ds.SCRManager$QueuedJob.dispatch(SCRManager.java:758)
    at org.eclipse.equinox.internal.ds.WorkThread.run(WorkThread.java:90)
    at org.eclipse.equinox.internal.util.impl.tpt.threadpool.Executor.run(Executor.java:70)

Anybody an idea how to solve this? Or is there an other/better possibility to access the service from equinox? (DOSGI is not used, as the service should also be accessible by other native applications).

Thanks is advance

A: 

Hello,

It seems that package "com.sun.xml.internal.ws.developer" is not visible.

Try 2 ways:

  • add this package (and maybe not only this one) to the list of exported packages in system bundle (system property: "org.osgi.framework.system.packages"). Import this package(s) explicitly or with Dynamic-ImportPackage header
  • use system property "org.osgi.framework.bootdelegation" to delegate this package to system classloader.

Hope it helps you.

Regards, Dmytro

Dmytro Pishchukhin