You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by EnNuages <ri...@hotmail.com> on 2012/01/19 22:54:47 UTC

My Android QPID port progress, PropertiesFileInitialContextFactory question

Hi QPID folks,

I'm trying to port:  Apache Qpid Client, JMS and JNDI -- to Android.  I'm
able to get a successful compile/build of my QpidDroid project when running
the ant debug install targets after passing Dalvik the --core-library
parameter to allow javax packages for JMS/JNDI.  I'm hoping to do this
before considering repackaging/refactoring javax classes into a different
package namespace using jarjar.

I think this is legally legit because I'm using the old/first seperate JNDI
jar currently provided by Oracle's website.  I'm using the JMS jar that
comes with Apache Geronimo in Qpid,.. but I think it's also available from
Oracle as a seperate download.  My dev environment uses Android platform 2.1
and jdk 1.6.  

The problem is, it seems it currently cannot instantiate my custom jndi
connection factory: PropertiesFileInitialContextFactory.  This is a .java
source file in my QpidDroid project(not a .class in a libs jar)   (I
extracted the class out of the qpidClient jar).  

Would someone have any idea as to why it cannot be instantiated here?  I was
wondering if proguard might be breaking reflection,... but I'm building it
with the debug ant task,.. so I'm thinking proguard shouldn't be running at
all.  The exception occurs when I run the installed app on the emulator.  I
have the Apache Qpid service running on the same machine with the default
port that it uses.


01-18 18:05:16.966: W/System.err(296): [Root exception is
java.lang.ClassNotFoundException:
org.apache.qpid.jndi.PropertiesFileInitialContextFactory]javax.naming.NoInitialContextException:
Cannot instantiate class:
org.apache.qpid.jndi.PropertiesFileInitialContextFactory
01-18 18:05:17.006: W/System.err(296): 	at
javax.naming.spi.NamingManager.getDefaultInitialContextFactory(NamingManager.java:720)
01-18 18:05:17.006: W/System.err(296): 	at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:768)
01-18 18:05:17.016: W/System.err(296): 	at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:169)
01-18 18:05:17.016: W/System.err(296): 	at
javax.naming.InitialContext.<init>(InitialContext.java:146)
01-18 18:05:17.016: W/System.err(296): 	at
org.rif.QpidDroid.Hello.runTest(Hello.java:56)

Thanks for any tips!
-- 
View this message in context: http://old.nabble.com/My-Android-QPID-port-progress%2C--PropertiesFileInitialContextFactory-question-tp33170991p33170991.html
Sent from the Qpid Developers mailing list archive at Nabble.com.


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


Re: My Android QPID port progress, PropertiesFileInitialContextFactory question

Posted by EnNuages <ri...@hotmail.com>.
I think I found the problem -- Android has bugs in it with Reflection prior
to version 2.3 

http://code.google.com/p/android/issues/detail?id=6636 

I ported my QpidDroid project to Android 2.3 and it looks like JNDI is
successfully creating the PropertiesFileInitialContextFactory InitialContext
now with the QPID connection params.

Now, it looks like Android is blowing up on some javax security things that
Android doesn't have:

E/dalvikvm(  404): Could not find class
'javax.security.sasl.SaslClientFactory', referenced from method
org.apache.qpid.client.security.DynamicSaslRegistrar.par
seProperties

I'll look into that now...

--
View this message in context: http://apache-qpid-developers.2158895.n2.nabble.com/My-Android-QPID-port-progress-PropertiesFileInitialContextFactory-question-tp7205538p7209692.html
Sent from the Apache Qpid developers mailing list archive at Nabble.com.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


Re: My Android QPID port progress, PropertiesFileInitialContextFactory question

Posted by Matt Stevenson <ma...@gmail.com>.
I ran into the same problem trying to run under OSGi, as the javax packages
are not available by default.
Here are the needed packages in OSGi:
javax.naming
javax.naming.ldap
javax.naming.event
javax.naming.directory
javax.naming.spi
com.sun.naming.internal

I couldn't get com.sun, so I gave up on JNDI.

Here is a thread from the Felix OSGi mailing list:
http://osdir.com/ml/users-felix-apache/2011-11/msg00046.html

On Thu, Jan 19, 2012 at 3:54 PM, EnNuages <ri...@hotmail.com> wrote:

>
> Hi QPID folks,
>
> I'm trying to port:  Apache Qpid Client, JMS and JNDI -- to Android.  I'm
> able to get a successful compile/build of my QpidDroid project when running
> the ant debug install targets after passing Dalvik the --core-library
> parameter to allow javax packages for JMS/JNDI.  I'm hoping to do this
> before considering repackaging/refactoring javax classes into a different
> package namespace using jarjar.
>
> I think this is legally legit because I'm using the old/first seperate JNDI
> jar currently provided by Oracle's website.  I'm using the JMS jar that
> comes with Apache Geronimo in Qpid,.. but I think it's also available from
> Oracle as a seperate download.  My dev environment uses Android platform
> 2.1
> and jdk 1.6.
>
> The problem is, it seems it currently cannot instantiate my custom jndi
> connection factory: PropertiesFileInitialContextFactory.  This is a .java
> source file in my QpidDroid project(not a .class in a libs jar)   (I
> extracted the class out of the qpidClient jar).
>
> Would someone have any idea as to why it cannot be instantiated here?  I
> was
> wondering if proguard might be breaking reflection,... but I'm building it
> with the debug ant task,.. so I'm thinking proguard shouldn't be running at
> all.  The exception occurs when I run the installed app on the emulator.  I
> have the Apache Qpid service running on the same machine with the default
> port that it uses.
>
>
> 01-18 18:05:16.966: W/System.err(296): [Root exception is
> java.lang.ClassNotFoundException:
>
> org.apache.qpid.jndi.PropertiesFileInitialContextFactory]javax.naming.NoInitialContextException:
> Cannot instantiate class:
> org.apache.qpid.jndi.PropertiesFileInitialContextFactory
> 01-18 18:05:17.006: W/System.err(296):  at
>
> javax.naming.spi.NamingManager.getDefaultInitialContextFactory(NamingManager.java:720)
> 01-18 18:05:17.006: W/System.err(296):  at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:768)
> 01-18 18:05:17.016: W/System.err(296):  at
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:169)
> 01-18 18:05:17.016: W/System.err(296):  at
> javax.naming.InitialContext.<init>(InitialContext.java:146)
> 01-18 18:05:17.016: W/System.err(296):  at
> org.rif.QpidDroid.Hello.runTest(Hello.java:56)
>
> Thanks for any tips!
> --
> View this message in context:
> http://old.nabble.com/My-Android-QPID-port-progress%2C--PropertiesFileInitialContextFactory-question-tp33170991p33170991.html
> Sent from the Qpid Developers mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:dev-subscribe@qpid.apache.org
>
>


-- 
Matt Stevenson.

Re: My Android QPID port progress, PropertiesFileInitialContextFactory question

Posted by William Henry <wh...@redhat.com>.
Does this help?

http://code.google.com/p/dalvik/wiki/JavaxPackages

I have not tried this myself.

William

----- Original Message -----
> 
> Hi QPID folks,
> 
> I'm trying to port:  Apache Qpid Client, JMS and JNDI -- to Android.
>  I'm
> able to get a successful compile/build of my QpidDroid project when
> running
> the ant debug install targets after passing Dalvik the --core-library
> parameter to allow javax packages for JMS/JNDI.  I'm hoping to do
> this
> before considering repackaging/refactoring javax classes into a
> different
> package namespace using jarjar.
> 
> I think this is legally legit because I'm using the old/first
> seperate JNDI
> jar currently provided by Oracle's website.  I'm using the JMS jar
> that
> comes with Apache Geronimo in Qpid,.. but I think it's also available
> from
> Oracle as a seperate download.  My dev environment uses Android
> platform 2.1
> and jdk 1.6.
> 
> The problem is, it seems it currently cannot instantiate my custom
> jndi
> connection factory: PropertiesFileInitialContextFactory.  This is a
> .java
> source file in my QpidDroid project(not a .class in a libs jar)   (I
> extracted the class out of the qpidClient jar).
> 
> Would someone have any idea as to why it cannot be instantiated here?
>  I was
> wondering if proguard might be breaking reflection,... but I'm
> building it
> with the debug ant task,.. so I'm thinking proguard shouldn't be
> running at
> all.  The exception occurs when I run the installed app on the
> emulator.  I
> have the Apache Qpid service running on the same machine with the
> default
> port that it uses.
> 
> 
> 01-18 18:05:16.966: W/System.err(296): [Root exception is
> java.lang.ClassNotFoundException:
> org.apache.qpid.jndi.PropertiesFileInitialContextFactory]javax.naming.NoInitialContextException:
> Cannot instantiate class:
> org.apache.qpid.jndi.PropertiesFileInitialContextFactory
> 01-18 18:05:17.006: W/System.err(296): 	at
> javax.naming.spi.NamingManager.getDefaultInitialContextFactory(NamingManager.java:720)
> 01-18 18:05:17.006: W/System.err(296): 	at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:768)
> 01-18 18:05:17.016: W/System.err(296): 	at
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:169)
> 01-18 18:05:17.016: W/System.err(296): 	at
> javax.naming.InitialContext.<init>(InitialContext.java:146)
> 01-18 18:05:17.016: W/System.err(296): 	at
> org.rif.QpidDroid.Hello.runTest(Hello.java:56)
> 
> Thanks for any tips!
> --
> View this message in context:
> http://old.nabble.com/My-Android-QPID-port-progress%2C--PropertiesFileInitialContextFactory-question-tp33170991p33170991.html
> Sent from the Qpid Developers mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:dev-subscribe@qpid.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org