You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Garrett Headley <gc...@yahoo.com> on 2007/09/18 18:52:36 UTC

Import-Package problems

Hey there

I have a question about the Import-Package attribute in the manifest file.  For a simple example, I modified the extenderbased.circle such that instead of drawing the circle, I tried to load the png from the file to draw the icon to the frame (in the draw method of Circle).  So, using javax.imageio.ImageIO to read the image in, I had to import a non-java.xxx package.  So, I placed "Import-Package: javax.imageio.ImageIO" in my manifest file.  However, now when the circle bundle is loaded, I get the host of exceptions following the "ClassNotFound" exception for javax.imageio.ImageIO.  I have no trouble importing the SimpleShape interface with it's package name as an attribute, but for some reason it's not working with the javax.* packages.

Should be pretty easy to reproduce... I'm using java 1.5SE. 

Thanks in advance for any help
Garrett

       
---------------------------------
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more. 

Re: Import-Package problems

Posted by Garrett Headley <gc...@yahoo.com>.
Hey Richard, 

Thanks for the help... that did the trick.  I have another question, but will post under another subject

Thanks
Garrett

"Richard S. Hall" <he...@ungoverned.org> wrote: Garrett Headley wrote:
> I was actually trying to use ANT, but I went back and ran the same 
> simulation, but used Maven instead.  So, the manifest file (from the jar):
>
> Manifest-Version: 1.0
> Extension-Icon: org/apache/felix/example/extenderbased/circle/circle.png
> Created-By: 1.5.0_11 (Sun Microsystems Inc.)
> Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
> Import-Package: 
> javax.imageio,javax.swing,org.apache.felix.example.extenderbased.host.extension
> Include-Resource: src\main\resources
> Bnd-LastModified: 1190148057592
> Bundle-Version: 1.0.0
> Bundle-Name: Apache Felix Circle Extension
> Bundle-Description: A simple extension for drawing circles.
> Private-Package: org.apache.felix.example.extenderbased.circle
> Bundle-DocURL: http://www.apache.org/
> Bundle-ManifestVersion: 2
> Bundle-Vendor: The Apache Software Foundation
> Bundle-SymbolicName: org.apache.felix.example.extenderbased.circle
> Tool: Bnd-0.0.160
> Extension-Name: Circle
> Extension-Class: org.apache.felix.example.extenderbased.circle.Circle
>
> And the exception list:
>
> ERROR: Error starting 
> file:extenderbased.circle/target/extenderbased.circle-1.0.0.jar 
> (org.osgi.framework.BundleException: Unresolved package in bundle 1: 
> package; (package=javax.imageio))
> org.osgi.framework.BundleException: Unresolved package in bundle 1: 
> package; (package=javax.imageio)
>     at org.apache.felix.framework.Felix._resolveBundle(Felix.java:1649)
>     at org.apache.felix.framework.Felix._startBundle(Felix.java:1516)
>     at org.apache.felix.framework.Felix.startBundle(Felix.java:1469)
>     at 
> org.apache.felix.framework.Felix.setFrameworkStartLevel(Felix.java:1064)
>     at 
> org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:258)
>     at java.lang.Thread.run(Thread.java:595)

This error looks pretty normal. The bundle cannot be started because no 
one is exporting the javax.imageio package. How are you starting the 
example?

If you are manually installing the bundles from your standard Felix 
directory (e.g., java -jar bin/felix.jar) then you should be getting 
this package exported for you automatically from the class path by the 
system bundle. If you look in conf/config.properties, you can see that 
Felix sets the default value of org.osgi.framework.system.packages to be 
all public packages in the underlying JRE.

If you are starting this using the custom launcher of the extender host 
(i.e., starting an embedded instance of Felix), then this example code 
is simplified and only exports a few packages from the class path. You 
will need to go to the static main() in Activator.java of the extender 
host and add "javax.imageio" to the packages it exports.

If this is your scenario, you can simply switch to using "java -jar 
bin/felix.jar" in your Felix install directory and manually installing 
the bundles and everything should work fine, I would guess.

-> richard

>
> Also, I attached the modified Circle.java
>
> Thanks for the help... much appriciated
> Garrett
>
>
> */"Richard S. Hall" /* wrote:
>
>     I take it you are not using the Maven build files? If so, you
>     shouldn't
>     have to add anything to the manifest, because it is generated for you.
>
>     It might help to see your manifest along with the exceptions you are
>     getting.
>
>     -> richard
>
>     Garrett Headley wrote:
>     > Hey there
>     >
>     > I have a question about the Import-Package attribute in the
>     manifest file. For a simple example, I modified the
>     extenderbased.circle such that instead of drawing the circle, I
>     tried to load the png from the file to draw the icon to the frame
>     (in the draw method of Circle). So, using javax.imageio.ImageIO to
>     read the image in, I had to import a non-java.xxx package. So, I
>     placed "Import-Package: javax.imageio.ImageIO" in my manifest
>     file. However, now when the circle bundle is loaded, I get the
>     host of exceptions following the "ClassNotFound" exception for
>     javax.imageio.ImageIO. I have no trouble importing the SimpleShape
>     interface with it's package name as an attribute, but for some
>     reason it's not working with the javax.* packages.
>     >
>     > Should be pretty easy to reproduce... I'm using java 1.5SE.
>     >
>     > Thanks in advance for any help
>     > Garrett
>     >
>     >
>     > ---------------------------------
>     > Take the Internet to Go: Yahoo!Go puts the Internet in your
>     pocket: mail, news, photos & more.
>     >
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>     For additional commands, e-mail: users-help@felix.apache.org
>
>
> ------------------------------------------------------------------------
> Luggage? GPS? Comic books?
> Check out fitting gifts for grads 
>  
> at Yahoo! Search.
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> 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



       
---------------------------------
Luggage? GPS? Comic books? 
Check out fitting  gifts for grads at Yahoo! Search.

Re: Import-Package problems

Posted by "Richard S. Hall" <he...@ungoverned.org>.
Garrett Headley wrote:
> I was actually trying to use ANT, but I went back and ran the same 
> simulation, but used Maven instead.  So, the manifest file (from the jar):
>
> Manifest-Version: 1.0
> Extension-Icon: org/apache/felix/example/extenderbased/circle/circle.png
> Created-By: 1.5.0_11 (Sun Microsystems Inc.)
> Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
> Import-Package: 
> javax.imageio,javax.swing,org.apache.felix.example.extenderbased.host.extension
> Include-Resource: src\main\resources
> Bnd-LastModified: 1190148057592
> Bundle-Version: 1.0.0
> Bundle-Name: Apache Felix Circle Extension
> Bundle-Description: A simple extension for drawing circles.
> Private-Package: org.apache.felix.example.extenderbased.circle
> Bundle-DocURL: http://www.apache.org/
> Bundle-ManifestVersion: 2
> Bundle-Vendor: The Apache Software Foundation
> Bundle-SymbolicName: org.apache.felix.example.extenderbased.circle
> Tool: Bnd-0.0.160
> Extension-Name: Circle
> Extension-Class: org.apache.felix.example.extenderbased.circle.Circle
>
> And the exception list:
>
> ERROR: Error starting 
> file:extenderbased.circle/target/extenderbased.circle-1.0.0.jar 
> (org.osgi.framework.BundleException: Unresolved package in bundle 1: 
> package; (package=javax.imageio))
> org.osgi.framework.BundleException: Unresolved package in bundle 1: 
> package; (package=javax.imageio)
>     at org.apache.felix.framework.Felix._resolveBundle(Felix.java:1649)
>     at org.apache.felix.framework.Felix._startBundle(Felix.java:1516)
>     at org.apache.felix.framework.Felix.startBundle(Felix.java:1469)
>     at 
> org.apache.felix.framework.Felix.setFrameworkStartLevel(Felix.java:1064)
>     at 
> org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:258)
>     at java.lang.Thread.run(Thread.java:595)

This error looks pretty normal. The bundle cannot be started because no 
one is exporting the javax.imageio package. How are you starting the 
example?

If you are manually installing the bundles from your standard Felix 
directory (e.g., java -jar bin/felix.jar) then you should be getting 
this package exported for you automatically from the class path by the 
system bundle. If you look in conf/config.properties, you can see that 
Felix sets the default value of org.osgi.framework.system.packages to be 
all public packages in the underlying JRE.

If you are starting this using the custom launcher of the extender host 
(i.e., starting an embedded instance of Felix), then this example code 
is simplified and only exports a few packages from the class path. You 
will need to go to the static main() in Activator.java of the extender 
host and add "javax.imageio" to the packages it exports.

If this is your scenario, you can simply switch to using "java -jar 
bin/felix.jar" in your Felix install directory and manually installing 
the bundles and everything should work fine, I would guess.

-> richard

>
> Also, I attached the modified Circle.java
>
> Thanks for the help... much appriciated
> Garrett
>
>
> */"Richard S. Hall" <he...@ungoverned.org>/* wrote:
>
>     I take it you are not using the Maven build files? If so, you
>     shouldn't
>     have to add anything to the manifest, because it is generated for you.
>
>     It might help to see your manifest along with the exceptions you are
>     getting.
>
>     -> richard
>
>     Garrett Headley wrote:
>     > Hey there
>     >
>     > I have a question about the Import-Package attribute in the
>     manifest file. For a simple example, I modified the
>     extenderbased.circle such that instead of drawing the circle, I
>     tried to load the png from the file to draw the icon to the frame
>     (in the draw method of Circle). So, using javax.imageio.ImageIO to
>     read the image in, I had to import a non-java.xxx package. So, I
>     placed "Import-Package: javax.imageio.ImageIO" in my manifest
>     file. However, now when the circle bundle is loaded, I get the
>     host of exceptions following the "ClassNotFound" exception for
>     javax.imageio.ImageIO. I have no trouble importing the SimpleShape
>     interface with it's package name as an attribute, but for some
>     reason it's not working with the javax.* packages.
>     >
>     > Should be pretty easy to reproduce... I'm using java 1.5SE.
>     >
>     > Thanks in advance for any help
>     > Garrett
>     >
>     >
>     > ---------------------------------
>     > Take the Internet to Go: Yahoo!Go puts the Internet in your
>     pocket: mail, news, photos & more.
>     >
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>     For additional commands, e-mail: users-help@felix.apache.org
>
>
> ------------------------------------------------------------------------
> Luggage? GPS? Comic books?
> Check out fitting gifts for grads 
> <http://us.rd.yahoo.com/evt=48249/*http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz> 
> at Yahoo! Search.
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> 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: Import-Package problems

Posted by Garrett Headley <gc...@yahoo.com>.
I was actually trying to use ANT, but I went back and ran the same simulation, but used Maven instead.  So, the manifest file (from the jar):

Manifest-Version: 1.0
Extension-Icon: org/apache/felix/example/extenderbased/circle/circle.png
Created-By: 1.5.0_11 (Sun Microsystems Inc.)
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
Import-Package: javax.imageio,javax.swing,org.apache.felix.example.extenderbased.host.extension
Include-Resource: src\main\resources
Bnd-LastModified: 1190148057592
Bundle-Version: 1.0.0
Bundle-Name: Apache Felix Circle Extension
Bundle-Description: A simple extension for drawing circles.
Private-Package: org.apache.felix.example.extenderbased.circle
Bundle-DocURL: http://www.apache.org/
Bundle-ManifestVersion: 2
Bundle-Vendor: The Apache Software Foundation
Bundle-SymbolicName: org.apache.felix.example.extenderbased.circle
Tool: Bnd-0.0.160
Extension-Name: Circle
Extension-Class: org.apache.felix.example.extenderbased.circle.Circle

And the exception list:

ERROR: Error starting file:extenderbased.circle/target/extenderbased.circle-1.0.0.jar (org.osgi.framework.BundleException: Unresolved package in bundle 1: package; (package=javax.imageio))
org.osgi.framework.BundleException: Unresolved package in bundle 1: package; (package=javax.imageio)
    at org.apache.felix.framework.Felix._resolveBundle(Felix.java:1649)
    at org.apache.felix.framework.Felix._startBundle(Felix.java:1516)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:1469)
    at org.apache.felix.framework.Felix.setFrameworkStartLevel(Felix.java:1064)
    at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:258)
    at java.lang.Thread.run(Thread.java:595)

Also, I attached the modified Circle.java

Thanks for the help... much appriciated
Garrett


"Richard S. Hall" <he...@ungoverned.org> wrote: I take it you are not using the Maven build files? If so, you shouldn't 
have to add anything to the manifest, because it is generated for you.

It might help to see your manifest along with the exceptions you are 
getting.

-> richard

Garrett Headley wrote:
> Hey there
>
> I have a question about the Import-Package attribute in the manifest file.  For a simple example, I modified the extenderbased.circle such that instead of drawing the circle, I tried to load the png from the file to draw the icon to the frame (in the draw method of Circle).  So, using javax.imageio.ImageIO to read the image in, I had to import a non-java.xxx package.  So, I placed "Import-Package: javax.imageio.ImageIO" in my manifest file.  However, now when the circle bundle is loaded, I get the host of exceptions following the "ClassNotFound" exception for javax.imageio.ImageIO.  I have no trouble importing the SimpleShape interface with it's package name as an attribute, but for some reason it's not working with the javax.* packages.
>
> Should be pretty easy to reproduce... I'm using java 1.5SE. 
>
> Thanks in advance for any help
> Garrett
>
>        
> ---------------------------------
> Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more. 
>   

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



       
---------------------------------
Luggage? GPS? Comic books? 
Check out fitting  gifts for grads at Yahoo! Search.

Re: Import-Package problems

Posted by "Richard S. Hall" <he...@ungoverned.org>.
I take it you are not using the Maven build files? If so, you shouldn't 
have to add anything to the manifest, because it is generated for you.

It might help to see your manifest along with the exceptions you are 
getting.

-> richard

Garrett Headley wrote:
> Hey there
>
> I have a question about the Import-Package attribute in the manifest file.  For a simple example, I modified the extenderbased.circle such that instead of drawing the circle, I tried to load the png from the file to draw the icon to the frame (in the draw method of Circle).  So, using javax.imageio.ImageIO to read the image in, I had to import a non-java.xxx package.  So, I placed "Import-Package: javax.imageio.ImageIO" in my manifest file.  However, now when the circle bundle is loaded, I get the host of exceptions following the "ClassNotFound" exception for javax.imageio.ImageIO.  I have no trouble importing the SimpleShape interface with it's package name as an attribute, but for some reason it's not working with the javax.* packages.
>
> Should be pretty easy to reproduce... I'm using java 1.5SE. 
>
> Thanks in advance for any help
> Garrett
>
>        
> ---------------------------------
> Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more. 
>   

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


Re: Import-Package problems

Posted by Karl Pauls <ka...@gmail.com>.
You might want to make that

Import-Package: javax.imageio

it needs to be the package not the Class.

regards,

Karl

On 9/18/07, Garrett Headley <gc...@yahoo.com> wrote:
> Hey there
>
> I have a question about the Import-Package attribute in the manifest file.  For a simple example, I modified the extenderbased.circle such that instead of drawing the circle, I tried to load the png from the file to draw the icon to the frame (in the draw method of Circle).  So, using javax.imageio.ImageIO to read the image in, I had to import a non-java.xxx package.  So, I placed "Import-Package: javax.imageio.ImageIO" in my manifest file.  However, now when the circle bundle is loaded, I get the host of exceptions following the "ClassNotFound" exception for javax.imageio.ImageIO.  I have no trouble importing the SimpleShape interface with it's package name as an attribute, but for some reason it's not working with the javax.* packages.
>
> Should be pretty easy to reproduce... I'm using java 1.5SE.
>
> Thanks in advance for any help
> Garrett
>
>
> ---------------------------------
> Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more.


-- 
Karl Pauls
karlpauls@gmail.com

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