Hi, I'm trying to build a felix bundle with maven that uses JMS. I don't want to ask a maven site because you are much more into this. I can build the bundle with this 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>####</groupId> <artifactId>####</artifactId> <version>0.0.1-SNAPSHOT</version> <repositories> <repository> <id>repository.jboss.org-public</id> <name>JBoss repository</name> <url>https://repository.jboss.org/nexus/content/groups/public</url> </repository> </repositories> <packaging>bundle</packaging> <build> <plugins> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <extensions>true</extensions> <configuration> <instructions> <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName> <Bundle-Name>####</Bundle-Name> <Bundle-Description>####</Bundle-Description> <Bundle-Vendor>Apache-Felix</Bundle-Vendor> <Bundle-Version>1.0.1</Bundle-Version> <Bundle-Activator>####.Activator</Bundle-Activator> <Import-Package>*</Import-Package> <Export-Package>javax.jms</Export-Package> <Import-Bundle>org.wiring.package</Import-Bundle> </instructions> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>org.apache.felix</groupId> <artifactId>org.apache.felix.framework</artifactId> <version>2.0.4</version> </dependency> <dependency> <groupId>javax.jms</groupId> <artifactId>jms</artifactId> <version>1.1</version> </dependency> <dependency> <groupId>javax.naming</groupId> <artifactId>jndi</artifactId> <version>1.2.1</version> </dependency> </dependencies> </project> The problem is that when I try to start the bundle, I get this exception: javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory] at javax.naming.spi.NamingManager.getInitialContext(Unknown Source) at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source) ... As I looked after the problem I've found the solution, I forgot to export javax.naming, so I did this: <Export-Package>javax.jms; javax.naming</Export-Package> After that I got a new exception, so I've also exported this one: org.osgi.framework.BundleException: Unresolved constraint in bundle ####[18]: Unable to resolve 18.8: missing requirement [18.8] osgi.wiring.package; (osgi.wiring.package=com.sun.naming.internal) The next exception was this: org.osgi.framework.BundleException: Uses constraint violation. Unable to resolve bundle revision ####[18.9] because it is exposed to package 'javax.naming' from bundle revisions ####[18.9] and org.apache.felix.framework [0] via two dependency chains. Chain 1: ####[18.9] import: (&(osgi.wiring.package=javax.naming)(version>=1.0.0)(!(version>=2.0.0))) | export: osgi.wiring.package=javax.naming ####[18.9] Chain 2: ####[18.9] import: (osgi.wiring.package=javax.naming.ldap) | export: osgi.wiring.package=javax.naming.ldap; uses:=javax.naming export: osgi.wiring.package=javax.naming org.apache.felix.framework [0] So I dont know what and how to export to make it work. Please help. in the code I use this: Hashtable<String, String> properties = new Hashtable<String, String>(); properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); properties.put(Context.PROVIDER_URL, "rmi://localhost:1099/"); ctx = new InitialContext(properties); -- View this message in context: http://old.nabble.com/jms-in-a-bundle-v2-tp32818822p32818822.html Sent from the Apache Felix - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

