*Sorry for the double post but i managed to clear the pom file a bit and got away lots of the messy stuff in there... now the strange error at the end of the previous post is gone but the original one persists .* * * *here is the simplified pom *
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>tst.pr.test.bundleTester</groupId> <artifactId>tst.pr.test.bundleTester</artifactId> <version>0.0.1-SNAPSHOT</version> <name>bundleLoaderTest</name> <description>Testing loading of a bundle</description> <repositories> <repository> <id>clojars.org</id> <url>http://clojars.org/repo</url> </repository> </repositories> <dependencies> <dependency> <groupId>org.apache.felix</groupId> <artifactId>org.apache.felix.main</artifactId> <version>4.0.2</version> </dependency> </dependencies> </project> * * *all the other information from the previous post remain invariated (loaded bundles, packages exported from the system bundle of felix and code from the program).* 2012/8/13 Dario Luzi <[email protected]> > *Hi there guys...thanks for your fast answere.* > *Here i come with more informations and sorry to put everything in bold > but it was needed to make the post more readable (easier to distinguish > code and text).* > *First of all i attempted to start the system using compendium 4.2.0 but > it didn`t do the trick unfortunately.* > *Problem is that if i remove this org.apache.felix.framework-4.0.3.jar > (or org.osgi.core-4.2.0 which i also tried ) from the bundles this is the > error i get * > * > * > *Unable to resolve 4.0: missing requirement [4.0] osgi.wiring.package; > (&(osgi.wiring.package=org.osgi.framework)(version>=1.0.0)(!(version>=2.0.0))) > * > * > * > *and if i put one of them i get the following * > * > * > *org.ops4j.pax.web.service.jetty.internal.CompositeActivator cannot be > cast to org.osgi.framework.BundleActivator (metioned in the previous > message)* > * > * > *i`m not very sure about the meaning of the version infos at the end of > the message but what i do get is that pax isn`t able to find the right > package and something is missing.* > * > * > *What concerns me is that this org.osgi.framework should be part of the > felix container itself and still pax is not able to see it even , as shown > below, i`m exporting it trough the system package.* > * > * > *atm i`m infact trying to start pax with this bundles only * > > slf4j-log4j12-1.6.6.jar > slf4j-api-1.6.6.jar > org.osgi.compendium-4.2.0.jar > pax-web-jetty-bundle-2.0.2.jar > > *but what i do get is the mentioned exception... even if with this > property * > > configMap.put( > Constants.FRAMEWORK_SYSTEMPACKAGES, > stProperties.getProperty("it.uniroma2.art.semanticturkey.osgi.packages")); > > *filling the map used when creating the felix container* > > *and with this config file from which the getProperty functions gets the > entries to put in Constants.FRAMEWORK_SYSTEMPACKAGES* > > it.uniroma2.art.semanticturkey.osgi.packages=org.slf4j.impl , \ > javax.crypto , \ > javax.imageio , \ > javax.imageio.metadata , \ > javax.management, \ > javax.management.modelmbean, \ > javax.management.remote, \ > javax.naming, \ > javax.naming.directory, \ > javax.naming.spi, \ > javax.net, \ > javax.security.auth, \ > javax.security.auth.callback, \ > javax.security.auth.login, \ > javax.security.auth.spi, \ > javax.security.auth.x500, \ > javax.security.sasl, \ > javax.sql, \ > javax.transaction, \ > javax.xml.parsers, \ > javax.xml.transform, \ > javax.xml.transform.sax, \ > javax.xml.transform.stream, \ > org.xml.sax.ext, \ > org.ietf.jgss, \ > javax.crypto, \ > org.w3c.dom, \ > org.xml.sax, \ > org.xml.sax.helpers, \ > org.apache.log4j , \ > org.osgi.framework , \ * <------------ i`m actually exporting the > required package trough the system bundle* > org.apache.log4j.Level > > *as to give you the biggest quantity of information possible... this is > the small pom file of my test project* > > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi=" > http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 > http://maven.apache.org/xsd/maven-4.0.0.xsd"> > <modelVersion>4.0.0</modelVersion> > <groupId>tst.pr.test.bundleTester</groupId> > <artifactId>tst.pr.test.bundleTester</artifactId> > <version>0.0.1-SNAPSHOT</version> > <name>bundleLoaderTest</name> > <description>Testing loading of a bundle</description> > > <repositories> > > <repository> > <id>clojars.org</id> > <url>http://clojars.org/repo</url> > </repository> > > </repositories> > > <dependencies> > <dependency> > <groupId>log4j</groupId> > <artifactId>log4j</artifactId> > <version>1.2.17</version> > </dependency> > > <dependency> > <groupId>org.ops4j.pax.web</groupId> > <artifactId>pax-web-jetty-bundle</artifactId> > <version>2.0.2</version> > </dependency> > <dependency> > <groupId>org.eclipse.jetty.aggregate</groupId> > <artifactId>jetty-all-server</artifactId> > <version>8.1.4.v20120524</version> > </dependency> > <dependency> > <groupId>org.ops4j.pax.web</groupId> > <artifactId>pax-web-jetty</artifactId> > <version>2.0.2</version> > </dependency> > <dependency> > <groupId>org.ops4j.pax.web</groupId> > <artifactId>pax-web-runtime</artifactId> > <version>2.0.2</version> > </dependency> > <dependency> > <groupId>org.osgi</groupId> > <artifactId>org.osgi.core</artifactId> > <version>5.0.0</version> > </dependency> > <dependency> > <groupId>org.osgi</groupId> > <artifactId>org.osgi.compendium</artifactId> > <version>4.2.0</version> > </dependency> > > <dependency> > <groupId>org.apache.felix</groupId> > <artifactId>org.apache.felix.main</artifactId> > <version>4.0.3</version> > <scope>compile</scope> > <exclusions> > <exclusion> > <groupId>org.apache.felix</groupId> > <artifactId>org.apache.felix.shell</artifactId> > </exclusion> > <exclusion> > <groupId>org.apache.felix</groupId> > <artifactId>org.apache.felix.shell.tui</artifactId> > </exclusion> > <exclusion> > <groupId>org.apache.felix</groupId> > <artifactId>org.apache.felix.bundlerepository</artifactId> > </exclusion> > <exclusion> > <groupId>org.apache.felix</groupId> > <artifactId>org.apache.felix.framework</artifactId> > </exclusion> > </exclusions> > </dependency> > > </dependencies> > </project> > > > *and to cunclude these below are the few lines of my test project* > > package testing.test; > > > import java.io.File; > import java.io.FileInputStream; > import java.io.FileNotFoundException; > import java.io.IOException; > import java.io.InputStream; > import java.net.URL; > import java.util.Enumeration; > import java.util.HashMap; > import java.util.Map; > import java.util.Properties; > > import org.apache.felix.framework.Felix; > import org.apache.felix.framework.util.Util; > import org.apache.felix.main.AutoProcessor; > import org.apache.felix.main.Main; > import org.osgi.framework.BundleException; > import org.osgi.framework.Constants; > import org.osgi.framework.launch.FrameworkFactory; > > public class loader { > > private static Properties loadProperties(URL propURL) { > // this portion of code (try-catch block) is borrowed from > // ExtensionManager in felix jar > Properties props = new Properties(); > InputStream is = null; > > try { > is = propURL.openConnection().getInputStream(); > props.load(is); > is.close(); > // Perform variable substitution for system properties. > for (Enumeration<?> e = props.propertyNames(); e.hasMoreElements();) { > String name = (String) e.nextElement(); > props.setProperty(name, Util.substVars(props.getProperty(name), > name, null, props)); > } > } catch (Exception ex2) { > // Try to close input stream if we have one. > try { > if (is != null) > is.close(); > } catch (IOException ex3) { > // Nothing we can do. > } > > } > return props; > } > > public static void main(String[] args) { > > Felix m_felix = null; > > URL stPopertiesURL = loader.class.getResource("st-osgi.properties"); > System.out.println(stPopertiesURL); > Properties stProperties = loadProperties(stPopertiesURL); > > // > System.out.println(defaultProperties.getProperty("org.osgi.framework.system.packages")); > > // Create a case-insensitive configuration property map. > Map<String, String> configMap = new HashMap<String, String>(); > > configMap.put("org.osgi.framework.storage","bundles"); > configMap.put( > Constants.FRAMEWORK_SYSTEMPACKAGES, > stProperties.getProperty("it.uniroma2.art.semanticturkey.osgi.packages")); > > try { > > m_felix = new Felix(configMap); > > // Now start Felix instance. > m_felix.start(); > } catch (Exception ex) { > // TODO remove this catch, throw and catch appropriately > System.err.println("Could not create framework : " + ex); > ex.printStackTrace(); > } > try { > > > m_felix.getBundleContext().installBundle(loader.class.getResource("slf4j-log4j12-1.6.6.jar").toString()); > > m_felix.getBundleContext().installBundle(loader.class.getResource("slf4j-api-1.6.6.jar").toString()); > > m_felix.getBundleContext().installBundle(loader.class.getResource("org.osgi.compendium-4.2.0.jar").toString()); > > m_felix.getBundleContext().installBundle(loader.class.getResource("pax-web-jetty-bundle-0.7.0.jar").toString()).start(); > > } catch (BundleException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > } > > } > > *if in the pom file i change the version for core and compendium to 4.2.0 > i get another error * > > > org.osgi.framework.BundleEvent.<init>(ILorg/osgi/framework/Bundle;Lorg/osgi/framework/Bundle;)V > > *when installing slf4j-log4j12-1.6.6.jar * > * > * > *all your help would be really really appreciated since i don`t really > know what i`m doing wrong or if i`m or not following the right > practice(which i don`t think since the enormous amout of problems i`m > experiencing) in resolving dependency problems.* > * > * > *For what concerns Apache karaff i tought about actually adopting it but > i`m working on a big project now and not every part of it actually depends > on me so i`m not sure if i have to stick to felix or not.* > * > * > *thanks again for help and sorry for my ignorance.* > * > * > > 2012/8/13 Achim Nierbeck <[email protected]> > >> Hi Dario, >> >> depending on your usecases but I'm quite sure you probably could >> need a nice OSGi Container as Apache Karaf. >> It does have Pax Web Included and >> the upcoming Karaf 3.0 will have the latest Pax Web 2.1 with it. >> Latest Stable version of Karaf does contain 1.0.11 of Pax-Web. >> >> So as I said before depending on your usecases you probably should >> start with a tested environment. If you find that Karaf has >> "too much" of infrastructure you still can strip it down later. >> Though with Karaf you probably start with a pretty good environment >> to get started. Especially since you seem to start with OSGi. >> One other thing you can choose between felix and equinox. >> >> regards, Achim >> >> 2012/8/12 Dario Luzi <[email protected]>: >> > hi there guys... i`m new to pax web and all the osgi world in general so >> > forgive me if my question may seem stupid. >> > >> > I`m running felix and i`m able to install and start various other >> bundles >> > but since i`m attempting to start pax-web-jetty-bundle-2.0.2.jar i`m >> having >> > lots of problems with dependencies. >> > After some work i was able to solve the dipendencies issues but now >> when i >> > start the specified bundle i`m getting the following error >> > >> > >> > org.ops4j.pax.web.service.jetty.internal.CompositeActivator cannot be >> cast >> > to org.osgi.framework.BundleActivator >> > >> > >> > these are the bundles i`m loading in the felix container >> > >> > slf4j-log4j12-1.6.6.jar >> > slf4j-api-1.6.6.jar >> > org.apache.felix.framework-4.0.3.jar >> > org.osgi.compendium-4.3.0.jar >> > pax-web-jetty-bundle-2.0.2.jar <------------ error when starting this >> one >> > >> > in the order specified above. >> > >> > all your help would be really appreciated thank you very much and sorry >> for >> > this probably stupid question >> > >> > _______________________________________________ >> > general mailing list >> > [email protected] >> > http://lists.ops4j.org/mailman/listinfo/general >> > >> >> >> >> -- >> >> Apache Karaf <http://karaf.apache.org/> Committer & PMC >> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> >> Committer & Project Lead >> OPS4J Pax for Vaadin >> <http://team.ops4j.org/wiki/display/PAXVAADIN/Home> Commiter & Project >> Lead >> blog <http://notizblog.nierbeck.de/> >> >> _______________________________________________ >> general mailing list >> [email protected] >> http://lists.ops4j.org/mailman/listinfo/general >> > >
_______________________________________________ general mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/general
