Return-Path: Delivered-To: apmail-aries-dev-archive@www.apache.org Received: (qmail 50720 invoked from network); 8 Mar 2011 18:32:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Mar 2011 18:32:05 -0000 Received: (qmail 36869 invoked by uid 500); 8 Mar 2011 16:45:25 -0000 Delivered-To: apmail-aries-dev-archive@aries.apache.org Received: (qmail 36791 invoked by uid 500); 8 Mar 2011 16:45:25 -0000 Mailing-List: contact dev-help@aries.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@aries.apache.org Delivered-To: mailing list dev@aries.apache.org Received: (qmail 36775 invoked by uid 99); 8 Mar 2011 16:45:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Mar 2011 16:45:25 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Mar 2011 16:45:22 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 76E5039DF3F for ; Tue, 8 Mar 2011 16:44:59 +0000 (UTC) Date: Tue, 8 Mar 2011 16:44:59 +0000 (UTC) From: "Holly Cummins (JIRA)" To: dev@aries.apache.org Message-ID: <173533365.5201.1299602699483.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <572960412.4122.1299583379416.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] Updated: (ARIES-601) Add service ranking to re-registered XA data source MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/ARIES-601?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Holly Cummins updated ARIES-601: -------------------------------- Description: In the blog sample we use the service property osgi.jndi.service.name to uniquely identify the datasource services. However, in the persistence.xml, we only use the jndi service name as a filter property, like: osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/blogdb) instead of writing: osgi:service/jdbc/blogdb It seems a shame to bother to specify the jndi.service.name property but then not take advantage of the shorter JNDI name, but there's a good reason we don't - it doesn't work. The datasource blueprint.xml declares two services, for DataSource and XADataSource, and then Aries helpfully auto-creates a third service, which makes an enriched wrapper of the EmbeddedXADataSource bean for lookups of the DataSource interface. Unfortunately, once this has been done we have two services with the same JNDI service name. Anything which uses the JNDI name osgi:service/jdbc/blogdb, expecting a DataSource, gets a classcast exception, because an XADataSource is returned. A neat solution is to add a service ranking (which adds, say, 1000 to the original service ranking) to the re-registered DataSource so that it is returned in preference to the XADataSource when a short-form JNDI lookup is done. was: In the blog sample we use the service property osgi.jndi.service.name to uniquely identify the datasource services. However, in the persistence.xml, we only use the jndi service name as a filter property, like: osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/blogdb) instead of writing: osgi:service/jdbc/blogdb It seems a shame to bother to specify the jndi.service.name property but then not take advantage of the shorter JNDI name, but there's a good reason we don't - it doesn't work. The datasource blueprint.xml declares two services, for DataSource and XADataSource, and then Aries helpfully auto-creates a third service, which makes an enriched wrapper of the EmbeddedXADataSource bean for lookups of the DataSource interface. Unfortunately, once this has been done we have two services with the same JNDI service name. Anything which uses the JNDI name osgi:service/jdbc/blogdb, expecting a DataSource, gets a classcast exception, because an XADataSource is returned. A neat solution is to add a service ranking (which adds, say, 1000 to the original service ranking) to the re-registered DataSource so that it is returned in preference to the XADataSource when a short-form JNDI lookup is done. > Add service ranking to re-registered XA data source > --------------------------------------------------- > > Key: ARIES-601 > URL: https://issues.apache.org/jira/browse/ARIES-601 > Project: Aries > Issue Type: Improvement > Reporter: Holly Cummins > Priority: Minor > > In the blog sample we use the service property osgi.jndi.service.name to uniquely identify the datasource services. However, in the persistence.xml, we only use the jndi service name as a filter property, like: > > osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/blogdb) > instead of writing: > osgi:service/jdbc/blogdb > It seems a shame to bother to specify the jndi.service.name property but then not take advantage of the shorter JNDI name, but there's a good > reason we don't - it doesn't work. > The datasource blueprint.xml declares two services, for DataSource and XADataSource, and then Aries helpfully auto-creates a third service, which makes an enriched wrapper of the EmbeddedXADataSource bean for lookups of the DataSource interface. > Unfortunately, once this has been done we have two services with the same JNDI service name. Anything which uses the JNDI name > osgi:service/jdbc/blogdb, expecting a DataSource, gets a classcast exception, because an XADataSource is returned. > A neat solution is to add a service ranking (which adds, say, 1000 to the original service ranking) to the re-registered DataSource so that it is returned in preference to the XADataSource when a short-form JNDI lookup is done. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira