And of course it shouldn't be resource-ref-name but res-ref-name.
<resource-ref>
<res-ref-name>jdbc/db_tims</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>Fixing that and I can now use RunJettyRun or mvn jetty:run or Andrus's system properties which allow me to leave my JNDI configuration in place during development. Thanks for everyone's help Tim On 27 Apr 2014, at 6:54, D Tim Cummings <[email protected]> wrote: > Hi Michael > > Problem was a wrong case on the s in DataSource in my web.xml file > > I had > > <resource-ref> > <resource-ref-name>jdbc/db_tims</resource-ref-name> > <res-type>javax.sql.Datasource</res-type> > <res-auth>Container</res-auth> > </resource-ref> > > But I should have had > > <resource-ref> > <resource-ref-name>jdbc/db_tims</resource-ref-name> > <res-type>javax.sql.DataSource</res-type> > <res-auth>Container</res-auth> > </resource-ref> > > 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 <[email protected]> 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? >> >> <dependency> >> <!-- Used by jetty:run to define JDNI data source --> >> <groupId>commons-dbcp</groupId> >> <artifactId>commons-dbcp</artifactId> >> <version>1.4</version> >> <scope>runtime</scope> >> </dependency> >> >> mrg >> >> >> On Fri, Apr 25, 2014 at 6:39 PM, D Tim Cummings <[email protected]> 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 >>> [email protected]:8088 STARTING >>> [INFO] Started Jetty Server >>> >>> >>> On 25 Apr 2014, at 23:43, Michael Gentry <[email protected]> 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 <[email protected] >>>> 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 <[email protected] >>>> 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 >>> >>> >>> >>> >>> >
signature.asc
Description: Message signed with OpenPGP using GPGMail
