You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Scott Came <sc...@search.org> on 2015/02/12 02:02:20 UTC

Pax Exam, Karaf and camel-mail

After trying everything I can think of (and all the possibilities I found
searching forums/lists/etc), I was hoping someone on the forum could help...

I have an OSGi bundle that contains a camel route.  This route sends an
email via the Camel mail component.  I have tested the route outside the
OSGi container, and it works fine (I have it send the email to Wiser on
localhost, which receives it.)

I now want to test this bundle in-container, via Pax Exam.  I am using Pax
Exam 3.6.0, with the Karaf test container, version 2.2.11 (for now...matches
our production version.)

I am able to install the bundle containing the camel route, and all of its
dependencies.  These dependencies include, of course, the camel-mail
feature.  I run an osgi:list in the test probe inside exam, and it lists all
bundles as successfully installed and Active.

When I run the test, I get:

Caused by: javax.mail.NoSuchProviderException: smtp
	at javax.mail.Session.getService(Session.java:798)[98:javax.mail:1.4.4]
	at javax.mail.Session.getTransport(Session.java:720)[98:javax.mail:1.4.4]
	at javax.mail.Session.getTransport(Session.java:660)[98:javax.mail:1.4.4]
	at javax.mail.Session.getTransport(Session.java:640)[98:javax.mail:1.4.4]
	at
org.apache.camel.component.mail.DefaultJavaMailSender.getTransport(DefaultJavaMailSender.java:138)[160:org.apache.camel.camel-mail:2.10.7]

Various things I have tried:

* Installing various versions of the javax.mail/mail bundle (no
difference...I've also noticed that via various dependencies, the container
has JavaMail already installed, whether I explicitly install or not)

* Adding systemPackages() as a configuration option to the Pax Exam
container config, passing in the com.sun packages, etc.

* Editing and deploying a jre.properties config file to etc that has
javax.mail added

* Trying to install various servicemix* bundles that have java mail,
activation, etc.

* Trying to put the javax.mail/mail jar on the Karaf boot classpath with a
bootClasspathLibrary() config option

Most of these things make no difference, and none of them work.  In
particular, when I add a systemPackages() configuration option, I do get a
different exception...a ClassNotFoundException for
com.sun.mail.util.MessageRemovedIOException.

Clearly, the original problem is that Karaf (and/or my bundle) can't find an
smtp mail provider on its classpath.  I just can't figure out where the
provider is and how to properly get it on the classpath so my bundle can
access it.

I realize this is a Karaf forum and that Camel is involved...but I really
don't think it's a Camel issue, since my tests run fine outside the
container.  Maybe it's a Pax Exam configuration problem, but I couldn't find
where to post questions about Pax Exam...

Would be very grateful for any assistance!

Thanks.
--Scott



--
View this message in context: http://karaf.922171.n3.nabble.com/Pax-Exam-Karaf-and-camel-mail-tp4038480.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Pax Exam, Karaf and camel-mail

Posted by Scott Came <sc...@search.org>.
After looking at the camel integration test suite, and specifically the
MailRouteTest in there, I learned that installing the cxf-jaxb feature is
necessary to allow the mail component in camel to find the SMTP protocol
provider.

Still not sure why exactly, but at least my test runs now!



--
View this message in context: http://karaf.922171.n3.nabble.com/Pax-Exam-Karaf-and-camel-mail-tp4038480p4038545.html
Sent from the Karaf - User mailing list archive at Nabble.com.