I forgot to say that I am working with reflection for getting the class that implements the send method in the third bundle. I tried it now without reflection and it works.
Has anyone experience with the side effects of using reflection in the OSGi environment? Maybe it is a bad idea to use it at all. What I want to achieve is a dynamic environment in which users can add bundles with certain functionality (methods). These methods can be combined with an orchestration language. And for calling a single method I am using reflection as I am only aware of method names and the belonging classes. Thx Alex Am 18.03.10 11:38 schrieb "Alexander Blotny" unter <[email protected]>: > Hi, > > I am trying to use commons-email-1.2 with apache Felix. > I have started the bundle mail-1.4.jar (including javamail) because > commons-email uses this library. Then I am starting commons-email and there > are no errors. > > A third bundle is accessing the SimpleEmail class of commons-email and sends > a mail. > I get following error: > > org.apache.commons.mail.EmailException: Unable to locate provider for > protocol: pop3 > at org.apache.commons.mail.Email.buildMimeMessage(Email.java:1111) > at org.apache.commons.mail.Email.send(Email.java:1162) > at > de.fhg.fokus.ngni.xposer.see.service.email.impl.EmailImpl.send(EmailImpl.jav > a:80) > at > de.fhg.fokus.ngni.xposer.see.service.email.impl.EmailImpl.send(EmailImpl.jav > a:33) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 > ) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl > .java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at > de.fhg.fokus.ngni.xposer.see.bundle.BundleEventHandler$MyTimerTask.run(Bundl > eEventHandler.java:164) > at java.util.TimerThread.mainLoop(Timer.java:512) > at java.util.TimerThread.run(Timer.java:462) > Caused by: javax.mail.NoSuchProviderException: Unable to locate provider for > protocol: pop3 > at javax.mail.Session.getProvider(Session.java:229) > at javax.mail.Session.getStore(Session.java:270) > at org.apache.commons.mail.Email.buildMimeMessage(Email.java:1105) > > > I guess that some properties cannot be loaded because of the classloading in > OSGi but how can I change that? > > The source code is: > > smtpHost = MailSettings.smtpHost; userName = > MailSettings.smtpUsername; pw = MailSettings.smtpPassword; > emailAddress = MailSettings.fromAddress; pop3Host = > MailSettings.pop3Host; toAddress = emailAddress; > try { SimpleEmail email=new SimpleEmail(); > email.setHostName(smtpHost); email.setAuthentication(userName, > pw); email.setFrom(emailAddress, user); > email.addTo(toAddress); > email.setPopBeforeSmtp(true, pop3Host, userName, pw); > email.setSubject(subject); email.setMsg(message); > email.send(); } catch (EmailException e) { > e.printStackTrace(); return false; } > > Thx, > Alex --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

