Jay Askren wrote:
I'm working on a open source app using Java Swing.  I want it to be a plugin
based system and thought Felix would be a good way to do that.  I eventually
want to deploy the app using Java Web Start.

My first question is: does this sound like a good use of Felix.

Regarding the plugin-based system, I think it sounds like a good use for Felix. Regarding Java Web Start, I am not sure if someone has done that with Felix, but they did previously with Oscar...seems like it should be do-able.

I'm trying to convert it to use Felix and am having some troubles getting it
to work.  I've gone through the tutorials and have successfully run the
Felix Application Demonstration.  I'm starting off very simple have a the
main Bundle called FamilyTreeJourney.jar which has my activator and creates
a JFrame. The other bundle called OpenMapBundle.jar contains a JPanel which
shows a map using the OpenMap library. At this point.  I'm just trying to
add the panel to the frame using the "extender model". Both Bundles have
various third party dependencies.  I'm using Maven to build the application
just like in the Felix Application Demonstration.

To run the app, I just do go to the command line and type:
java -classpath <third party jar files go here> -jar FamilyTreeJourney.jar

When I run the application, the Frame pops up just fine and the I get an
error when trying to instantiate the JPanel from the OpenMapPlugin bundle:
class com.familytreejourney.FamilyTreeJourneyApp
ERROR: Error starting file:lib/OpenMapPlugin.jar (
org.osgi.framework.BundleException: Unresolved package in bundle 1: package;
(package=com.familytreejourney.gui))
org.osgi.framework.BundleException: Unresolved package in bundle 1: package;
(package=com.familytreejourney.gui)
        at org.apache.felix.framework.Felix._resolveBundle(Felix.java:1650)
        at org.apache.felix.framework.Felix._startBundle(Felix.java:1517)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1470)
        at org.apache.felix.framework.Felix.setFrameworkStartLevel(
Felix.java:1065)
        at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java
:258)
        at java.lang.Thread.run(Thread.java:613)

I was wondering if anyone can help me figure out how to fix this.  My first
guess is that the class path for OpenMapPlugin but can't figure out what I'm
doing incorrectly.

My two pom files for Maven are at the bottom of this emails.  Any help would
be appreciated.  Thanks.

Since you are running this as a hosted Felix instance, the packages exported by your FamilyTreeJourney.jar bundle will not actually be handled by the framework, since it is on the outside of the framework. This means that you will need to add its exported packages to the "org.osgi.framework.system.packages" property, just like we do in the Activator.main() of the example application. Are you doing that?

Ultimately, I would argue that you would be better off doing a bundled application approach, rather than a hosted framework approach. Then you would not have to worry about this issue since all exports and imports would be under control of Felix.

-> richard

Jay


--------------------------
<project>
    <modelVersion>4.0.0</modelVersion>
    <packaging>bundle</packaging>
    <name>Family Tree Journey</name>
    <description>A genealogy application.</description>
    <groupId>com.familytreejourney</groupId>
    <artifactId>familytreejourney</artifactId>
    <version>0.0.1</version>

    <dependencies>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.osgi.core</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.main</artifactId>
            <version>1.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.framework</artifactId>
            <version>1.0.1</version>
        </dependency>
        <dependency>
            <groupId>com.familytreejourney</groupId>
            <artifactId>backend</artifactId>
            <version>0.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.swinglabs</groupId>
            <artifactId>swing-layout</artifactId>
            <version>1.0.3</version>
        </dependency>
        <dependency>
            <groupId>net.java.dev.appframework</groupId>
            <artifactId>appframework</artifactId>
            <version>1.0.3</version>
        </dependency>
        <dependency>
            <groupId>org.swinglabs</groupId>
            <artifactId>swing-worker</artifactId>
            <version>1.1</version>
        </dependency>

    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>1.0.0</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Main-Class>
com.familytreejourney.FamilyTreeJourneyApp</Main-Class>
                        <Import-Package>org.osgi.framework,
org.osgi.service.packageadmin,org.osgi.service.url,
org.osgi.service.startlevel,org.osgi.util.tracker,org.jdesktop.*
,*</Import-Package>
                        <Export-Package>com.familytreejourney.*,
com.familytreejourney.gui</Export-Package>
                        <Private-Package>org.apache.felix.moduleloader.*,
org.apache.felix.framework.*,org.osgi.*</Private-Package>
                        <Bundle-Activator>
com.familytreejourney.bundle.FamilyTreeBundleActivator</Bundle-Activator>
                        <Class-Path>lib/felix.jar
lib/appframework-1.0.3.jarlib/AnimatedTransitions-
0.11.jar lib/backend-0.0.1.jar lib/swing-layout-1.0.3.jar lib/xercesImpl.jar
lib/TimingFramework-1.0.jar lib/swing-worker-1.1.jar
lib/xml-apis.jarlib/h2.jar lib/openmap-
4.6.3.jar lib/swingx-0.9.1.jar</Class-Path>
                    </instructions>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
--------------------------
<project>
    <parent>
        <groupId>org.apache</groupId>
        <artifactId>apache</artifactId>
        <version>4</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <packaging>bundle</packaging>
    <name>Family Tree Journey</name>
    <description>A way to view your ancestors on a map.</description>
    <groupId>com.familytreejourney</groupId>
    <artifactId>OpenMapPlugin</artifactId>
    <version>0.0.1</version>
    <dependencies>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.osgi.core</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.familytreejourney</groupId>
            <artifactId>familytreejourney</artifactId>
            <version>0.0.1</version>
        </dependency>
        <dependency>
            <groupId>net.java.dev.timingframework</groupId>
            <artifactId>timingframework</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>com.jidesoft</groupId>
            <artifactId>jide-oss</artifactId>
            <version>2.0.4</version>
        </dependency>
        <dependency>
            <groupId>org.swinglabs</groupId>
            <artifactId>swingx</artifactId>
            <version>0.9.1</version>
        </dependency>
        <dependency>
            <groupId>com.bbn.openmap</groupId>
            <artifactId>openmap</artifactId>
            <version>4.6.3</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>1.0.0</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Import-Package>com.familytreejourney.gui*
,*</Import-Package>
                        <Export-Package>com.familytreejourney.openmap.*
</Export-Package>
                        <Plugin-Class-Name>
com.familytreejourney.openmap.FamilyMapPanel</Plugin-Class-Name>
                        <Plugin-Name>Map</Plugin-Name>

<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
--------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to