[sip-comm-dev] FYI How to solve a problem with URLStreamHandler (OSGi + WebServices + embedded app)


#1

Hey Javier,

Javier Mendiara Cañardo wrote:

(this is a FYI with a question at the end)

Thanks for sharing!

Hi all

recently, I faced this exception when I was using JAX-WS for consuming
a WS when I have sipcomm hosted inside a 3rd party app

HTTP transport error: java.lang.UnsupportedOperationException: Method
not implemented.
com.sun.xml.ws.client.ClientTransportException: HTTP transport error:
java.lang.UnsupportedOperationException: Method not implemented.
        at
com.sun.xml.ws.transport.http.client.HttpClientTransport.getOutput(HttpClientTransport.java:131)

environment: windows, Sun JVM, java 1.6
This WS is consumed correctly when Felix has not been started. But when
felix is up, something causes
java.lang.UnsupportedOperationException: Method not implemented.
        at
java.net.URLStreamHandler.openConnection(URLStreamHandler.java:80)

That is
protected URLConnection openConnection(URL u, Proxy p) throws IOException {
    throw new UnsupportedOperationException("Method not implemented.");
    }
in java.net.URLStreamHandler!!!

Explanation: Felix declares and tries to register its own
URLStreamHandlerFactory for managing URL class dynamic loading inside
the OSGi framework for diferent protocols. This URLStreamHandlerFactory
replaces the Sun's default one, and the HTTP URL implementation needed
by the WS is not being loaded. Therefore, the Sun Implementation of the
HTTP URLStreamHandler that implements openConnection with proxy is not
being loaded.
I tried to import in the felix properties
(org.osgi.framework.system.packages section) the sun.net.www.protocol
package, that has the implementations of the protocol, but I didn't
success.(Maybe a URLHandlers cache problem)
So the solution (dirty, I know) was to force Felix not using the
URLStreamHandlerFactory that provides by setting this property
felix.service.urlhandlers=false
in the felix properties file. This leads to OSGi to be unaware of new
URL implementations registered by OSGi services.

Now my question: Does SipComm (or needed OSGi services) register its own
URLHandlers? i.e, are the developers able to perform
URL sipURL = new URL ("sip:somebody@somewhere.tld");

We do use such handlers but we register them via our own mechanism in a
way that would only impact SIP Communicator so I don't think they would
meddle with your development.

Hope this helps!

Thanks for reading until here!

Cheers
Emil

···

some literature
http://java.sun.com/developer/onlineTraining/protocolhandlers/
http://mail-archives.apache.org/mod_mbox/felix-users/200809.mbox/<48C53E3F.1050104@Sun.COM>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net