Hmmmmm. I got it:
I have to wait for the service to be available. The following worked:
Bundle online_manipulator =
bundleContext1.installBundle("http://central.maven.org/maven2/org/apache/felix/org.apache.felix.ipojo.manipulator.online/1.11.1/org.apache.felix.ipojo.manipulator.online-1.11.1.jar");
online_manipulator.start();
if(online_manipulator .getState()== Bundle.ACTIVE)
System.out.println("URL Handler Bundle is Active!");
Thread.sleep(100); //WAIT FOR SERVICE
Bundle M =
bundleContext1.installBundle("ipojo:file:C:\\Users\\zaid.almahmoud\\Desktop\\plugins\\PlainHelloiPOJO_1.0.0.201403081557.jar");
M.start();
This shows:
URL Handler Bundle is Active!
Processing URL :
ipojo:file:C:\Users\zaid.almahmoud\Desktop\plugins\PlainHelloiPOJO_1.0.0.201403081557.jar
Extracted URL :
file:C:\Users\zaid.almahmoud\Desktop\plugins\PlainHelloiPOJO_1.0.0.201403081557.jar
765171 bytes copied
Metadata file not found, use annotations only.
I Apache Felix iPOJO Manipulator - 1.11.1
Manipulation done : true
Plain Hello iPOJO Bundle Started!
in contructor
Hello, this is the plain hello component start method
Thanks a lot for your help.
Zaid
-----Original Message-----
From: Clement Escoffier [mailto:[email protected]]
Sent: 09 آذار, 2014 01:23 م
To: Apache Felix - Users Mailing List
Subject: Re: Creating PrimitiveComponentType without importing iPOJO required
Packages
Weird, can you check that the ‘URLStreamHandlerService’ service is exposed
after having deployed the url handler bundle ?
Clement
On 9 mars 2014, at 10:09, Zaid Jamal Saeed Al Mahmoud
<[email protected]> wrote:
> Thanks for your reply,
>
> But still. I did what you said, and got the same error again. Here's
> my exact code
>
> Bundle online_manipulator =
> bundleContext1.installBundle("http://central.maven.org/maven2/org/apache/felix/org.apache.felix.ipojo.manipulator.online/1.11.1/org.apache.felix.ipojo.manipulator.online-1.11.1.jar");
> online_manipulator.start();
> if(online_manipulator .getState()== Bundle.ACTIVE)
> System.out.println("URL Handler Bundle is
> Active!");
>
>
> Bundle M =
> bundleContext1.installBundle("ipojo:file:C:\\Users\\zaid.almahmoud\\Desktop\\plugins\\PlainHelloiPOJO_1.0.0.201403081557.jar");
> M.start();
>
>
> This shows:
>
> URL Handler Bundle is Active!
> Exception in thread "main" org.osgi.framework.BundleException: Unable to
> cache bundle:
> ipojo:file:C:\Users\zaid.almahmoud\Desktop\plugins\PlainHelloiPOJO_1.0.0.201403081557.jar
> at org.apache.felix.framework.Felix.installBundle(Felix.java:2870)
> at
> org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:165)
> at
> org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:138)
> at embedder.HostApplication.<init>(HostApplication.java:88)
> at embedder.Embedder.main(Embedder.java:13)
> Caused by: java.net.MalformedURLException: Unknown protocol: ipojo
> at java.net.URL.<init>(URL.java:601)
> at
> org.apache.felix.framework.util.SecureAction.createURL(SecureAction.java:254)
> at
> org.apache.felix.framework.cache.JarRevision.initialize(JarRevision.java:148)
> at
> org.apache.felix.framework.cache.JarRevision.<init>(JarRevision.java:77)
> at
> org.apache.felix.framework.cache.BundleArchive.createRevisionFromLocation(BundleArchive.java:878)
> at
> org.apache.felix.framework.cache.BundleArchive.reviseInternal(BundleArchive.java:550)
> at
> org.apache.felix.framework.cache.BundleArchive.<init>(BundleArchive.java:153)
> at
> org.apache.felix.framework.cache.BundleCache.create(BundleCache.java:277)
> at org.apache.felix.framework.Felix.installBundle(Felix.java:2866)
> ... 4 more
>
>
>
>
> Zaid
> -----Original Message-----
> From: Clement Escoffier [mailto:[email protected]]
> Sent: 09 آذار, 2014 12:07 م
> To: Apache Felix - Users Mailing List
> Subject: Re: Creating PrimitiveComponentType without importing iPOJO
> required Packages
>
> Hi,
>
> You should use the 1.11.1 version of the online manipulator. Then, your url
> should we ipojo:file:C:\….
>
> Regards,
>
> Clement
>
>
> On 8 mars 2014, at 15:01, Zaid Jamal Saeed Al Mahmoud
> <[email protected]> wrote:
>
>> I tried your solution, by installing and starting the URL Handler,
>> and then adding “ipojo://” part to my bundle installation file path
>> as the following,
>>
>>
>> Bundle online_manipulator =
>> bundleContext1.installBundle("http://repo1.maven.org/maven2/org/apache/felix/org.apache.felix.ipojo.online.manipulator/1.6.0/org.apache.felix.ipojo.online.manipulator-1.6.0.jar");
>> online_manipulator.start();
>> if(online_manipulator .getState()== Bundle.ACTIVE)
>> System.out.println("URL Handler Bundle is
>> Active!");
>>
>> bundleContext.installBundle(“ipojo://file:C:\Users\zaid.almahmoud\Des
>> k
>> top\plugins\MyComponent.jar”);
>>
>>
>> When I run my program, the online manipulator bundle is started
>> successfully, but then I get the following error:
>>
>>
>> org.osgi.framework.BundleException: Unable to cache bundle:
>> ipojo://file:C:\Users\zaid.almahmoud\Desktop\plugins\MyComponent.jar
>> Caused by: java.net.MalformedURLException: Unknown protocol: ipojo
>>
>>
>> What am I missing here? Thanks.
>>
>> -----Original Message-----
>> From: Clement Escoffier [mailto:[email protected]]
>> Sent: 08 آذار, 2014 05:11 م
>> To: Apache Felix - Users Mailing List
>> Subject: Re: Creating PrimitiveComponentType without importing iPOJO
>> required Packages
>>
>> Hi,
>>
>> You need to install the iPOJO url handler alson called online manipulator:
>> http://central.maven.org/maven2/org/apache/felix/org.apache.felix.ipo
>> j
>> o.manipulator.online/1.11.1/org.apache.felix.ipojo.manipulator.online
>> -
>> 1.11.1.jar
>>
>> Move information on:
>> http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/
>> a pache-felix-ipojo-tools/apache-felix-ipojo-online-manipulator.html
>>
>> Regards,
>>
>> Clement
>>
>> On 8 mars 2014, at 12:11, Zaid Jamal Saeed Al Mahmoud
>> <[email protected]> wrote:
>>
>>> Hey, I have the following issue:
>>>
>>> In my OSGI bundle, I create a Component Type using iPOJO API as the
>>> following:
>>>
>>> public void start(BundleContext context) throws Exception {
>>>
>>>
>>> type = new PrimitiveComponentType().setBundleContext(context)
>>> .setComponentTypeName("someType")
>>> .setClassName("my.class.Name")
>>> .setImmediate(true);
>>> type.start();
>>>
>>> instance = type.createInstance();
>>>
>>>
>>>
>>> }
>>>
>>> Now, according to this source,
>>> http://mail-archives.apache.org/mod_mbox/felix-users/201204.mbox/%3C
>>> 1 F [email protected]%3E
>>> iPOJO manipulation rely on some classes of org.apache.felix.ipojo, and so I
>>> need to import this package. All bundles intended to have iPOJO component,
>>> need to import: org.apache.felix.ipojo and
>>> org.apache.felix.ipojo.architecture.
>>>
>>> For some reason, I don’t like to import these packages from my bundle. I
>>> want my bundle to have iPOJO component without importing any iPOJO-related
>>> packages.
>>>
>>> Although the answer in the link continues saying:
>>>
>>> To avoid this manual import you can:
>>> - use the iPOJO url handler and so install the bundle with:
>>> ipojo://file:/the.path.to.my.bundle.jar
>>>
>>> I tried the above solution, by adding “ipojo://” part to my bundle
>>> installation file path as the following,
>>>
>>>
>>> bundleContext.installBundle(“ipojo://file:C:\Users\zaid.almahmoud\De
>>> s
>>> k
>>> top\plugins\MyComponent.jar”);
>>>
>>>
>>> but when I run my program, I get the following error:
>>>
>>>
>>> org.osgi.framework.BundleException: Unable to cache bundle:
>>> ipojo://file:C:\Users\zaid.almahmoud\Desktop\plugins\MyComponent.jar
>>> Caused by: java.net.MalformedURLException: Unknown protocol: ipojo
>>>
>>>
>>>
>>> What am I missing here? Thanks.
>>>
>>>
>>> Kind Regards,
>>> Zaid Almahmoud
>>> Research Assistant
>>>
>>> Khalifa University of Science, Technology, and Research Abu Dhabi -
>>> United Arab Emirates
>>> TEL: 00971-2-401-8178
>>> MOB: 00971-50-9619601
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]