Return-Path: X-Original-To: apmail-cayenne-user-archive@www.apache.org Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8E1E211B43 for ; Fri, 25 Apr 2014 14:11:57 +0000 (UTC) Received: (qmail 81757 invoked by uid 500); 25 Apr 2014 14:11:57 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 81733 invoked by uid 500); 25 Apr 2014 14:11:57 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 81724 invoked by uid 99); 25 Apr 2014 14:11:56 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Apr 2014 14:11:56 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mkienenb@gmail.com designates 209.85.216.45 as permitted sender) Received: from [209.85.216.45] (HELO mail-qa0-f45.google.com) (209.85.216.45) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Apr 2014 14:11:53 +0000 Received: by mail-qa0-f45.google.com with SMTP id cm18so3548768qab.4 for ; Fri, 25 Apr 2014 07:11:32 -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 :content-type; bh=2CGxndFenD4jiUpasD73aEW3UJF5Z6++jOgUM/0P/tA=; b=cbM1DzMlE684ayDlCKxKpom1g8mvZQb4RT1uc8D/cTKeRUjM8rW/XhZcD/Rr6urvBK JLXGLYoafLXCe0zwbalh7k1R3ehLKLeLG41UT6nJz51iMMnBMxJy/BVI8+sREdNmAPJs x/2HMD/5BmdxUtNWqobg6k74WInAmhIR7kIYloCm6fllrXpKAUhQJQjUqcSCH7aICKz+ 8trc0xTw/RWEg92Ng9U/SAEyYE07+/Sf+yd0r3yjLq3n6orLY7pT+FZGxtCQ8EPND3iJ dlyr8Dm1XJ5lOwHA2mfzK0f/3K5r7nb/7PJNmNVixvR2s37RZDfiRwS6QAlC7p3bxYZT clgg== X-Received: by 10.229.216.72 with SMTP id hh8mr11878541qcb.9.1398435092469; Fri, 25 Apr 2014 07:11:32 -0700 (PDT) MIME-Version: 1.0 Received: by 10.96.215.2 with HTTP; Fri, 25 Apr 2014 07:11:12 -0700 (PDT) In-Reply-To: <05C4089D-014D-4448-860E-01A259FF50D8@triptera.com.au> References: <05C4089D-014D-4448-860E-01A259FF50D8@triptera.com.au> From: Mike Kienenberger Date: Fri, 25 Apr 2014 10:11:12 -0400 Message-ID: Subject: Re: How to use JNDI in development To: user@cayenne.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org I started with Eclipse using Tomcat and Sysdao. I did this for a year or two before switching over to jetty. At first I used a jetty eclipse plugin, but for the last few years, I have switched over to just configuring jetty by hand in an xml file, adding jetty to the project as user library, and starting each project with a launch target. This has worked great for me, and has also worked well in a team environment where people use different versions of jetty, or even tomcat with manual deploys inside of eclipse, as each person is free to define the web-container environment differently in their version of the user library. If you have the option, I'd suggest deploying to jetty rather than tomcat to keep things simple, but it's not really that important. Actually I suggest deploying with no app container (embedded jetty) if you have an environment where you can get away with it. http://johannesbrodwall.com/2010/03/08/why-and-how-to-use-jetty-in-mission-critical-production/ As for JNDI, I started with that approach because Cayenne supported it, jett supported, tomcat supported, and the various production containers used supported it, but my primary client these days has switched to reading a config file provided on each host rather than JNDI. I'm actually finding this far easier that figuring out how to set up and maintain JNDI for the container-of-the-day, and it's still usable when there's no container, such as batch job processes. Again, it probably depends on your environment. If you'd like additional help setting up Eclipse to run your projects with jetty like I do, let me know. The only issue I've come across is that the jetty WebAppClassLoader points to the same to the same location as the eclipse classpath, so I had to write a subclass of it to stop it from finding two copies of the same file -- certain frameworks like JSF don't handle finding two copies of the same resource well. Then I added it to my user library and set it as the classloader in my jetty config file. Might be fixed in newer versions of jetty. The specific problem you are having with jetty appears to be that you haven't added the libs from jetty that deal with JNDI. Jetty is modular, and by default, it ships with a minimal set of supported features -- you need to add additional jars if you want to have JSP, JNDI, etc, support enabled. On Thu, Apr 24, 2014 at 9:38 PM, D Tim Cummings wrote: > Hi > > I am using cayenne in a tapestry project and my final deployment will be in > Tomcat 7 using JNDI for defining the data source. I am developing in Eclipse > 4.3.1 and would like my development environment to be as close to deployment > as possible. What is the recommended way of using JNDI in development. > > I have tried the instructions on > > http://tynamo.org/Developing+with+Tomcat+and+Eclipse > > using sysdeo tomcat plugin for eclipse. I haven't been able to get it to > read the jndi information. > > Apr 25, 2014 11:25:40 AM org.apache.catalina.deploy.NamingResources > addResource > WARNING: Failed to create MBean for naming resource [null] > > I have tried using RunJettyRun but get. > > Exception happened when loading Jetty.xml: > java.lang.ClassNotFoundException: org.eclipse.jetty.plus.jndi.Resource > > > RunJettyRun works great when I configure cayenne-project.xml to > XMLPoolingDataSourceFactory but I don't want to have to keep switching > between this and JNDI when ready to deploy. I would also prefer to use > tomcat in dev so it is same as prod. > > JNDI works great when I build a war file and deploy to tomcat but that would > slow my development if I had to do that every time. > > I don't necessarily have to solve these problems if you can recommend an > alternative way of keeping database config separate to the war. The war will > be deployed by unskilled users on Windows and skilled users on Linux and Mac > so I am trying to keep the steps to deploy simple and not hard code absolute > paths of properties files into my app. > > Thanks > > Tim