Return-Path: Delivered-To: apmail-felix-users-archive@minotaur.apache.org Received: (qmail 26703 invoked from network); 10 Jan 2011 16:14:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 10 Jan 2011 16:14:38 -0000 Received: (qmail 42831 invoked by uid 500); 10 Jan 2011 16:14:37 -0000 Delivered-To: apmail-felix-users-archive@felix.apache.org Received: (qmail 42674 invoked by uid 500); 10 Jan 2011 16:14:37 -0000 Mailing-List: contact users-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@felix.apache.org Delivered-To: mailing list users@felix.apache.org Received: (qmail 42657 invoked by uid 99); 10 Jan 2011 16:14:36 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Jan 2011 16:14:36 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,NORMAL_HTTP_TO_IP,RCVD_IN_DNSWL_LOW,SPF_NEUTRAL,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.213.177] (HELO mail-yx0-f177.google.com) (209.85.213.177) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Jan 2011 16:14:31 +0000 Received: by yxm34 with SMTP id 34so10072831yxm.22 for ; Mon, 10 Jan 2011 08:14:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=steelezone.net; s=google; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=7sA7WsmYviW51aHnScXMyBUvCRV5X8FZVPWZiN7zlYY=; b=0PngFuhnoqAMM9MVsW4sagqVKtBTqUTZgHkmBnx6N2g5/L53io5c7rRzlGrAF+honK lnsvukDPtD3eQPOW2U+Ntc85K8+16Tvz3ddIeBC399jM99oQy3VAgu8JlOpgPejy33AE xVPtPfRpqUPX9ddrpQbInC1zIT2saRWOqCIQw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=steelezone.net; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=Zwp9qQ5GnxK2CpoQlpIfd0fGYBjsebFbeExN4lbEBW+AIVs41walPDtma5a0jod87O PmkMoZkCFJvRz4FYqiEyFhCI54QLHK9pGLJ7qvMzMDxNt39eEiHmpCYNLvp8MQ5c9fOL FDGuu9DC1wmp3/gR+q022tYzlz2o1ZHc7Zdvo= MIME-Version: 1.0 Received: by 10.100.172.7 with SMTP id u7mr10059797ane.176.1294676050667; Mon, 10 Jan 2011 08:14:10 -0800 (PST) Received: by 10.100.111.15 with HTTP; Mon, 10 Jan 2011 08:14:10 -0800 (PST) In-Reply-To: <4D2B24D4.7080205@ungoverned.org> References: <4D2B24D4.7080205@ungoverned.org> Date: Mon, 10 Jan 2011 11:14:10 -0500 Message-ID: Subject: Re: MalformedURLException when using bundle: URL From: "Steele, Richard" To: users@felix.apache.org Content-Type: multipart/alternative; boundary=0016368e1c0e1969a90499804208 --0016368e1c0e1969a90499804208 Content-Type: text/plain; charset=ISO-8859-1 I did that this morning: created a simple bundle with an activator that uses Bundle.findEntries() to dump out everything it finds in META-INF. And it works as expected. I'm beginning to think what I've stumbled across is a more general problem trying to use JAX-WS inside an OSGi container. In particular, I suspect that Endpoint.publish() is making assumptions about class loaders and such. Some searching this morning seems to reinforce this viewpoint. (In fact, it looks like Glassfish 3 uses OSGi-enabled versions of Metro/JAX-WS/JAXB, but since these appear to import container-specific packages the don't do me much good.) If this is correct, then this is obviously not an issue specific to Felix. Still, if anyone has a specific solution to the problem I'd appreciate some hints. Thanks, Rich On Mon, Jan 10, 2011 at 10:25 AM, Richard S. Hall wrote: > If URL Handlers is enabled, then it should register a handler to deal with > the bundle: protocol. You can create a simple bundle that tries to create > such a URL to make sure it is working. > > -> richard > > > On 1/7/11 14:05, Steele, Richard wrote: > >> I'm working on a prototype implementation of a bundle that publishes >> JAX-WS >> endpoints for specially marked services. (I realize there are off the >> shelf >> implementations of various tools that ought to do the same thing, but >> right >> now I'm just getting my feet wet.) >> >> I've actually been able to get the endpoint published just fine, using >> something like this: >> >> private Object startEndpoint(ServiceReference reference) { >> >> Object service = getBundleContext().getService(reference); >> if (service != null) { >> ClassLoader originalClassLoader = >> Thread.currentThread().getContextClassLoader(); >> try { >> Object instance = createEndpointImpl(service); >> >> >> Thread.currentThread().setContextClassLoader(instance.getClass().getClassLoader()); >> endpoint = Endpoint.create(instance); >> endpoint.setMetadata(getMetadata(reference)); >> // TODO: remove hard-coded port number >> endpoint.publish("http://0.0.0.0:7001/hello/"); >> } finally { >> >> Thread.currentThread().setContextClassLoader(originalClassLoader); >> } >> } >> >> return service; >> } >> >> The problem I'm running to, however, is with setting the endpoint >> metadata; >> this is a list of the WSDLs and schema types used to generate the >> endpoint. >> (Without specifying this JAX-WS attempt to create one at runtime; it >> manages >> to get close, but close isn't enough.) >> >> What I've been trying to do is get these files from the API bundle using >> Bundle.findEntries(), something like this: >> >> Enumeration entryEnumeration = >> serviceBundle.findEntries("/META-INF/wsdls", null, true); >> // enumeration can be null if path isn't found >> if (entryEnumeration != null) { >> while (entryEnumeration.hasMoreElements()) { >> URL entry = (URL)entryEnumeration.nextElement(); >> try { >> md.add(new >> StreamSource(entry.openConnection().getInputStream())); >> } catch (IOException e) { >> // TODO: do something >> } >> } >> } >> >> This actually works exactly what I want: I get a list of StreamSources to >> the URLs' input streams. However, when the endpoint is published I'm >> getting a MalformedURLException because the URL is using a bundle: >> protocol, >> which isn't known. >> >> Based on my searching I expect that Felix will start by default with the >> URL >> Handlers Service started, no? So why can't these URLs be resolved? I'm >> guessing I'm missing something silly... >> >> Thanks, >> Rich >> >> > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org > For additional commands, e-mail: users-help@felix.apache.org > > --0016368e1c0e1969a90499804208--