I got mvn jetty:run to run. It turned out I had a mistake in my web.xml. In the 
resource-ref I had res-type javax.sql.Datasource instead of 
javax.sql.DataSource. This was triggering a ClassNotFound on 
javax.sql.Datasource

The problem with mvn jetty:run is it doesn't seem to support Tapestry's live 
class reloading even though production mode is false. Using RunJettyRun with 
Andrus's solution does support live class reloading. Using RunJettyRun with 
JNDI and jetty 7 I get the following errors.

When my jetty-env.xml tries to configure jndi in (as per Michael's "Cayenne by 
Example")

<Configure class="org.eclipse.jetty.webapp.WebAppContext">

I get 

Exception happened when loading Jetty.xml:
java.lang.IllegalArgumentException: Object of class 
'org.eclipse.jetty.server.Server' is not of type 
'org.eclipse.jetty.webapp.WebAppContext'. 
        at 
org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:318)
        at 
org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:279)
        at runjettyrun.Bootstrap.main(Bootstrap.java:66)
2014-04-26 18:50:26.242:INFO:oejs.Server:jetty-7.6.2.v20120308


When I edit jetty-env.xml to be

<Configure class="org.eclipse.jetty.server.Server">

I get 

2014-04-26 18:53:30.942:INFO:oejs.Server:jetty-7.6.2.v20120308
2014-04-26 18:53:31.054:WARN:oejw.WebAppContext:Failed startup of context 
o.e.j.w.WebAppContext{/tims-app,[file:/Users/tim/github/tims-app/tims-app/src/main/webapp/]}
java.lang.IllegalArgumentException: Object of class 
'org.eclipse.jetty.webapp.WebAppContext' is not of type 
'org.eclipse.jetty.server.Server'. 
        at 
org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:318)
        at 
org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:279)
        at 
org.eclipse.jetty.plus.webapp.EnvConfiguration.configure(EnvConfiguration.java:119)
        at 
org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:429)

I noticed also that mvn jetty:run launches jetty 7.5.1.c20110908
RunJettyRun gives an option to select jetty 7.5.1.v20110908 but when I select 
it the actual jetty which runs is 7.6.2.v20120308

(To remove some error messages in RunJettyRun with JNDI I had to add 
mysql-connector-java-5.1.26.jar, commons-dbcp-1.4.jar and 
commons-pool-1.5.4.jar to Custom Jetty Classpath.)

So for now I will use Andrus's suggestion of system properties to bypass JNDI 
in development, unless someone can advise how to get live class reloading from 
mvn jetty:run or how to get JNDI working in RunJettyRun.

Cheers

Tim

On 26 Apr 2014, at 10:11, Mike Kienenberger <[email protected]> wrote:

> On Fri, Apr 25, 2014 at 7:27 PM, D Tim Cummings <[email protected]> wrote:
> 
>> I am certainly finding jetty easier than tomcat in eclipse and once I get 
>> more familiar with it I may recommend it for production.  I am a bit 
>> concerned at all the different versions of jetty floating around with so 
>> many people sticking to old versions. Many people use version 6 while 
>> version 9 is recommended by http://www.eclipse.org/jetty. RunJettyRun 
>> doesn't have a version 9 option.
> 
> Really, once you get the basics of the jetty config file, it's just
> faster and easier to run jetty directly rather than messing around
> with the eclipse plugin.   You don't have to worry about the plugin
> supporting your jetty version or settings.   When you want to upgrade,
> you just update your user library to contain the new jetty version.
> 
> 
>> Embedded jetty sounds very tempting. I am not sure what the deployment 
>> options on Windows are. I can't expect my Windows users to go to the command 
>> line, and I don't know enough about Windows to create alternative launch 
>> techniques.
> 
> Basically, you build a jar file instead of a war/ear file, then you
> just run it with java -jar myapp.jar.   You'd probably want to set an
> environment variable to point at your config file or something along
> those lines.

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to