First off, sorry if I am missing something obvious -- I've been
chugging away trying to "OSGi-ify" 250,000 lines of code and it's
wrecking havoc on my basic ability to think, so I probably am missing
something obvious...
Here's how I've been progressing:
1. First, I built a small infrastructure that lets me run my code
without JAR'ing it up, since JAR'ing my code after every small change
is going to be prohibitively slow. This is primarily dependent on the
"assembly" and "wrap" URL protocols from the pax runner folks -- so
they've done the hard work for me. I created a project to help others
with this as well, and once I get this working I plan to put more
instructions up:
http://code.google.com/p/piecemeal/
2. Replace sym links with actual files where necessary. The pax runner
code doesn't seem to like sym links.
3. The next step was to go through bit-by-bit and fix all the dynamic
class loading and resource loading. Since I've actually not found good
documentation explaining, from a user's standpoint, how to do this, I
just centralized my code and found something that gets it done. If I'm
doing it wrong, at least it's centralized so I can change it easily.
- if a bundle is available (OSGi case) use the classloader from the
bundle.
- if there is an object that likely used the same classloader I
wanted, which is often the case, get that object's classloader.
- failing that, eg, if I'm in a static context -- I use something like
this: Thread.currentThread().getContextClassLoader().loadClass(path);
That's gotten me some distance. The app actually launches to a point.
I'm still having two problems, though:
A. My app won't load any JNI stuff no matter what I do.
B. Putting that aside, I get this error:
Caused by: java.lang.NoClassDefFoundError: com/apple/eawt/
ApplicationListener
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:676)
at org.apache.felix.framework.ModuleImpl
$ModuleClassLoader.findClass(ModuleImpl.java:1907)
at
org
.apache
.felix
.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:
727)
at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)
at org.apache.felix.framework.ModuleImpl
$ModuleClassLoader.loadClass(ModuleImpl.java:1768)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at
org
.apache
.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:645)
at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1599)
at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:904)
at com.xowave.sjwidget.ResourceUtil.getClass(ResourceUtil.java:132)
.....
I have seen that kind of error in reference to knopflerfish, which
apparently has (had?) a bug causing apple's ApplicationListener class
not to load, but I am not seeing any answers relating to Felix. I've
been through my build and, on the mac, I don't seem to be doing
anything special to load add that class to the classpath when I'm not
using OSGi -- do I need to do something special to add it when I am
using OSGi?
Any other suggestions?
TIA,
bjorn
-----------------------------
Bjorn Roche
http://www.xonami.com
Audio Collaboration
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]