A little more information, somehow I thought I'd updated the packages but it 
appears that I hadn't.  The run from before didn't have 
'com.mqsoftware.test.A.impl' exported.  Fixing that export, I now get the same 
type of stack trace that I get with my jackrabbit bundle:

-> start 29
Starting B ...
org.osgi.framework.BundleException: Activator start error.
        at org.apache.felix.framework.Felix._startBundle(Felix.java:1579)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1469)
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:348)
        at org.apache.felix.shell.impl.StartCommandImpl.execute(StartCommandImpl
.java:82)
        at org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand
(Activator.java:265)
        at org.apache.felix.shell.tui.Activator$ShellTuiRunnable.run(Activator.j
ava:167)
        at java.lang.Thread.run(Thread.java:595)
Caused by: javax.naming.NoInitialContextException: Cannot instantiate class: com
.mqsoftware.test.A.impl.Aimpl [Root exception is java.lang.ClassNotFoundExceptio
n: com.mqsoftware.test.A.impl.Aimpl]
        at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
57)
        at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247
)
        at javax.naming.InitialContext.init(InitialContext.java:223)
        at javax.naming.InitialContext.<init>(InitialContext.java:197)
        at com.mqsoftware.test.B.Activator.start(Activator.java:19)
        at org.apache.felix.framework.util.SecureAction.startActivator(SecureAct
ion.java:589)
        at org.apache.felix.framework.Felix._startBundle(Felix.java:1535)
        ... 6 more
Caused by: java.lang.ClassNotFoundException: com.mqsoftware.test.A.impl.Aimpl
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:242)
        at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.jav
a:42)
        at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
54)
        ... 12 more
javax.naming.NoInitialContextException: Cannot instantiate class: com.mqsoftware
.test.A.impl.Aimpl [Root exception is java.lang.ClassNotFoundException: com.mqso
ftware.test.A.impl.Aimpl]






Also, using the 'packages' command on bundle A gives:

-> packages 28
A (28): com.mqsoftware.test.A; version=0.0.0
A (28): com.mqsoftware.test.A.impl; version=0.0.0

So it does think that A exported the package (this was how I determined I 
didn't have com.mqsoftware.test.A.impl exported correctly).

Cheers,
Craig


-----Original Message-----
From: Craig L. Ching [mailto:[EMAIL PROTECTED]
Sent: Tue 7/31/2007 2:25 PM
To: [email protected]; [email protected]
Subject: RE: Maven-bundle-plugin and DynamicImport-Package support?
 
Well, I'm not sure if this is a defect in felix or not, so, before I go opening 
an issue for this, I'd like to present what I found.

I created two bundles, A and B.  In A, I have a class 
(com.mqsoftware.test.A.impl.Aimpl) that implements 
javax.naming.spi.InitialContextFactory.  Bundle B then does this in its 
activator:

public void start(BundleContext context) throws Exception {
  System.out.println("Starting B ...");
  Hashtable<String, String> env = new Hashtable<String, String>();
  env.put(Context.INITIAL_CONTEXT_FACTORY, "com.mqsoftware.test.A.impl.Aimpl");
  env.put(Context.PROVIDER_URL, "localhost");
  InitialContext ctx = new InitialContext(env);
  System.out.println("B Started.");
}

and when I start bundle B, I get this:

DEBUG: WIRE: 29.0 -> javax.naming -> 0
DEBUG: WIRE: 29.0 -> com.mqsoftware.test.A -> 28.0
DEBUG: WIRE: 29.0 -> org.osgi.framework -> 0
Starting B ...
Starting B ...
javax.naming.NoInitialContextException: Cannot instantiate class: 
com.mqsoftware.test.A.impl.Aimpl [Root exception is 
java.lang.ClassNotFoundException: com.mqsoftware.test.A.impl.Aimpl]

This error is slightly different than my real error in that the real error 
gives me a full stack trace.  One other odd thing is the "Starting B..." twice. 
 "Starting B..." is printed out in bundle B's activator.

I have a maven project that is completely self-contained (apart from some 
felix-osgi dependencies) if anyone thinks this is a problem in felix.  My felix 
version is the trunk from a couple of days ago.

Cheers,
Craig



-----Original Message-----
From: Craig L. Ching [mailto:[EMAIL PROTECTED]
Sent: Mon 7/30/2007 2:37 PM
To: [email protected]
Subject: RE: Maven-bundle-plugin and DynamicImport-Package support?
 
Well, my bundle *is* working in equinox, I'll try simplifying it down to
where it works in equinox but not in felix.

Cheers,
Craig 

> -----Original Message-----
> From: Craig L. Ching [mailto:[EMAIL PROTECTED] 
> Sent: Monday, July 30, 2007 1:59 PM
> To: [email protected]
> Subject: RE: Maven-bundle-plugin and DynamicImport-Package support?
> 
> Well, I should have just tried this out before posting ;-)  
> The doc doesn't say you can do it, but you apparently can use 
> DynamicImport-Package.
> 
> But, that said, it's still not working, I'm getting a 
> ClassNotFoundException, anyone have any experience doing this 
> and might suggest how I track down what's wrong?
> 
> Thanks for any help!
> 
> Cheers,
> Craig 
> 
> > -----Original Message-----
> > From: Craig L. Ching [mailto:[EMAIL PROTECTED]
> > Sent: Monday, July 30, 2007 1:53 PM
> > To: [email protected]
> > Subject: Maven-bundle-plugin and DynamicImport-Package support?
> > 
> > Hi all,
> > 
> > I apparently have a need to use DynamicImport-Package 
> (Jackrabbit is 
> > doing the equivalent of Class.forName() under the covers), 
> but I can't 
> > find any doc that says BND supports this.  Is there a 
> work-around if 
> > it doesn't?  I've tried simply adding what I needed to the 
> > Import-Package, but I get a warning from BND that I never use that 
> > import and I get ClassNotFoundException at runtime.  Any help is 
> > appreciated, in the meantime I'm going to manually add 
> > DynamicImport-Package to the bundle and see if that helps.
> > 
> > Cheers,
> > Craig
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to