You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by el_paso <ro...@windowslive.com> on 2011/11/10 15:01:37 UTC
jms in a bundle v2
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: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: jms in a bundle v2
Posted by el_paso <ro...@windowslive.com>.
Thanks for the response. Will be waiting for the release.
chetan mehrotra wrote:
>
> In that case you would have to wrap the JBoss Client as an OSGi bundle and
> export the org.jnp packages. I have most worked only JBoss 4.x and the
> client jar mechanism was applicable for that.
>
> But looking at JBAPP-7502 [1] and AS7-1338 [2] it looks like support for
> Remote JNDI lookup would come with 7.1. So you might have to wait. Also
> have a look at thread [3] which says that you can connect using Netty
>
> Chetan Mehrotra
>
> [1] https://issues.jboss.org/browse/JBPAPP-7502
> [2] https://issues.jboss.org/browse/AS7-1338
> [3] http://community.jboss.org/message/629603
>
>
--
View this message in context: http://old.nabble.com/jms-in-a-bundle-v2-tp32818822p32825032.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: jms in a bundle v2
Posted by Chetan Mehrotra <ch...@gmail.com>.
In that case you would have to wrap the JBoss Client as an OSGi bundle and
export the org.jnp packages. I have most worked only JBoss 4.x and the
client jar mechanism was applicable for that.
But looking at JBAPP-7502 [1] and AS7-1338 [2] it looks like support for
Remote JNDI lookup would come with 7.1. So you might have to wait. Also
have a look at thread [3] which says that you can connect using Netty
Chetan Mehrotra
[1] https://issues.jboss.org/browse/JBPAPP-7502
[2] https://issues.jboss.org/browse/AS7-1338
[3] http://community.jboss.org/message/629603
Re: jms in a bundle v2
Posted by el_paso <ro...@windowslive.com>.
I have to connect a Felix container with a JBoss7 container with JMS via
network.
chetan mehrotra wrote:
>
> Are you running Felix in embedded mode in JBoss? If yes then you would
> have
> to either add 'org.jnp.interfaces' to [1]
> - system packages extra via org.osgi.framework.system.packages.extra
> - OR to the bootdelegation list via org.osgi.framework.bootdelegation
>
> This would enabled the relevant packages to be exported from base JBoss
> system
>
> [1]
> http://felix.apache.org/site/apache-felix-framework-configuration-properties.html
> Chetan Mehrotra
>
>
--
View this message in context: http://old.nabble.com/jms-in-a-bundle-v2-tp32818822p32819799.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: jms in a bundle v2
Posted by Chetan Mehrotra <ch...@gmail.com>.
Are you running Felix in embedded mode in JBoss? If yes then you would have
to either add 'org.jnp.interfaces' to [1]
- system packages extra via org.osgi.framework.system.packages.extra
- OR to the bootdelegation list via org.osgi.framework.bootdelegation
This would enabled the relevant packages to be exported from base JBoss
system
[1]
http://felix.apache.org/site/apache-felix-framework-configuration-properties.html
Chetan Mehrotra
Re: jms in a bundle v2
Posted by el_paso <ro...@windowslive.com>.
I've added all the packages from the JNDI jar, it seemed that it solved the
problem:
<Export-Package>javax.jms;javax.naming;javax.naming.ldap;javax.naming.event;javax.naming.directory;javax.naming.spi;com.sun.naming.internal</Export-Package>
Now I'm facing with the first exception again:
Caused by: javax.naming.NoInitialContextException: Cannot instantiate class:
org.jnp.interfaces.NamingContextFactory [Root exception is
java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory
not found by salespotential.felix_commandfetcher [18]]
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:663)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:250)
at javax.naming.InitialContext.init(InitialContext.java:226)
at javax.naming.InitialContext.<init>(InitialContext.java:202)
el_paso wrote:
>
> 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-tp32818822p32818987.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org