Return-Path: Delivered-To: apmail-geronimo-user-archive@www.apache.org Received: (qmail 8639 invoked from network); 16 Jul 2010 06:29:59 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 16 Jul 2010 06:29:59 -0000 Received: (qmail 53316 invoked by uid 500); 16 Jul 2010 06:29:59 -0000 Delivered-To: apmail-geronimo-user-archive@geronimo.apache.org Received: (qmail 52999 invoked by uid 500); 16 Jul 2010 06:29:56 -0000 Mailing-List: contact user-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: user@geronimo.apache.org List-Id: Delivered-To: mailing list user@geronimo.apache.org Received: (qmail 52991 invoked by uid 99); 16 Jul 2010 06:29:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Jul 2010 06:29:55 +0000 X-ASF-Spam-Status: No, hits=3.5 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [98.136.44.61] (HELO smtp106.prem.mail.sp1.yahoo.com) (98.136.44.61) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 16 Jul 2010 06:29:47 +0000 Received: (qmail 32681 invoked from network); 16 Jul 2010 06:28:26 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=DKIM-Signature:Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:From:Mime-Version:Content-Type:Subject:Date:In-Reply-To:To:References:Message-Id:X-Mailer; b=VljH86BsolZKZIuHajqQ15LWMHkKJz/X4T8EOGPeERLtERl+hNUWwQJV29asUDw3Hf9Qz/y18cE454lsxZpuH6Pq2CMmpHFI5wB+McGVp8FVE2z3UJXcsiBEiITxTeWmQ5ctbKuVw/MQxMVaN3sjhaVykMClRWlJSsrGAI6G+QY= ; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1279261706; bh=c72GKuGv2LTmT1B1QYSXrD8CAZDZj9Ou4koiXiGitfE=; h=Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:From:Mime-Version:Content-Type:Subject:Date:In-Reply-To:To:References:Message-Id:X-Mailer; b=mNSnzeuIWPYok6uN+CoDmIZnUn0SNZxcCm0PnmLL+eaPhV6UMgi/bOy7yHS6+x9SIGCob7xZJ8qxjA2FDtHSussr9iOi+/w+JB8yUJMqMNIEFfFe/gFl/tDhql4zZ2f84Gkr9QOzcqtE8kE4ohPWhn8crPBeWwCa6oJl6IaDJY4= Received: from [10.0.1.3] (david_jencks@76.76.148.215 with plain) by smtp106.prem.mail.sp1.yahoo.com with SMTP; 15 Jul 2010 23:28:25 -0700 PDT X-Yahoo-SMTP: .9oIUzyswBANsYgUm_5uPui0skTnzGJXJQ-- X-YMail-OSG: agX25BoVM1lfaJVkKjv8613cZ0iRuPN03iyf8twDdNVnxyg JFetOHkP8.OjUA0KSYvGgh.x8jGpnVCvL9YxiHov4gg763jTDlMRpp00Uq43 3sCWzBNcD7L6JIlFAQURApVyacH5eej0f1N6ePuk4yWh6AZheziHu0MMet9X vTUeGMV2YII.5xZqDGXAQf9vT8Rh5shvv8f3W0LUuQ.w9Ehfooq2q5CEQovY 9j31JFKT4VeOjQrYAhFTMeJk3TmnklhQSADhv_KEaXWBvW6xlgUM0h5ZpiFz O5P0yU9NYtvd_e7FfFSIecVk4BSyNhnlVJtLtX8TbKnQtORkmCz96HXbzvk3 IQufxHg-- X-Yahoo-Newman-Property: ymail-3 From: David Jencks Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: multipart/alternative; boundary=Apple-Mail-15-306793653 Subject: Re: Geronimo 2.2 + Spring + Hibernate and a Geronimo managed DB Pool with XA driver Date: Thu, 15 Jul 2010 23:28:24 -0700 In-Reply-To: To: user@geronimo.apache.org References: <1275860383509-874759.post@n3.nabble.com> <53B4A591-E7E8-4D2B-B1FB-C17524FD7E0C@gmail.com> <1279244632622-971182.post@n3.nabble.com> Message-Id: <0E2E8FA1-9E08-46AC-B688-E265BA3DFAD4@yahoo.com> X-Mailer: Apple Mail (2.1081) X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail-15-306793653 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Jul 15, 2010, at 9:17 PM, Ivan wrote: > I think that you might need to define the resource reference in your = ejb deployment plan, or server will not map the resource to the bean = scope naming context. Or you could directly lookup it by the global = naming if the portable application is not your concern. There are several pieces in this picture that you don't indicate how = they relate. If you have code like: new InitialContext().lookup("java:comp/env/foo") in a javaee component such as ejb, servlet, or app client, then you have = to indicate that geronimo should put something in the jndi context for = that component: the ejb-jar.xml, web.xml, application-client.xml, or use = a class-level @Resource annotation. You can also use an @Resource = annotation on a field and geronimo will do the lookup for you. If you are looking up a datasource, then in the geronimo plan for your = app you need to include a dependency on the deployed datasource module = (in your example console.dbpool jdbc_testmydb 1.0 car If the "jdbc/testmydb" part of the lookup matches the name element in = the connector plan, then you don't need any other info. If it doesn't, = you also need a resource--ref in the geronimo plan to match up what you = are looking up with what is defined. I'd advise naming the datasource = jdbc/testmydb so you don't need this mapping. The jndi lookup will also work in any object reached in the same thread = from a javaee component. If you are trying to do this kind of lookup in = a spring bean, and it is only called from a javaee comonent, and in the = same thread, the lookup should work. You can also directly look up the datasource in global jndi without any = configuration using new = InitialContext().lookup("jca:/default/wakapeek-persist-ear/JCAManagedConne= ctionFactory/testmydb") hope this helps david jencks >=20 > 2010/7/16 Billy Vandory >=20 > I'm still having a problem with this. I've determined it's not = spring, it's > most likely just a configuration issue. The problem is trying to get = a > lookup to a global database pool in geronimo. In an SL-EJB I have: >=20 > InitialContext ctx =3D new InitialContext(); > DataSource ds =3D (DataSource) = ctx.lookup("java:comp/env/jdbc/testmydb"); > Connection con =3D ds.getConnection(); >=20 > and my deployment plan for the db looks like (copied from geronimo's = show > plan button): >=20 > > xmlns:dep=3D"http://geronimo.apache.org/xml/ns/deployment-1.2"> > > console.dbpool > jdbc_testmydb > 1.0 > car > > > > postgresql > postgresql-8.2 > 508.jdbc3 > jar > > > > > > >=20 > = javax.sql.DataSource > > testmydb > name=3D"DatabaseName">walmart0192 > name=3D"Password"> > name=3D"UserName">itmgr > name=3D"ServerName">192.168.0.10 > > > > > 10 > 0 > > > > > > > > >=20 > but i always get the exception: >=20 > 80041: 2010-07-15 21:30:06,442 ERROR [CategoryEJB] > javax.naming.NotContextException: jdbc/testmydb >=20 > Note that I am not running a web app, just an EJB backend, so I am not > configuring anything in web.xml. is the configuration in web.xml = required? > I tried it and its the same result, but I would like to rule this out, = that > web.xml resource-ref config is not required if not running in a web = app. >=20 > The JNDI name under geronimo's JNDI viewer is: (resource adapters) > console.dbpool/testmydb/1.0/car >=20 > also shows: > jca:/default/wakapeek-persist-ear/JCAManagedConnectionFactory/testmydb >=20 > In the geronimo deployment plan i have a connector defined: >=20 > > = tranql-connector-postgresql-local-1.2.rar > testmydb.xml > >=20 > Using dbpool in the geronimo console, i can query this database just = fine.' >=20 > Any ideas? Thanks alot. > Billy >=20 >=20 >=20 > -- > View this message in context: = http://apache-geronimo.328035.n3.nabble.com/Geronimo-2-2-Spring-Hibernate-= and-a-Geronimo-managed-DB-Pool-with-XA-driver-tp874759p971182.html > Sent from the Users mailing list archive at Nabble.com. >=20 >=20 >=20 > --=20 > Ivan --Apple-Mail-15-306793653 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii
I think = that you might need to define the resource reference in your ejb = deployment plan, or server will not map the resource to the bean scope = naming context. Or you could directly lookup it by the global naming if = the portable application is not your = concern.

There are several pieces in this = picture that you don't indicate how they relate.  If you have code = like:

new = InitialContext().lookup("java:comp/env/foo")

in = a javaee component such as ejb, servlet, or app client, then you have to = indicate that geronimo should put something in the jndi context for that = component: the ejb-jar.xml, web.xml, application-client.xml, or use a = class-level @Resource annotation.  You can also use an @Resource = annotation on a field and geronimo will do the lookup for = you.

If you are looking up a datasource, then = in the geronimo plan for your app you need to include a dependency on = the deployed datasource module (in your = example

           = <dep:dependency>
           = <dep:groupId>console.dbpool</dep:groupId>
   = ;        <dep:artifactId>jdb= c_testmydb</dep:artifactId>
      &= nbsp;    <dep:version>1.0</dep:version>           <dep= :type>car</dep:type>
         =   </dep:dependency>

If the = "jdbc/testmydb" part of the lookup matches the name element in the = connector plan, then you don't need any other info.  If it doesn't, = you also need a resource--ref in the geronimo plan to match up what you = are looking up with what is defined.  I'd advise naming the = datasource jdbc/testmydb so you don't need this = mapping.

The jndi lookup will also work in any = object reached in the same thread from a javaee component.  If you = are trying to do this kind of lookup in a spring bean, and it is only = called from a javaee comonent, and in the same thread, the lookup should = work.

You can also directly look up the = datasource in global jndi without any configuration using
new = InitialContext().lookup("jca:/default/wakapeek-persist-ear/JCAManagedConne= ctionFactory/testmydb")

hope this = helps
david jencks



2010/7/16 Billy Vandory <billy_vandory@yahoo.com>
Connection con =3D ds.getConnection();

and my deployment plan for the db looks like (copied from geronimo's = show
plan button):

<connector xmlns=3D"http://geronimo.apache.org/xml/ns/j2ee/connector-1.2= ">
   <dep:environment
xmlns:dep=3D"http://geronimo.apache.org/xml/ns/deployment-1.2">= ;
       <dep:moduleId>
          =  <dep:groupId>console.dbpool</dep:groupId>
          =  <dep:artifactId>jdbc_testmydb</dep:artifactId>
          =  <dep:version>1.0</dep:version>
          =  <dep:type>car</dep:type>
       </dep:moduleId>
       <dep:dependencies>
           <dep:dependency>
              =  <dep:groupId>postgresql</dep:groupId>
              =  <dep:artifactId>postgresql-8.2</dep:artifactId>
              =  <dep:version>508.jdbc3</dep:version>
              =  <dep:type>jar</dep:type>
           </dep:dependency>
       </dep:dependencies>
   </dep:environment>
   <resourceadapter>
       <outbound-resourceadapter>
          =  <connection-definition>

= <connectionfactory-interface>javax.sql.DataSource</connectionfact= ory-interface>
              =  <connectiondefinition-instance>
                  =  <name>testmydb</name>
                  =  <config-property-setting
name=3D"DatabaseName">walmart0192</config-property-setting>
                  =  <config-property-setting
name=3D"Password"></config-property-setting>
                  =  <config-property-setting
name=3D"UserName">itmgr</config-property-setting>
                  =  <config-property-setting
name=3D"ServerName">192.168.0.10</config-property-setting>
              =      <config-property-setting = name=3D"PrepareThreshold"/>
                  =  <connectionmanager>
                  =      <local-transaction/>
              =          <single-pool>
                    =        <max-size>10</max-size>
                    =        <min-size>0</min-size>
                    =        <match-one/>
                    =    </single-pool>
                  =  </connectionmanager>
              =  </connectiondefinition-instance>
          =  </connection-definition>
       </outbound-resourceadapter>
   </resourceadapter>
</connector>

but i always get the exception:

80041:  2010-07-15 21:30:06,442 ERROR [CategoryEJB]
javax.naming.NotContextException: jdbc/testmydb

Note that I am not running a web app, just an EJB backend, so I am = not
configuring anything in web.xml.  is the configuration in web.xml = required?
I tried it and its the same result, but I would like to rule this out, = that
web.xml resource-ref config is not required if not running in a web = app.

The JNDI name under geronimo's JNDI viewer is: (resource adapters)
console.dbpool/testmydb/1.0/car

also shows:
= jca:/default/wakapeek-persist-ear/JCAManagedConnectionFactory/testmydb
=
In the geronimo deployment plan i have a connector defined:

<app:module>
=  <app:connector>tranql-connector-postgresql-local-1.2.rar</a= pp:connector>
 <app:alt-dd>testmydb.xml</app:alt-dd>
</app:module>

Using dbpool in the geronimo console, i can query this database just = fine.'

Any ideas?  Thanks alot.
Billy



--
View this message in context: http://apache-geronimo.328035.n3.nabble.com/Geronimo-2-2= -Spring-Hibernate-and-a-Geronimo-managed-DB-Pool-with-XA-driver-tp874759p9= 71182.html
Sent from the Users mailing = list archive at Nabble.com.



--
Ivan

= --Apple-Mail-15-306793653--