Surya, 



The version number isn't the issue. When you put a package without a version 
number in your Import-Packages section, and then deploy it into OSGi, per the 
spec, the OSGi container will look for version 0.0.0 and then increment up 
until it finds the first instance of that package.  Then, wiring will occur. 



So, the next thing we need to do is verify that wiring is occuring between your 
bundle and tibco.  To do this, locate the bundleId of your bundle (not tibco), 
and then type: 

karaf@root> headers <bundleId> 



This will tell you all of the wiring that's occuring. Doing this, you will see 
the bundles that aren't wired in red.  Also, have you looked into your tibco 
jar file to verify if that class exists in the location you're looking for it? 
I know some applications are shipped with multiple jar files that contain 
similar package structures. Its possible that the .jar file you're using may 
have the correct package, but may not have that specific class. 



----- Original Message -----


From: "surya aditya [via Karaf]" <[email protected]> 
To: "mikevan" <[email protected]> 
Sent: Thursday, December 1, 2011 3:31:32 PM 
Subject: Re: karaf and tibco ems 

I verified the class exists in jar. on executing the  'exports'. I get the 
following: 


karaf@root> exports | grep com.tibco.tibjms 
   45 com.tibco.tibjms; version=0.0.0 
   45 com.tibco.tibjms.naming; version=0.0.0 
   45 com.tibco.tibjms.naming. tibjmsnaming; version=0.0.0 




i see version=0.0.0, but MyApp does not specify any version on imports! should 
that be the issue here? thanks for helping again. 


from bundles:headers on  my application jar: 
Import-Package = 
       com.google.inject;version="[1. 3,2)", 
       com.google.inject.binder; version="[1.3,2)", 
         com.google.inject.name  ; version="[1.3,2)", 
       com.tibco.tibjms, 
       com.tibco.tibjms.naming, 
       com.tibco.tibjms.naming. tibjmsnaming, 
       javax.jms,........................ 


regards, 
Surya 





On Thu, Dec 1, 2011 at 3:25 PM, mikevan < [hidden email] > wrote: 




First, try to manually verify that the tibco jar file you're using actually 
contains the correct class: com.tibco.tibjms.naming. 
TibjmsInitialContextFactory .  Once you've done that, if the class is present, 
verify that the package has been properly exported into your environment by 
executing: 

karaf@root> exports | grep com.tibco.tibjms.naming 



Please let me know what happens. 



----- Original Message ----- 


From: "surya aditya [via Karaf]" < [hidden email] > 
To: "mikevan" < [hidden email] > 
Sent: Thursday, December 1, 2011 3:17:46 PM 
Subject: Re: karaf and tibco ems 


Hi Mike: 


Thanks for looking into it. Please see the stack trace. I have this working in 
non-karaf environment. I am in process of migrating it to Karaf and having this 
issues. 


javax.naming. NoInitialContextException: Cannot instantiate class: 
com.tibco.tibj 

ms.naming. TibjmsInitialContextFactory [Root exception is 
java.lang.ClassNotFound 
Exception: com.tibco.tibjms.naming. TibjmsInitialContextFactory] 
       at javax.naming.spi. NamingManager. getInitialContext( 
NamingManager.java:6 
57) 
       at javax.naming.InitialContext. getDefaultInitCtx( 
InitialContext.java:288 
) 
       at javax.naming.InitialContext. init(InitialContext.java:223) 


       at javax.naming.InitialContext.< init>(InitialContext.java:197) 
       at com.myapp..osgi. module.EmsResourceModule.jms( EmsResourceMo 
dule.java:64) 
       at sun.reflect. NativeMethodAccessorImpl. invoke0(Native Method) 
       at sun.reflect. NativeMethodAccessorImpl. invoke( 
NativeMethodAccessorImpl. 
java:39) 
       at sun.reflect. DelegatingMethodAccessorImpl. 
invoke(DelegatingMethodAcces 
sorImpl.java:25) 
       at java.lang.reflect.Method. invoke(Method.java:597) 
       at com.google.inject.internal. ProviderMethod.get( 
ProviderMethod.java:104 
) 
       at com.google.inject.internal. InternalFactoryToProviderAdapt 
er.get(Inter 
nalFactoryToProviderAdapter. java:40) 
       at com.google.inject.internal. ProviderToInternalFactoryAdapt 
er$1.call(Pr 
oviderToInternalFactoryAdapter .java:46) 
       at com.google.inject.internal. InjectorImpl.callInContext( 
InjectorImpl.ja 
va:1031) 
       at com.google.inject.internal. ProviderToInternalFactoryAdapt 
er.get(Provi 
derToInternalFactoryAdapter. java:40) 
       at com.google.inject.Scopes$1$1. get(Scopes.java:65) 
       at com.google.inject.internal. InternalFactoryToProviderAdapt 
er.get(Inter 
nalFactoryToProviderAdapter. java:40) 
       at com.google.inject.internal. InjectorImpl$4$1.call( 
InjectorImpl.java:97 
8) 
       at com.google.inject.internal. InjectorImpl.callInContext( 
InjectorImpl.ja 
va:1024) 
       at com.google.inject.internal. InjectorImpl$4.get( 
InjectorImpl.java:974) 
       at org.guiceyfruit.jndi.internal. JndiContext.lookup( 
JndiContext.java:225 
) 
       at org.apache.camel.impl. JndiRegistry.lookup( JndiRegistry.java:65) 
       at org.apache.camel.impl. PropertyPlaceholderDelegateReg 
istry.lookup(Prop 
ertyPlaceholderDelegateRegistr y.java:45) 
       at org.apache.camel.core.osgi. OsgiComponentResolver. 
resolveComponent(Osg 
iComponentResolver.java:42) 
       at org.apache.camel.impl. DefaultCamelContext. 
getComponent(DefaultCamelCo 
ntext.java:292) 
       at org.apache.camel.impl. DefaultCamelContext. 
getEndpoint(DefaultCamelCon 
text.java:420) 
       at org.apache.camel.util. CamelContextHelper. 
getMandatoryEndpoint(CamelCo 
ntextHelper.java:48) 
       at org.apache.camel.model. RouteDefinition. 
resolveEndpoint(RouteDefinitio 
n.java:180) 
       at org.apache.camel.impl. DefaultRouteContext. 
resolveEndpoint(DefaultRout 
eContext.java:110) 
       at org.apache.camel.impl. DefaultRouteContext. 
resolveEndpoint(DefaultRout 
eContext.java:116) 
       at org.apache.camel.model. FromDefinition. resolveEndpoint( 
FromDefinition. 
java:72) 
       at org.apache.camel.impl. DefaultRouteContext. 
getEndpoint(DefaultRouteCon 
text.java:88) 
       at org.apache.camel.model. RouteDefinition.addRoutes( 
RouteDefinition.java 
:798) 
       at org.apache.camel.model. RouteDefinition.addRoutes( 
RouteDefinition.java 
:165) 
       at org.apache.camel.impl. DefaultCamelContext. 
startRoute(DefaultCamelCont 
ext.java:697) 
       at org.apache.camel.impl. DefaultCamelContext. 
startRouteDefinitions(Defau 
ltCamelContext.java:1654) 
       at org.apache.camel.impl. DefaultCamelContext. 
doStartCamel(DefaultCamelCo 
ntext.java:1441) 
       at org.apache.camel.impl. DefaultCamelContext.doStart( 
DefaultCamelContext 
.java:1338) 
       at org.apache.camel.impl. ServiceSupport.start( ServiceSupport.java:67) 
       at org.apache.camel.impl. ServiceSupport.start( ServiceSupport.java:54) 
       at org.apache.camel.impl. DefaultCamelContext.start( 
DefaultCamelContext.j 
ava:1316) 
       at com.myapp.osgi. config.MyAppOsgiActivator. start(MyAppO 
sgiActivator.java:28) 
       at org.apache.felix.framework. util.SecureAction. 
startActivator(SecureAct 
ion.java:629) 
       at org.apache.felix.framework. Felix.activateBundle(Felix. java:1842) 
       at org.apache.felix.framework. Felix.startBundle(Felix.java: 1759) 
       at org.apache.felix.framework. Felix.updateBundle(Felix.java: 2091) 
       at org.apache.felix.framework. BundleImpl.update(BundleImpl. java:936) 
       at org.apache.felix.framework. BundleImpl.update(BundleImpl. java:923) 
       at org.apache.karaf.shell.osgi. UpdateBundle.doExecute( 
UpdateBundle.java: 
37) 
       at org.apache.karaf.shell.osgi. BundleCommand.doExecute( 
BundleCommand.jav 
a:42) 
       at org.apache.karaf.shell. console.OsgiCommandSupport. 
execute(OsgiCommand 
Support.java:38) 
       at org.apache.felix.gogo. commands.basic. AbstractCommand.execute( 
Abstract 
Command.java:35) 
       at org.apache.felix.gogo.runtime. CommandProxy.execute( 
CommandProxy.java: 
78) 
       at org.apache.felix.gogo.runtime. Closure.executeCmd(Closure. java:474) 
       at org.apache.felix.gogo.runtime. Closure.executeStatement( 
Closure.java:4 
00) 
       at org.apache.felix.gogo.runtime. Pipe.run(Pipe.java:108) 
       at org.apache.felix.gogo.runtime. Closure.execute(Closure.java: 183) 
       at org.apache.felix.gogo.runtime. Closure.execute(Closure.java: 120) 
       at org.apache.felix.gogo.runtime. Closure.executeCmd(Closure. java:474) 
       at org.apache.felix.gogo.runtime. Closure.executeStatement( 
Closure.java:4 
00) 
       at org.apache.felix.gogo.runtime. Pipe.run(Pipe.java:108) 
       at org.apache.felix.gogo.runtime. Closure.execute(Closure.java: 183) 
       at org.apache.felix.gogo.runtime. Closure.execute(Closure.java: 120) 
       at org.apache.felix.gogo.runtime. CommandSessionImpl.execute( 
CommandSessi 
onImpl.java:89) 
       at org.apache.karaf.shell. console.jline.Console.run( Console.java:218) 
       at java.lang.Thread.run(Thread. java:619) 
Caused by: java.lang. ClassNotFoundException: com.tibco.tibjms.naming. 
TibjmsIniti 
alContextFactory 
       at java.lang.Class.forName0( Native Method) 
       at java.lang.Class.forName(Class. java:247) 
       at com.sun.naming.internal. VersionHelper12.loadClass( 
VersionHelper12.jav 
a:46) 
       at javax.naming.spi. NamingManager. getInitialContext( 
NamingManager.java:6 
54) 
       ... 64 more 



On Thu, Dec 1, 2011 at 2:54 PM, mikevan < [hidden email] > wrote: 




surya, 



I think I know what the issue is, but to confirm it, could you please send the 
full exception you are getting to this user-group? 



----- Original Message ----- 


From: "surya aditya [via Karaf]" < [hidden email] > 
To: "mikevan" < [hidden email] > 


Sent: Thursday, December 1, 2011 2:51:02 PM 
Subject: karaf and tibco ems 


Hello Friends: 


I am trying to setup using the following stack: 


1. karaf 2.2.4 
2. camel 2.8.2 
3. tibco ems 5.0 
5. spring 3.0.6 


to enable camel route to recieve messages from JMS queue setup on EMS server, i 
am trying to instantiate camel jms component. 
However, i am getting following error for "ClassNotFoundException" 


I had to put tibco jar  tibjms-5.0 in deploy folder as it is not osgi 
comapatible. karaf wrapped it and shows 'active' status. 


I am loading the bundles in correct order to my knowledge and on 
bundles:headers i see the packages are being exported/imported correctly. See 
below for headers from bundles. 


See the following exception and I am stuck at this point, has anyone tried used 
 Tibco EMS on OSGI/Karaf ? Please suggest. 


Cannot instantiate class: com.tibco.tibjms.naming. TibjmsInitialContextFactory 
[Root exception is java.lang. ClassNotFoundException: com.tibco.tibjms.naming. 
TibjmsInitialContextFactory] 


application code: 


 Hashtable<String, String> env = new Hashtable<String, String>(); 
               env.put(Context.INITIAL_ CONTEXT_FACTORY, 
                               "com.tibco.tibjms.naming. 
TibjmsInitialContextFactory"); 
               env.put(Context.PROVIDER_URL, "tibjmsnaming:// 
vm-bda2-d889.nam.nsroot.net:7222 "); 
               // env.put(Context.SECURITY_ PRINCIPAL, "user"); 
               // env.put(Context.SECURITY_ CREDENTIALS, "password"); 

               Context ctx = new InitialContext(env); 
               TibjmsConnectionFactory emsConnectionFactory = 
(TibjmsConnectionFactory) ctx 
                               .lookup("tml2.inbound. ConnectionFactory"); 

               System.out.println(" JMSCOMpononet....."); 
                log.info ("## Creating JMS Component ##"); 


               JmsComponent jms = new JmsComponent(); 
               jms.setConnectionFactory( emsConnectionFactory); 
               jms.setConcurrentConsumers(5); 


for Tibco Ems Jar: 


Import-Package = 
       com.tibco.security;resolution: =optional, 
       com.tibco.security.ocsp; resolution:=optional, 
       com.tibco.security.ssl; resolution:=optional, 
       com.tibco.tibjms;resolution:= optional, 
       com.tibco.tibjms.naming; resolution:=optional, 
       com.tibco.tibjms.naming. tibjmsnaming;resolution:= optional, 
       javax.jms;resolution:= optional, 
       javax.naming;resolution:= optional, 
       javax.naming.directory; resolution:=optional, 
       javax.naming.spi;resolution:= optional, 
       javax.transaction.xa; resolution:=optional, 
       javax.xml.parsers;resolution:= optional, 
       javax.xml.transform; resolution:=optional, 
       javax.xml.transform.dom; resolution:=optional, 
       javax.xml.transform.stream; resolution:=optional, 
       org.w3c.dom;resolution:= optional, 
       org.xml.sax;resolution:= optional, 
       org.xml.sax.helpers; resolution:=optional 
Export-Package = 
       com.tibco.tibjms; 
               uses:="javax.jms, 
                       javax.naming, 
                       javax.xml.transform, 
                       javax.xml.transform.stream, 
                       javax.xml.parsers, 
                       javax.xml.transform.dom, 
                       org.w3c.dom, 
                       com.tibco.tibjms.naming, 
                       org.xml.sax.helpers, 
                       org.xml.sax, 
                       com.tibco.security.ssl, 
                       com.tibco.security, 
                       javax.transaction.xa, 
                       com.tibco.security.ocsp", 
       com.tibco.tibjms.naming; 
               uses:="javax.naming, 
                       javax.naming.directory, 
                       com.tibco.tibjms, 
                       org.xml.sax.helpers, 
                       javax.naming.spi, 
                       javax.jms", 
       com.tibco.tibjms.naming. tibjmsnaming; 
               uses:="javax.naming, 
                       com.tibco.tibjms.naming, 
                       javax.naming.spi" 




for my application jar: 


Import-Package = 
       com.google.inject;version="[1. 3,2)", 

       com.google.inject.binder; version="[1.3,2)", 
        com.google.inject.name ; version="[1.3,2)", 
       com.tibco.tibjms, 
       com.tibco.tibjms.naming, 
       com.tibco.tibjms.naming. tibjmsnaming, 
       javax.jms, 
       javax.naming, 
       org.apache.camel;version="[2. 8,3)", 
       org.apache.camel.builder; version="[2.8,3)", 
       org.apache.camel.component. jms;version="[2.8,3)", 

       org.apache.camel.core.osgi; version="[2.8,3)", 
       org.apache.camel.guice; version="[2.8,3)", 
       org.apache.camel.impl;version= "[2.8,3)", 
       org.apache.camel.model; version="[2.8,3)", 
       org.apache.camel.spi;version=" [2.8,3)", 
       org.guiceyfruit.jndi;version=" [2.0,3)", 
       org.guiceyfruit.jndi.internal; version="[2.0,3)", 
       org.osgi.framework;version="[ 1.5,2)", 
       org.slf4j;version="[1.6,2)" 




If you reply to this email, your message will be added to the discussion below: 
http://karaf.922171.n3.nabble.com/karaf-and-tibco-ems-tp3552646p3552646.html 
To start a new topic under Karaf - User, email [hidden email] 

To unsubscribe from Karaf - User, click here . 
NAML 

----- 
Mike Van  (All links open in new tabs) 
Committer - Kalumet 

Atraxia Technologies 

NCI Inc 

Mike Van's Open Source Technologies Blog 
-- 
View this message in context: 
http://karaf.922171.n3.nabble.com/karaf-and-tibco-ems-tp3552646p3552656.html 
Sent from the Karaf - User mailing list archive at Nabble.com. 








If you reply to this email, your message will be added to the discussion below: 
http://karaf.922171.n3.nabble.com/karaf-and-tibco-ems-tp3552646p3552722.html 

To start a new topic under Karaf - User, email [hidden email] 
To unsubscribe from Karaf - User, click here . 
NAML 

----- 
Mike Van  (All links open in new tabs) 
Committer - Kalumet 

Atraxia Technologies 

NCI Inc 

Mike Van's Open Source Technologies Blog 
-- 
View this message in context: 
http://karaf.922171.n3.nabble.com/karaf-and-tibco-ems-tp3552646p3552742.html 


Sent from the Karaf - User mailing list archive at Nabble.com. 








If you reply to this email, your message will be added to the discussion below: 
http://karaf.922171.n3.nabble.com/karaf-and-tibco-ems-tp3552646p3552760.html 
To start a new topic under Karaf - User, email 
[email protected] 
To unsubscribe from Karaf - User, click here . 
NAML

-----
Mike Van  (All links open in new tabs)
Committer - Kalumet 

Atraxia Technologies 

NCI Inc 

Mike Van's Open Source Technologies Blog 
--
View this message in context: 
http://karaf.922171.n3.nabble.com/karaf-and-tibco-ems-tp3552646p3552803.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Reply via email to