You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by mi...@telvent.com on 2009/07/07 17:33:28 UTC

Possible problem with Maven-bundle-plugin and remote OBR repository and Bundle-RequiredExecutionEnvironment info


Hi all,

I will try to show you the whole scenario related with the remote
deployment (install) of an artifact from the Apache Felix Web Management
Console within the OSGi Repository Tab.

I do not know if the problem will be related with the Maven-bundle-plugin
vesion 2.0.0 when publishing in a remote OBR repository a component (and
updating the new component information), or related with Apache Felix
Bundle Repository version 1.4.0 during the process of dependencies
resolution, or a mixture of both.

The problem seems to appear when a bundle with the Manifest header
Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6 present. In this
case, when publishing the information in the remote OBR repository using
the Maven-bundle-plugin (see 2), it is included a <require> information
related with the execution environment in the repository.xml file (see 4).
Then when you try to deploy the bundle version from the Web Management
Console the Apache Felix Bundle Repository it is not able to resolve this
dependency, and the deployment process is not satisfactory concluded (see
error Log in 5).

If you try to install the artifact manually from an URL location it works.

I think that or the <require> clause related to the manifest headers entry
Bundle-RequiredExecutionEnvironment should not be considered when
publishing information in the remote OBR repository, or the Apache Felix
Bundle Repository bundle should ignore this dependency clause when
resolving the dependencies related to a certain bundle.

Any suggestions?

1) Felix components:
**************************************************************************************
[   0] [Active     ] [    0] System Bundle (1.8.0)
[   1] [Active     ] [    1] Apache Felix Shell Service (1.2.0)
[   2] [Active     ] [    1] Apache Felix Shell TUI (1.2.0)
[   3] [Active     ] [    1] Apache Felix Bundle Repository (1.4.0)
**************************************************************************************

2) Remote OBR deployment command:
**************************************************************************************
mvn org.apache.felix:maven-bundle-plugin:2.0.0:deploy-file
-DgroupId=org.apache.tuscany -DartifactId=tuscany-sca-api -Dversion=2.0-M3
-Dpackaging=bundle -Dfile=tuscany-sca-api-2.0-M3.jar -DrepositoryId=nexus
-Durl=http://www.xxxxx.es:8081/nexus/content/repositories/releases
-DbundleUrl=http://www.xxxxx.es:8081/nexus/content/repositories/releases/org/apache/tuscany/tuscany-sca-api/2.0-M3/tuscany-sca-api-2.0-M3.jar
**************************************************************************************

3) MANIFEST.MF content:
**************************************************************************************
Import-Package: javax.security.auth,org.oasisopen.sca;version="2.0.0",
 org.oasisopen.sca.annotation;version="2.0.0",org.oasisopen.sca.client
 ;version="2.0.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6
**************************************************************************************

4) Repository.xml content:
**************************************************************************************
<resource id="org.apache.tuscany.sca.api/2.0.0" presentationname="Apache
Tuscany SCA API" symbolicname="org.apache.tuscany.sca.api"
uri="http://www.xxxxxx.com:8081/nexus/content/repositories/releases/org/apache/tuscany/tuscany-sca-api/2.0-M3/tuscany-sca-api-2.0-M3.jar"
 version="2.0.0">
<description>API classes for the Service Component
Architecture</description>
<size>31019</size>
<documentation>http://www.apache.org/</documentation>
<license>http://www.apache.org/licenses/LICENSE-2.0.txt</license>
<category id="org.apache.tuscany"/>
−
<capability name="bundle">
<p n="manifestversion" v="2"/>
<p n="presentationname" v="Apache Tuscany SCA API"/>
<p n="symbolicname" v="org.apache.tuscany.sca.api"/>
<p n="version" t="version" v="2.0.0"/>
</capability>
−
<capability name="package">
<p n="package" v="org.oasisopen.sca.annotation"/>
<p n="version" t="version" v="2.0.0"/>
</capability>
−
<capability name="package">
<p n="package" v="org.oasisopen.sca"/>
<p n="uses" v="javax.security.auth"/>
<p n="version" t="version" v="2.0.0"/>
</capability>
−
<capability name="package">
<p n="package" v="org.oasisopen.sca.client"/>
<p n="version" t="version" v="2.0.0"/>
</capability>
<require extend="false"
filter="(&(package=javax.security.auth)(version>=0.0.0))" multiple="false"
name="package" optional="false">Import package
javax.security.auth</require>
<require extend="false"
filter="(&(package=org.oasisopen.sca)(version>=2.0.0))" multiple="false"
name="package" optional="false">Import package org.oasisopen.sca
;version=2.0.0</require>
−
<require extend="false"
filter="(&(package=org.oasisopen.sca.annotation)(version>=2.0.0))"
multiple="false" name="package" optional="false">
Import package org.oasisopen.sca.annotation ;version=2.0.0
</require>
−
<require extend="false"
filter="(&(package=org.oasisopen.sca.client)(version>=2.0.0))"
multiple="false" name="package" optional="false">
Import package org.oasisopen.sca.client ;version=2.0.0
</require>
−
<require extend="false" filter="(|(ee=J2SE-1.5)(ee=JavaSE-1.6))"
multiple="false" name="ee" optional="false">
Execution Environment (|(ee=J2SE-1.5)(ee=JavaSE-1.6))
</require>
</resource>
**************************************************************************************

5) Log Error on Web Management Console:
**************************************************************************************
ERRORCannot Install requested bundles due to unsatisfied
requirementsmartes,
ERROR 0: ee ((|(ee=J2SE-1.5)(ee=JavaSE-1.6)))
**************************************************************************************


Regards,
Miguel A.

--- Cada día sabemos más y entendemos menos. (A. Einstein) ---
***********Internet Email Confidentiality Footer*************
This email and any files transmitted with it are confidential and intended
solely for the use of the organization or individual to whom they are
addressed.  It is expressly forbidden to retransmit or copy email and/or
this  attached files without our permission .  If you are not the
addressee indicated in this message (or responsible for delivery of the
message to such person), you may not copy or deliver this message
to anyone. In such case, you should destroy this message and kindly
notify the sender by reply email. Please advise immediately if you or
your employer does not consent to Internet email for messages of this
kind.  Opinions, conclusions and other information in this message that
do not relate to the official business of my firm shall be understood as
neither given nor endorsed by it.

Re: NoClassDefFoundError

Posted by Alexander Blotny <Al...@fokus.fraunhofer.de>.
Thanks.

I tried it with the current trunk and it works.


Am 10.07.09 14:23 schrieb "Karl Pauls" unter <ka...@gmail.com>:

> Can you try again with the current trunk?
> 
> regards,
> 
> Karl
> 
> On Fri, Jul 10, 2009 at 2:03 PM, Alexander
> Blotny<Al...@fokus.fraunhofer.de> wrote:
>> Hi,
>> 
>> I have a problem using Apache Felix.
>> A class can not be loaded but it is imported and exported correctly, so the
>> ClassLoader should find it. Maybe someone has an idea how I can find out
>> what the problem is?
>> 
>> The log:
>> 
>> ERROR: Error starting file:test_bundles/sipsee.jar
>> (org.osgi.framework.BundleException: Activator start error in bundle sipsee
>> [10].)
>> java.lang.NoClassDefFoundError: javax/servlet/ServletException
>>        at java.lang.ClassLoader.defineClass1(Native Method)
>>        at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
>>        at
>> org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.findCla
>> ss(ModuleImpl.java:1556)
>>        at
>> org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDele
>> gation(ModuleImpl.java:562)
>>        at
>> org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.jav
>> a:59)
>>        at
>> org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadCla
>> ss(ModuleImpl.java:1446)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>        at
>> org.apache.felix.framework.searchpolicy.ModuleImpl.getClassByDelegation(Modu
>> leImpl.java:481)
>>        at
>> org.apache.felix.framework.searchpolicy.R4Wire.getClass(R4Wire.java:108)
>>        at
>> org.apache.felix.framework.searchpolicy.ModuleImpl.searchImports(ModuleImpl.
>> java:1184)
>>        at
>> org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDele
>> gation(ModuleImpl.java:557)
>>        at
>> org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.jav
>> a:59)
>>        at
>> org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadCla
>> ss(ModuleImpl.java:1446)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>>        at
>> de.fhg.fokus.sipsee.servlet.SipSeeServletSipContext.initApplicationContext(S
>> ipSeeServletSipContext.java:915)
>>        at
>> de.fhg.fokus.sipsee.servlet.SipSeeServletSipContext.<init>(SipSeeServletSipC
>> ontext.java:250)
>>        at
>> de.fhg.fokus.sipsee.servlet.sip.SipApplicationContext.<init>(SipApplicationC
>> ontext.java:161)
>>        at
>> de.fhg.fokus.sipsee.servlet.sip.ims.SipSeeIMSApplicationContext.<init>(SipSe
>> eIMSApplicationContext.java:92)
>>        at
>> de.fhg.fokus.sipsee.servlet.sip.ims.SipSeeIMSApplicationContextFactory.creat
>> eContext(SipSeeIMSApplicationContextFactory.java:53)
>>        at
>> de.fhg.fokus.sipsee.SipSeeServer.addApplication(SipSeeServer.java:669)
>>        at
>> de.fhg.fokus.sipsee.ims.SipSeeIMSServer.addApplication(SipSeeIMSServer.java:
>> 1460)
>>        at
>> de.fhg.fokus.sipsee.SipSeeServer.addApplication(SipSeeServer.java:695)
>>        at
>> de.fhg.fokus.sipsee.ims.SipSeeIMSServer.addApplication(SipSeeIMSServer.java:
>> 1473)
>>        at
>> de.fhg.fokus.scxml.impl.sipsee.SipseeActivator.start(SipseeActivator.java:30
>> )
>>        at
>> org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.jav
>> a:589)
>>        at org.apache.felix.framework.Felix.startBundle(Felix.java:1458)
>>        at
>> org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:984)
>>        at
>> org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:263)
>>        at java.lang.Thread.run(Thread.java:619)
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>> 
>> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: NoClassDefFoundError

Posted by Karl Pauls <ka...@gmail.com>.
Can you try again with the current trunk?

regards,

Karl

On Fri, Jul 10, 2009 at 2:03 PM, Alexander
Blotny<Al...@fokus.fraunhofer.de> wrote:
> Hi,
>
> I have a problem using Apache Felix.
> A class can not be loaded but it is imported and exported correctly, so the
> ClassLoader should find it. Maybe someone has an idea how I can find out
> what the problem is?
>
> The log:
>
> ERROR: Error starting file:test_bundles/sipsee.jar
> (org.osgi.framework.BundleException: Activator start error in bundle sipsee
> [10].)
> java.lang.NoClassDefFoundError: javax/servlet/ServletException
>        at java.lang.ClassLoader.defineClass1(Native Method)
>        at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
>        at
> org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.findCla
> ss(ModuleImpl.java:1556)
>        at
> org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDele
> gation(ModuleImpl.java:562)
>        at
> org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.jav
> a:59)
>        at
> org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadCla
> ss(ModuleImpl.java:1446)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>        at
> org.apache.felix.framework.searchpolicy.ModuleImpl.getClassByDelegation(Modu
> leImpl.java:481)
>        at
> org.apache.felix.framework.searchpolicy.R4Wire.getClass(R4Wire.java:108)
>        at
> org.apache.felix.framework.searchpolicy.ModuleImpl.searchImports(ModuleImpl.
> java:1184)
>        at
> org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDele
> gation(ModuleImpl.java:557)
>        at
> org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.jav
> a:59)
>        at
> org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadCla
> ss(ModuleImpl.java:1446)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>        at
> de.fhg.fokus.sipsee.servlet.SipSeeServletSipContext.initApplicationContext(S
> ipSeeServletSipContext.java:915)
>        at
> de.fhg.fokus.sipsee.servlet.SipSeeServletSipContext.<init>(SipSeeServletSipC
> ontext.java:250)
>        at
> de.fhg.fokus.sipsee.servlet.sip.SipApplicationContext.<init>(SipApplicationC
> ontext.java:161)
>        at
> de.fhg.fokus.sipsee.servlet.sip.ims.SipSeeIMSApplicationContext.<init>(SipSe
> eIMSApplicationContext.java:92)
>        at
> de.fhg.fokus.sipsee.servlet.sip.ims.SipSeeIMSApplicationContextFactory.creat
> eContext(SipSeeIMSApplicationContextFactory.java:53)
>        at
> de.fhg.fokus.sipsee.SipSeeServer.addApplication(SipSeeServer.java:669)
>        at
> de.fhg.fokus.sipsee.ims.SipSeeIMSServer.addApplication(SipSeeIMSServer.java:
> 1460)
>        at
> de.fhg.fokus.sipsee.SipSeeServer.addApplication(SipSeeServer.java:695)
>        at
> de.fhg.fokus.sipsee.ims.SipSeeIMSServer.addApplication(SipSeeIMSServer.java:
> 1473)
>        at
> de.fhg.fokus.scxml.impl.sipsee.SipseeActivator.start(SipseeActivator.java:30
> )
>        at
> org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.jav
> a:589)
>        at org.apache.felix.framework.Felix.startBundle(Felix.java:1458)
>        at
> org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:984)
>        at
> org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:263)
>        at java.lang.Thread.run(Thread.java:619)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>



-- 
Karl Pauls
karlpauls@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: NoClassDefFoundError

Posted by "Richard S. Hall" <he...@ungoverned.org>.
You need to give us more information, such as the manifests of the 
bundles involved and perhaps a "jar tf" of them as well.

-> richard

On 7/10/09 8:03 AM, Alexander Blotny wrote:
> Hi,
>
> I have a problem using Apache Felix.
> A class can not be loaded but it is imported and exported correctly, so the
> ClassLoader should find it. Maybe someone has an idea how I can find out
> what the problem is?
>
> The log:
>
> ERROR: Error starting file:test_bundles/sipsee.jar
> (org.osgi.framework.BundleException: Activator start error in bundle sipsee
> [10].)
> java.lang.NoClassDefFoundError: javax/servlet/ServletException
>          at java.lang.ClassLoader.defineClass1(Native Method)
>          at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
>          at
> org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.findCla
> ss(ModuleImpl.java:1556)
>          at
> org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDele
> gation(ModuleImpl.java:562)
>          at
> org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.jav
> a:59)
>          at
> org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadCla
> ss(ModuleImpl.java:1446)
>          at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>          at
> org.apache.felix.framework.searchpolicy.ModuleImpl.getClassByDelegation(Modu
> leImpl.java:481)
>          at
> org.apache.felix.framework.searchpolicy.R4Wire.getClass(R4Wire.java:108)
>          at
> org.apache.felix.framework.searchpolicy.ModuleImpl.searchImports(ModuleImpl.
> java:1184)
>          at
> org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDele
> gation(ModuleImpl.java:557)
>          at
> org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.jav
> a:59)
>          at
> org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadCla
> ss(ModuleImpl.java:1446)
>          at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>          at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>          at
> de.fhg.fokus.sipsee.servlet.SipSeeServletSipContext.initApplicationContext(S
> ipSeeServletSipContext.java:915)
>          at
> de.fhg.fokus.sipsee.servlet.SipSeeServletSipContext.<init>(SipSeeServletSipC
> ontext.java:250)
>          at
> de.fhg.fokus.sipsee.servlet.sip.SipApplicationContext.<init>(SipApplicationC
> ontext.java:161)
>          at
> de.fhg.fokus.sipsee.servlet.sip.ims.SipSeeIMSApplicationContext.<init>(SipSe
> eIMSApplicationContext.java:92)
>          at
> de.fhg.fokus.sipsee.servlet.sip.ims.SipSeeIMSApplicationContextFactory.creat
> eContext(SipSeeIMSApplicationContextFactory.java:53)
>          at
> de.fhg.fokus.sipsee.SipSeeServer.addApplication(SipSeeServer.java:669)
>          at
> de.fhg.fokus.sipsee.ims.SipSeeIMSServer.addApplication(SipSeeIMSServer.java:
> 1460)
>          at
> de.fhg.fokus.sipsee.SipSeeServer.addApplication(SipSeeServer.java:695)
>          at
> de.fhg.fokus.sipsee.ims.SipSeeIMSServer.addApplication(SipSeeIMSServer.java:
> 1473)
>          at
> de.fhg.fokus.scxml.impl.sipsee.SipseeActivator.start(SipseeActivator.java:30
> )
>          at
> org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.jav
> a:589)
>          at org.apache.felix.framework.Felix.startBundle(Felix.java:1458)
>          at
> org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:984)
>          at
> org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:263)
>          at java.lang.Thread.run(Thread.java:619)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>    

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: commons-mail with apache felix

Posted by Guillaume Nodet <gn...@gmail.com>.
Have a look at servicemix bundles:

http://repo2.maven.org/maven2/org/apache/servicemix/bundles/org.apache.servicemix.bundles.javax.mail/1.4.1_2/org.apache.servicemix.bundles.javax.mail-1.4.1_2.jar

It has been modified to work in OSGi.

On Thu, Mar 18, 2010 at 11:38, Alexander Blotny <
Alexander.Blotny@fokus.fraunhofer.de> wrote:

> 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
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Re: commons-mail with apache felix

Posted by Alexander Blotny <Al...@fokus.fraunhofer.de>.
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
<Al...@fokus.fraunhofer.de>:

> 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: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


commons-mail with apache felix

Posted by Alexander Blotny <Al...@fokus.fraunhofer.de>.
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

NoClassDefFoundError

Posted by Alexander Blotny <Al...@fokus.fraunhofer.de>.
Hi,

I have a problem using Apache Felix.
A class can not be loaded but it is imported and exported correctly, so the
ClassLoader should find it. Maybe someone has an idea how I can find out
what the problem is?

The log:

ERROR: Error starting file:test_bundles/sipsee.jar
(org.osgi.framework.BundleException: Activator start error in bundle sipsee
[10].)
java.lang.NoClassDefFoundError: javax/servlet/ServletException
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
        at 
org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.findCla
ss(ModuleImpl.java:1556)
        at 
org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDele
gation(ModuleImpl.java:562)
        at 
org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.jav
a:59)
        at 
org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadCla
ss(ModuleImpl.java:1446)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at 
org.apache.felix.framework.searchpolicy.ModuleImpl.getClassByDelegation(Modu
leImpl.java:481)
        at 
org.apache.felix.framework.searchpolicy.R4Wire.getClass(R4Wire.java:108)
        at 
org.apache.felix.framework.searchpolicy.ModuleImpl.searchImports(ModuleImpl.
java:1184)
        at 
org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDele
gation(ModuleImpl.java:557)
        at 
org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.jav
a:59)
        at 
org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadCla
ss(ModuleImpl.java:1446)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
        at 
de.fhg.fokus.sipsee.servlet.SipSeeServletSipContext.initApplicationContext(S
ipSeeServletSipContext.java:915)
        at 
de.fhg.fokus.sipsee.servlet.SipSeeServletSipContext.<init>(SipSeeServletSipC
ontext.java:250)
        at 
de.fhg.fokus.sipsee.servlet.sip.SipApplicationContext.<init>(SipApplicationC
ontext.java:161)
        at 
de.fhg.fokus.sipsee.servlet.sip.ims.SipSeeIMSApplicationContext.<init>(SipSe
eIMSApplicationContext.java:92)
        at 
de.fhg.fokus.sipsee.servlet.sip.ims.SipSeeIMSApplicationContextFactory.creat
eContext(SipSeeIMSApplicationContextFactory.java:53)
        at 
de.fhg.fokus.sipsee.SipSeeServer.addApplication(SipSeeServer.java:669)
        at 
de.fhg.fokus.sipsee.ims.SipSeeIMSServer.addApplication(SipSeeIMSServer.java:
1460)
        at 
de.fhg.fokus.sipsee.SipSeeServer.addApplication(SipSeeServer.java:695)
        at 
de.fhg.fokus.sipsee.ims.SipSeeIMSServer.addApplication(SipSeeIMSServer.java:
1473)
        at 
de.fhg.fokus.scxml.impl.sipsee.SipseeActivator.start(SipseeActivator.java:30
)
        at 
org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.jav
a:589)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1458)
        at 
org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:984)
        at 
org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:263)
        at java.lang.Thread.run(Thread.java:619)


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Possible problem with Maven-bundle-plugin and remote OBR repository and Bundle-RequiredExecutionEnvironment info

Posted by Stuart McCulloch <mc...@gmail.com>.
2009/7/7 <mi...@telvent.com>

>
> Hi all,
>
> I will try to show you the whole scenario related with the remote
> deployment (install) of an artifact from the Apache Felix Web Management
> Console within the OSGi Repository Tab.
>
> I do not know if the problem will be related with the Maven-bundle-plugin
> vesion 2.0.0 when publishing in a remote OBR repository a component (and
> updating the new component information), or related with Apache Felix
> Bundle Repository version 1.4.0 during the process of dependencies
> resolution, or a mixture of both.
>
> The problem seems to appear when a bundle with the Manifest header
> Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6 present. In this
> case, when publishing the information in the remote OBR repository using
> the Maven-bundle-plugin (see 2), it is included a <require> information
> related with the execution environment in the repository.xml file (see 4).
> Then when you try to deploy the bundle version from the Web Management
> Console the Apache Felix Bundle Repository it is not able to resolve this
> dependency, and the deployment process is not satisfactory concluded (see
> error Log in 5).
>
> If you try to install the artifact manually from an URL location it works.
>
> I think that or the <require> clause related to the manifest headers entry
> Bundle-RequiredExecutionEnvironment should not be considered when
> publishing information in the remote OBR repository, or the Apache Felix
> Bundle Repository bundle should ignore this dependency clause when
> resolving the dependencies related to a certain bundle.
>
> Any suggestions?
>

this is a bug in the bundlerepository implementation:

  http://issues.apache.org/jira/browse/FELIX-575

as the execution environment is a valid requirement
(you don't want to consider bundles you can't use)


> 1) Felix components:
>
> **************************************************************************************
> [   0] [Active     ] [    0] System Bundle (1.8.0)
> [   1] [Active     ] [    1] Apache Felix Shell Service (1.2.0)
> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.2.0)
> [   3] [Active     ] [    1] Apache Felix Bundle Repository (1.4.0)
>
> **************************************************************************************
>
> 2) Remote OBR deployment command:
>
> **************************************************************************************
> mvn org.apache.felix:maven-bundle-plugin:2.0.0:deploy-file
> -DgroupId=org.apache.tuscany -DartifactId=tuscany-sca-api -Dversion=2.0-M3
> -Dpackaging=bundle -Dfile=tuscany-sca-api-2.0-M3.jar -DrepositoryId=nexus
> -Durl=http://www.xxxxx.es:8081/nexus/content/repositories/releases
>
> -DbundleUrl=http://www.xxxxx.es:8081/nexus/content/repositories/releases/org/apache/tuscany/tuscany-sca-api/2.0-M3/tuscany-sca-api-2.0-M3.jar<http://www.xxxxx.es:8081/nexus/content/repositories/releases%0A-DbundleUrl=http://www.xxxxx.es:8081/nexus/content/repositories/releases/org/apache/tuscany/tuscany-sca-api/2.0-M3/tuscany-sca-api-2.0-M3.jar>
>
> **************************************************************************************
>
> 3) MANIFEST.MF content:
>
> **************************************************************************************
> Import-Package: javax.security.auth,org.oasisopen.sca;version="2.0.0",
>  org.oasisopen.sca.annotation;version="2.0.0",org.oasisopen.sca.client
>  ;version="2.0.0"
> Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6
>
> **************************************************************************************
>
> 4) Repository.xml content:
>
> **************************************************************************************
> <resource id="org.apache.tuscany.sca.api/2.0.0" presentationname="Apache
> Tuscany SCA API" symbolicname="org.apache.tuscany.sca.api"
> uri="
> http://www.xxxxxx.com:8081/nexus/content/repositories/releases/org/apache/tuscany/tuscany-sca-api/2.0-M3/tuscany-sca-api-2.0-M3.jar
> "
>  version="2.0.0">
> <description>API classes for the Service Component
> Architecture</description>
> <size>31019</size>
> <documentation>http://www.apache.org/</documentation>
> <license>http://www.apache.org/licenses/LICENSE-2.0.txt</license>
> <category id="org.apache.tuscany"/>
> -
> <capability name="bundle">
> <p n="manifestversion" v="2"/>
> <p n="presentationname" v="Apache Tuscany SCA API"/>
> <p n="symbolicname" v="org.apache.tuscany.sca.api"/>
> <p n="version" t="version" v="2.0.0"/>
> </capability>
> -
> <capability name="package">
> <p n="package" v="org.oasisopen.sca.annotation"/>
> <p n="version" t="version" v="2.0.0"/>
> </capability>
> -
> <capability name="package">
> <p n="package" v="org.oasisopen.sca"/>
> <p n="uses" v="javax.security.auth"/>
> <p n="version" t="version" v="2.0.0"/>
> </capability>
> -
> <capability name="package">
> <p n="package" v="org.oasisopen.sca.client"/>
> <p n="version" t="version" v="2.0.0"/>
> </capability>
> <require extend="false"
> filter="(&(package=javax.security.auth)(version>=0.0.0))" multiple="false"
> name="package" optional="false">Import package
> javax.security.auth</require>
> <require extend="false"
> filter="(&(package=org.oasisopen.sca)(version>=2.0.0))" multiple="false"
> name="package" optional="false">Import package org.oasisopen.sca
> ;version=2.0.0</require>
> -
> <require extend="false"
> filter="(&(package=org.oasisopen.sca.annotation)(version>=2.0.0))"
> multiple="false" name="package" optional="false">
> Import package org.oasisopen.sca.annotation ;version=2.0.0
> </require>
> -
> <require extend="false"
> filter="(&(package=org.oasisopen.sca.client)(version>=2.0.0))"
> multiple="false" name="package" optional="false">
> Import package org.oasisopen.sca.client ;version=2.0.0
> </require>
> -
> <require extend="false" filter="(|(ee=J2SE-1.5)(ee=JavaSE-1.6))"
> multiple="false" name="ee" optional="false">
> Execution Environment (|(ee=J2SE-1.5)(ee=JavaSE-1.6))
> </require>
> </resource>
>
> **************************************************************************************
>
> 5) Log Error on Web Management Console:
>
> **************************************************************************************
> ERRORCannot Install requested bundles due to unsatisfied
> requirementsmartes,
> ERROR 0: ee ((|(ee=J2SE-1.5)(ee=JavaSE-1.6)))
>
> **************************************************************************************
>
>
> Regards,
> Miguel A.
>
> --- Cada día sabemos más y entendemos menos. (A. Einstein) ---
> ***********Internet Email Confidentiality Footer*************
> This email and any files transmitted with it are confidential and intended
> solely for the use of the organization or individual to whom they are
> addressed.  It is expressly forbidden to retransmit or copy email and/or
> this  attached files without our permission .  If you are not the
> addressee indicated in this message (or responsible for delivery of the
> message to such person), you may not copy or deliver this message
> to anyone. In such case, you should destroy this message and kindly
> notify the sender by reply email. Please advise immediately if you or
> your employer does not consent to Internet email for messages of this
> kind.  Opinions, conclusions and other information in this message that
> do not relate to the official business of my firm shall be understood as
> neither given nor endorsed by it.


-- 
Cheers, Stuart