I posted back a couple of months ago, and again a week or so ago about
setting up with JNDI:
http://markmail.org/message/6o6yqnul64q72ixw
http://markmail.org/message/lp5tu7com65jjhwq
In short, I want to
* use Jetty for development
* but, use GlassFish for testing, production environments.
JNDI offers a number of benefits, especially since I am deploying to a
pretty strictly controlled production, and server engineers should easily be
able to change database connection parameters, etc.
I am using a modular archetype, and have run mvn appfuse:full-source.
I am most of the way there, with JNDI working well for database connections.
I've written this up in more to detail, and I want to post this information
to the wiki, once I get some feedback from folks on the list. In summary
though, to get JNDI databases working:
* created sun-web.xml and jetty-env.xml in my WEB-INF/ folder.
* added JNDI Resource references to web.xml.
* commented out the JDBC dataSource, and replace with datasource based on
JNDI lookup in applicationContext-resources.xml.
* added separate applicationContext-resources.xml in the web app's test
resources, overriding use of JNDI with a regular JDBC dataSource (JNDI
should not be used for unit, integration tests).
Setting up with a Mail Session, however, is causing a headache and this is
where I would appreciate some help. I did the following:
* Moved mailSender bean definition out of core's
applicationContext-service.xml.
* Created JNDI mail session bean and mailSender in web's
applicationContext-resources.xml
* Create test mailSender bean definitions for testing in core +
public-client's applicationContext-resources.xml.
And here's what I am experiencing:
java.lang.IllegalArgumentException:
Cannot convert value of type [javax.mail.Session] to required type
[javax.mail.Session] for property 'session': no matching editors
or conversion strategy found
This is pretty cryptic, but I found a pointer to what the issue might be in
this blog post under the heading "Alternative 2":
http://springtips.blogspot.com/2008/06/send-e-mail-using-spring-and-javamail.html
Although the blog posting suggests this happens with Tomcat, I guess it may
also come up in Jetty? That is, that activation.jar and mail.jar must be
excluded from the web application's classpath if using the JNDI and mail.
My QUESTION THEREFORE, is it possible to exclude certain Jars from the
application classpath using the maven-jetty-plugin?
Or, does anyone have a different explanation (or solution) for why I might
be getting a cryptic error message along these lines?
Many thanks
Alex Coles