Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C5DCF200B49 for ; Wed, 3 Aug 2016 19:26:57 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C1D55160A86; Wed, 3 Aug 2016 17:26:57 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id BB408160A5D for ; Wed, 3 Aug 2016 19:26:56 +0200 (CEST) Received: (qmail 62338 invoked by uid 500); 3 Aug 2016 17:26:55 -0000 Mailing-List: contact users-help@tomee.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@tomee.apache.org Delivered-To: mailing list users@tomee.apache.org Received: (qmail 62326 invoked by uid 99); 3 Aug 2016 17:26:55 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Aug 2016 17:26:55 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 38D3CC283C for ; Wed, 3 Aug 2016 17:26:55 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.179 X-Spam-Level: * X-Spam-Status: No, score=1.179 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id T7et5_la2zzJ for ; Wed, 3 Aug 2016 17:26:52 +0000 (UTC) Received: from mail-lf0-f42.google.com (mail-lf0-f42.google.com [209.85.215.42]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with ESMTPS id 264E05F23C for ; Wed, 3 Aug 2016 17:26:52 +0000 (UTC) Received: by mail-lf0-f42.google.com with SMTP id f93so166311778lfi.2 for ; Wed, 03 Aug 2016 10:26:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=MRG1HOnZ1E3j1uzYLgK3UkyM0hkHu/iCUulKJ5eaUhA=; b=mSVDfTNk/Xx8ZzTACfjt0UmUA/G6vFdHf0eunbDx9K0qF2La68LMAzefnEjYhm8jhB Ln+6MV2Z2vjs2HjNsRkBSlIlH6wyLbpPrpoyjGyK6Nhb6UvmNCiH8n93jYu7lfAHOogB EngMLTf1nm5firKQE6mCYd0bn32rY1+c3zCfa5LqVvKd4mJ5hS5O7hRPSU9GdNZPA/Ct huFMMpXfCYK65i05S3XPGAvZ40DFkLHQ8EirkyKO7otRhbRP0O6OhrKtZwmSLV13hzY6 nbv+ze8MDBegNYEvyzRqfFINuASex/jFPJfdMwsEX17dATZi73+Zut+QJGHWOVX89Bsb /P9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=MRG1HOnZ1E3j1uzYLgK3UkyM0hkHu/iCUulKJ5eaUhA=; b=nN3ctrHQotkdM26l3AAJ96X5RX/AOcv+KKCAN3pRXdEGqfOWlOtnibU37JeYOb2U1E 43AE6zl4XRk21/t7FMVM0Bd1Nkyh7PrBnYCUJkobL/bPpr1ywolal63qmIlv84gcwcUb zTY/8CSkwvb1vgBMcq17idQJKGoBLym65mT+4aRVihO2U0Jhw8jwCXV4xjevVU1S8+aY +lZKrb9Z9LgmRP/eDCH65mRFBsHX4ZPGMBuw7S4a45/yTpVwDRkJX945J6CWzZLlpq6v MkGhL9qA8U1Ndm/5CiXn3EjxB7bXQgu9vk/1QzB8pOUbi45kFjbcg1guB+ER/xSxLfsq 9McQ== X-Gm-Message-State: AEkoous+A3ftOyXwEaCj44fxQzrqjdBitfPeJzhaYyxQ/kfshbo8vI8dtyrruZ9IkK5uHPnDWEBE5qdZNKCDbg== X-Received: by 10.25.18.154 with SMTP id 26mr18845936lfs.186.1470245210475; Wed, 03 Aug 2016 10:26:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.161.134 with HTTP; Wed, 3 Aug 2016 10:26:30 -0700 (PDT) In-Reply-To: References: From: Romain Manni-Bucau Date: Wed, 3 Aug 2016 19:26:30 +0200 Message-ID: Subject: Re: Define datasource, reference JDBC driver, and see init in console To: "users@tomee.apache.org" Content-Type: multipart/alternative; boundary=001a113fb3d480d51605392e23f3 archived-at: Wed, 03 Aug 2016 17:26:58 -0000 --001a113fb3d480d51605392e23f3 Content-Type: text/plain; charset=UTF-8 well the openejb lookup clearly works even with spring (see https://github.com/rmannibucau/lookup-from-spring-in-tomee/blob/master/src/main/webapp/WEB-INF/applicationContext.xml#L13) so there should be something linked to your setup. Listing JNDI is a more complicated task than doing a list() on a context cause several contexts are aggregated. Romain Manni-Bucau @rmannibucau | Blog | Old Wordpress Blog | Github | LinkedIn | Tomitriber | JavaEE Factory 2016-08-03 18:47 GMT+02:00 KARR, DAVID : > > -----Original Message----- > > From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com] > > Sent: Tuesday, August 02, 2016 11:53 PM > > To: users@tomee.apache.org > > Subject: Re: Define datasource, reference JDBC driver, and see init in > > console > > > > Hello > > > > Before digging deeper in your problem a small note on this one: since > > you encounter some issue with the doc I would love you to try to > > enrich/rewrite some part of it to make it smoother for next newcomer. > > Would it be possible? > > > > Next about your issue: > > > > - using jdbc/sus2 you can use @Resource(name = "jdbc/sus2") DataSource > > ds; or do a lookup on openejb:Resource/jdbc/sus2 or > > java:openejb/Resource/ > > jdbc/sus2 > > None of these lookup patterns worked. Is there some way I can get a list > of what was finally registered? I tried executing some code like this: > ---------- > List nameClassPairList = new > ArrayList<>(); > InitialContext context = new InitialContext(); > NamingEnumeration contextNames = > context.list("java:comp/env"); > while (contextNames.hasMore()) { > nameClassPairList.add(contextNames.next()); } > return nameClassPairList; > --------------- > > With various expressions in the "list()" parameter, but I haven't found > any trace of "sus2" anywhere. > > > 2016-08-03 1:21 GMT+02:00 KARR, DAVID : > > > > > I may be making some progress. Working from > > > http://tomee.apache.org/tomee-and-eclipse.html , it appears that the > > > "tomeee.xml" file that I edited in the Tomee distro is not used in > > > Eclipse. I used the "Import" feature as described to copy the file > > into > > > the server defined in Eclipse. At that point, I got an error like > > this: > > > --------------------- > > > org.apache.openejb.OpenEJBException: > > > Unable to read OpenEJB configuration file at > > > > > \.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\tom > > ee.xml: > > > Unsupported Attribute(s): maxActive, maxIdle, maxWait, > > > driverClassName, url, username, password. > > > Supported Attributes are: type, jar, provider, id, class-name, > > > constructor, factory-name, classpath, jndi, aliases, > > > properties-provider, property-provider, depends-on. If the setting is > > > a configuration property it must be placed inside the element body. > > > --------------------- > > > > > > Really strange. > > > > > > I then modified the imported "tomee.xml" file, resulting in the > > > following approximate Resource definition: > > > -------------------- > > > > > classpath="mvn:oracle:ojdbc6:11.2.0.3" > > > class-name="oracle.jdbc.driver.OracleDriver"> > > > maxActive = 5 > > > maxIdle = 2 > > > maxWait = 10000 > > > url = jdbc:oracle:thin:@:1521: > > > username = > > > password = > > > > > > -------------- > > > > > > When I start up the server, I see the following in the console: > > > ------------------ > > > Aug 02, 2016 4:13:03 PM org.apache.openejb.config.ConfigurationFactory > > > configureService > > > INFO: Configuring Service(id=jdbc/sus2, type=Resource, > > > provider-id=jdbc/sus2) > > > Aug 02, 2016 4:13:03 PM org.apache.openejb.util.OptionsLog info > > > INFO: Using 'openejb.deployments.classpath=false' > > > Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler > > > createRecipe > > > INFO: Creating TransactionManager(id=Default Transaction Manager) Aug > > > 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler > > > createRecipe > > > INFO: Creating SecurityService(id=Tomcat Security Service) Aug 02, > > > 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler > > > createRecipe > > > INFO: Creating Resource(id=jdbc/sus2) > > > Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler > > > unusedProperty > > > WARNING: unusedProperty maxActive - jdbc/sus2 Aug 02, 2016 4:13:03 PM > > > org.apache.openejb.assembler.classic.Assembler > > > unusedProperty > > > WARNING: unusedProperty maxIdle - jdbc/sus2 Aug 02, 2016 4:13:03 PM > > > org.apache.openejb.assembler.classic.Assembler > > > unusedProperty > > > WARNING: unusedProperty maxWait - jdbc/sus2 Aug 02, 2016 4:13:03 PM > > > org.apache.openejb.assembler.classic.Assembler > > > unusedProperty > > > WARNING: unusedProperty url - jdbc/sus2 Aug 02, 2016 4:13:03 PM > > > org.apache.openejb.assembler.classic.Assembler > > > unusedProperty > > > WARNING: unusedProperty username - jdbc/sus2 Aug 02, 2016 4:13:03 PM > > > org.apache.openejb.assembler.classic.Assembler > > > unusedProperty > > > WARNING: unusedProperty password - jdbc/sus2 > > > ----------------- > > > > > > I don't understand what "unusedProperty" means (weird that it's just > > > one word). > > > > > > When I later try to reference that resource, I get the following: > > > -------------------- > > > javax.naming.NameNotFoundException: Name [jdbc/sus2] is not bound in > > > this Context. Unable to find [jdbc]. > > > -------------------- > > > > > > It's not clear to me whether that Resource definition put anything > > > into the JNDI context, or whether I'm just using the wrong JNDI path > > > to reference it. > > > > > > -----Original Message----- > > > From: Daniel Cunha [mailto:danielsoro@gmail.com] > > > Sent: Tuesday, August 02, 2016 2:10 PM > > > To: TomEE Users > > > Subject: Re: Define datasource, reference JDBC driver, and see init in > > > console > > > > > > Hi David, > > > > > > yea, resources on TomEE is a mix (XML/Properties) Your definition > > > should following the pattern: > > > > > > maxActive = 5 > > > maxIdle = 2 > > > maxWait = 10000 > > > driverClassName = oracle.jdbc.driver.OracleDriver > > > url = jdbc:oracle:thin:@:1521: > > > username = > > > password = > > > > > > > > > References you can see here: > > > http://tomee.apache.org/datasource-config.html > > > About maven, should be enough have the configuration in your > > settings.xml. > > > :) > > > > > > On Tue, Aug 2, 2016 at 5:52 PM, KARR, DAVID wrote: > > > > > > > (I posted this first to tomcat-user, but I realized technically it > > > > should go to tomee-user. I apologize if this is a duplicate for > > you. > > > > In any case, this note has a little more info than the first note.) > > > > > > > > I'm attempting to use Tomcat(tomee) to run a REST service that will > > > > return some data from some SQL queries (Oracle). I've installed > > > > Tomee 7.0.1, which uses Tomcat 8.5.3. > > > > > > > > The JDBC driver is available from a private enterprise maven repo. > > > > I'd prefer to get it from there, as opposed to storing it locally. > > > > I noticed at http://tomee.apache.org/configuring-datasources.html , > > > > there is the possible notation of "mvn:g:a:v" for the "classpath" > > > > attribute. However, I don't see any way to configure the Maven > > > repositories this will reference. > > > > How do I tell it to look in a particular repo for this? Would it > > > > just implicitly use my $HOME/.m2/settings.xml file? > > > > > > > > My Resource definition in "conf/tomee.xml" looks something like > > this: > > > > ----------------------- > > > > > > > maxActive="5" maxIdle="2" maxWait="10000" > > > > driverClassName="oracle.jdbc.driver.OracleDriver" > > > > url="jdbc:oracle:thin:@:1521:" > > > > username="" password=""/> > > > > ---------------- > > > > > > > > Does this look correct? I find the Tomcat docs confusing, with > > > > respect to the required syntax for this. It's not clear whether a > > > > pure XML syntax is required, or a mixed XML/property syntax. > > > > > > > > If I start the instance, should I see any default output that will > > > > show Tomcat connecting to this datasource? If it doesn't show this > > > > by default, is there a way to turn this on? > > > > > > > > I tried writing the code to obtain the JNDI resource (Spring context > > > > references), but it just says it can't find it (fails at "jdbc"), so > > > > perhaps my Resource definition was ignored, or my JNDI path is > > wrong. > > > > > > > > > > > > > > > > -- > > > Daniel Cunha > > > https://twitter.com/dvlc_ > > > http://www.tomitribe.com > > > http://www.tomitribe.io > > > > --001a113fb3d480d51605392e23f3--