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 98DCC1181D for ; Sun, 27 Apr 2014 00:07:37 +0000 (UTC) Received: (qmail 80032 invoked by uid 500); 27 Apr 2014 00:07:37 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 79987 invoked by uid 500); 27 Apr 2014 00:07:36 -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 79979 invoked by uid 99); 27 Apr 2014 00:07:36 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 27 Apr 2014 00:07:36 +0000 X-ASF-Spam-Status: No, hits=3.9 required=5.0 tests=HTML_MESSAGE,MANY_SPAN_IN_TEXT,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [209.85.220.182] (HELO mail-vc0-f182.google.com) (209.85.220.182) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 27 Apr 2014 00:07:32 +0000 Received: by mail-vc0-f182.google.com with SMTP id lf12so4180380vcb.41 for ; Sat, 26 Apr 2014 17:07:11 -0700 (PDT) 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:content-type; bh=L6vbHk+JV4XnhQQYjKaNaFuscQkKI75dzW4JsT8IqmA=; b=Oxyu6UlpNZr6C2Aqao+LC7YsSomFd1yX7D+D4rPJFUK3eJJDvhbL28h4vELBk9Gkz1 zDiaeKAjpZ6lvW9R+dj5l2WVc9QDEq4YmEAEVf/brsaleBjDgRHjLB0BJihGy7NeMI7H Ybb8xZLJszTecky9yLCIh1/NintjnuMOopaFylPWMOSS3rzT/AnsXk+/mZReEhcpYCRt aEC87I0xaRt6owBDT7c+RcGWStbNu69twFnbsGtVPL/mG8qvmjTO9uerye4EAKPEp4vz RkuDmtwUyzXUuy673d4fu8xaptVqv/k7v6DeZb6gVdEbrJpQijDWP7N2EG2CFy6HJioW 9ENw== X-Gm-Message-State: ALoCoQmo7edj1xqECdT6p8gOI8ENypPaZy+/lgMpbq0Whrx6hx9UBoX9FAaQX5a/+EriuZTb5V7E X-Received: by 10.52.108.164 with SMTP id hl4mr12719156vdb.25.1398557231214; Sat, 26 Apr 2014 17:07:11 -0700 (PDT) MIME-Version: 1.0 Received: by 10.58.105.230 with HTTP; Sat, 26 Apr 2014 17:06:51 -0700 (PDT) In-Reply-To: References: <05C4089D-014D-4448-860E-01A259FF50D8@triptera.com.au> From: Michael Gentry Date: Sat, 26 Apr 2014 20:06:51 -0400 Message-ID: Subject: Re: How to use JNDI in development To: Cayenne Users Content-Type: multipart/alternative; boundary=bcaec547c9d5f70af804f7fafa6a X-Virus-Checked: Checked by ClamAV on apache.org --bcaec547c9d5f70af804f7fafa6a Content-Type: text/plain; charset=UTF-8 Hi Tim, Yes, live class reloading (within the Tapestry realm -- pages/components/services) works for me. Make sure you are running your application in development mode instead of production mode. (Production mode is the default.) If you look at the POM I shared with you, you'll see I have: tapestry.production-mode false This overrides the default when you run the application via Maven. mrg On Sat, Apr 26, 2014 at 4:54 PM, D Tim Cummings wrote: > Hi Michael > > Problem was a wrong case on the s in DataSource in my web.xml file > > I had > > > jdbc/db_tims > javax.sql.Datasource > Container > > > But I should have had > > > jdbc/db_tims > javax.sql.DataSource > Container > > > So mvn jetty:run is working now for me. It just doesn't do live class > reloading in Tapestry project. Does live class reloading work for you? > > Tim > > On 26 Apr 2014, at 22:19, Michael Gentry wrote: > > Hi Tim, > > Given the exception: > > Caused by: > java.lang.ClassNotFoundException: javax.sql.Datasource > > I'm going to guess you perhaps forgot to include this dependency in the > POM? > > > > commons-dbcp > commons-dbcp > 1.4 > runtime > > > mrg > > > On Fri, Apr 25, 2014 at 6:39 PM, D Tim Cummings > wrote: > > Thanks Michael. > > This is very handy. I downloaded cbe and was able to get it running > talking to a mysql database by changing the jndi config. Now I am trying to > retrofit config to my app and I get the following error when I do mvn > jetty:run. I have all the same dependencies and plugins (plus a few more) > although some of my versions are more recent. > > [INFO] Scanning for projects... > [INFO] > > [INFO] > ------------------------------------------------------------------------ > [INFO] Building Tims App 0.0.8 > [INFO] > ------------------------------------------------------------------------ > [INFO] > [INFO] >>> jetty-maven-plugin:7.5.1.v20110908:run (default-cli) @ tims-app > > > [INFO] > [INFO] --- maven-cayenne-plugin:3.2M1:cgen (default-cli) @ tims-app --- > [INFO] > [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ > tims-app --- > [WARNING] File encoding has not been set, using platform encoding UTF-8, > i.e. build is platform dependent! > [WARNING] Using platform encoding (UTF-8 actually) to copy filtered > resources, i.e. build is platform dependent! > [INFO] Copying 33 resources > [INFO] > [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ tims-app > --- > [INFO] Nothing to compile - all classes are up to date > [INFO] > [INFO] --- maven-resources-plugin:2.6:testResources > (default-testResources) @ tims-app --- > [WARNING] Using platform encoding (UTF-8 actually) to copy filtered > resources, i.e. build is platform dependent! > [INFO] skip non existing resourceDirectory > /Users/tim/github/tims-app/tims-app/src/test/resources > [INFO] > [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ > tims-app --- > [INFO] Nothing to compile - all classes are up to date > [INFO] > [INFO] <<< jetty-maven-plugin:7.5.1.v20110908:run (default-cli) @ tims-app > <<< > [INFO] > [INFO] --- jetty-maven-plugin:7.5.1.v20110908:run (default-cli) @ tims-app > --- > [INFO] Configuring Jetty for project: Tramanco Vehicle Weigh > [INFO] Webapp source directory = > /Users/tim/github/tims-app/tims-app/src/main/webapp > [INFO] Reload Mechanic: automatic > [INFO] Classes = > /Users/tim/github/tims-app/tims-app/target/tims-app/WEB-INF/classes > [INFO] Added extra scan > target:/Users/tim/github/tims-app/tims-app/src/main/resources > [INFO] Context path = /tims-app > [INFO] Tmp directory = /Users/tim/github/tims-app/tims-app/target/tmp > [INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml > [INFO] Web overrides = none > [INFO] web.xml file = > file:/Users/tim/github/tims-app/tims-app/src/main/webapp/WEB-INF/web.xml > [INFO] Webapp directory = /Users/tim/github/tims-app//src/main/webapp > [INFO] Starting jetty 7.5.1.v20110908 ... > 2014-04-26 08:28:40.142:INFO:oejs.Server:jetty-7.5.1.v20110908 > 2014-04-26 08:28:41.030:INFO:oejpw.PlusConfiguration:No Transaction > manager found - if your webapp requires one, please configure one. > 2014-04-26 08:28:41.068:WARN:oejw.WebAppContext:Failed startup of context > > o.m.j.p.JettyWebAppContext{/tims-app,file:/Users/tim/github/tims-app/tims-app/src/main/webapp/},file:/Users/tim/github/tims-app/tims-app/src/main/webapp/ > java.lang.reflect.InvocationTargetException > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) > at > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:606) > at > > org.eclipse.jetty.webapp.IterativeDescriptorProcessor.visit(IterativeDescriptorProcessor.java:80) > at > > org.eclipse.jetty.webapp.IterativeDescriptorProcessor.process(IterativeDescriptorProcessor.java:67) > at org.eclipse.jetty.webapp.MetaData.resolve(MetaData.java:321) > at > > org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1211) > at > > org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:589) > at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:454) > at > > org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:219) > at > > org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59) > at > > org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224) > at > > org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:167) > at > > org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59) > at > > org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224) > at > > org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59) > at > > org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:89) > at org.eclipse.jetty.server.Server.doStart(Server.java:261) > at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:67) > at > > org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59) > at > > org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:333) > at > > org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:273) > at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:548) > at > > org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106) > at > > org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) > at > > org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) > at > > org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) > at > > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) > at > > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) > at > > org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) > at > > org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) > at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317) > at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152) > at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555) > at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214) > at org.apache.maven.cli.MavenCli.main(MavenCli.java:158) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) > at > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:606) > at > > org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) > at > org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) > at > > org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) > at > org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) > Caused by: > java.lang.ClassNotFoundException: javax.sql.Datasource > at java.net.URLClassLoader$1.run(URLClassLoader.java:366) > at java.net.URLClassLoader$1.run(URLClassLoader.java:355) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findClass(URLClassLoader.java:354) > at > > org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:415) > at > > org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:377) > at > > org.eclipse.jetty.server.handler.ContextHandler.loadClass(ContextHandler.java:1323) > at > > org.eclipse.jetty.plus.webapp.PlusDescriptorProcessor.visitResourceRef(PlusDescriptorProcessor.java:245) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) > at > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:606) > at > > org.eclipse.jetty.webapp.IterativeDescriptorProcessor.visit(IterativeDescriptorProcessor.java:80) > at > > org.eclipse.jetty.webapp.IterativeDescriptorProcessor.process(IterativeDescriptorProcessor.java:67) > at org.eclipse.jetty.webapp.MetaData.resolve(MetaData.java:321) > at > > org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1211) > at > > org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:589) > at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:454) > at > > org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:219) > at > > org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59) > at > > org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224) > at > > org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:167) > at > > org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59) > at > > org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224) > at > > org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59) > at > > org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:89) > at org.eclipse.jetty.server.Server.doStart(Server.java:261) > at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:67) > at > > org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59) > at > > org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:333) > at > > org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:273) > at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:548) > at > > org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106) > at > > org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) > at > > org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) > at > > org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) > at > > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) > at > > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) > at > > org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) > at > > org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) > at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317) > at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152) > at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555) > at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214) > at org.apache.maven.cli.MavenCli.main(MavenCli.java:158) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) > at > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:606) > at > > org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) > at > org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) > at > > org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) > at > org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) > 2014-04-26 08:28:41.087:INFO:oejs.AbstractConnector:Started > SelectChannelConnector@0.0.0.0:8088 STARTING > [INFO] Started Jetty Server > > > On 25 Apr 2014, at 23:43, Michael Gentry wrote: > > Here is a pom.xml which includes the Jetty plugin: > > https://github.com/mrg/cbe/blob/master/WebApplications/pom.xml > > And a jetty-env.xml which defines the JNDI lookup: > > > > https://github.com/mrg/cbe/blob/master/WebApplications/src/main/webapp/WEB-INF/jetty-env.xml > > > mrg > > > > On Fri, Apr 25, 2014 at 9:40 AM, Michael Gentry > wrote: > > > Hi Tim, > > RunJettyRun uses plain Jetty and not Jetty+ (which includes the JNDI > extension). What I do in my development is use the Jetty Maven plugin and > then just use Maven to run Jetty. Has worked pretty well so far for me. > > > 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 > > > > > > > --bcaec547c9d5f70af804f7fafa6a--