I've been working my way through virgo configuration issues on a project, and there is one library that just refuses to cooperate - apache velocity.
My bundle's manifest is thus (I've changed or removed the names of some internal libraries):
Manifest-Version: 1.0
Web-ContextPath: blah
Bundle-ManifestVersion: 2
Bundle-Name: thebundle
Bundle-SymbolicName: blahblah
Bundle-Version: 0.1.0
Bundle-Activator: blah.Activator
Import-Package: mydatasource,
javax.crypto,
javax.jms;version="[1.1.0,2.0.0)",
javax.naming;version=0,
javax.naming.directory;version=0,
javax.servlet;version="[2.6.0,2.6.0]",
javassist.util.proxy;version="[3.15.0.GA,3.15.0.GA]",
javax.servlet.http;version="[2.6.0,2.6.0]",
org.hibernate.validator;version="[4.2.0.Final,4.2.0.Final]",
org.osgi.framework;version="[1.7.0,1.7.0]",
org.osgi.util.tracker,
org.slf4j.impl;version="[1.7.2,1.7.2]"
Export-Package: .... (stuff removed)
Bundle-ClassPath: .,
WEB-INF/classes,
WEB-INF/lib/velocity.jar <--- THIS IS APACHE VELOCITY
WEB-INF/lib/blahblah.jar
Import-Bundle: org.eclipse.virgo.web.dm;version="3.5.0.RELEASE";resolution:=optional,
a bunch of other bundles I've removed
And I get the following exception at the end of a long stack trace:
Caused by: java.lang.ClassNotFoundException: org.apache.velocity.exception.VelocityException
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at org.eclipse.virgo.kernel.userregion.internal.equinox.KernelBundleClassLoader.loadClass(KernelBundleClassLoader.java:135)
I've verified that the velocity.jar gets published in my bundle. I'm not having any issues with any other libraries. It appears to see some classes in velocity but not others. I've tried bringing all of the individual velocity packages in under Import-Package, no effect. I've tried harsh language, no effect.
You must import the bundle and the package into your bundle, (before you can download the velocity bundle and deploy into your pickup folder)
see this example
Import-Bundle:
org.springframework.web.servlet;version="[3.0.0.RELEASE,3.0.5.RELEASE]"
com.springsource.org.apache.velocity;version="[1.5.0,1.5.0]"
Import-Package:
org.springframework.web.servlet.view.velocity;version="[3.0, 3.5)"
Import-Bundle: com.springsource.javax.ejb;version="[3.0.0,3.0.0]",com.
springsource.org.apache.catalina;version="[7.0.26,7.0.26]",com.spring
source.org.apache.commons.lang;version="[2.6.0,2.6.0]",com.springsour
ce.org.apache.velocity;version="[1.5.0,1.5.0]",org.eclipse.virgo.web.
dm;version="[3.0.3.RELEASE,3.0.3.RELEASE]",org.springframework.contex
t;version="[3.0.5.RELEASE,3.0.5.RELEASE]",org.springframework.web;ver
sion="[3.0.5.RELEASE,3.0.5.RELEASE]",**org.springframework.web.servlet;
version="[3.0.0.RELEASE,3.0.5.RELEASE]"**
Bundle-Vendor: Roshka
Bundle-Version: 1.0.0
Build-Jdk: 1.6.0_37
Bundle-ManifestVersion: 2
Bundle-SymbolicName: helloworld-bundlor
Import-Package: javax.ejb,org.apache.commons.lang,org.apache.naming.ja
va,org.apache.velocity,org.apache.velocity.servlet,org.eclipse.virgo.
web.dm;version="[3.0.0, 4.0.0)",org.springframework.beans.factory.ann
otation;version="[3.0, 3.5)",org.springframework.context,org.springfr
amework.core.io;version="[3.0, 3.5)",org.springframework.ejb.access,o
rg.springframework.stereotype;version="[3.0, 3.5)",org.springframewor
k.web.bind.annotation;version="[3.0, 3.5)",org.springframework.web.co
ntext;version="[3.0, 3.5)",org.springframework.web.servlet;version="[
3.0, 3.5)",org.springframework.web.servlet.view;version="[3.0, 3.5)",
**org.springframework.web.servlet.view.velocity;version="[3.0, 3.5)",or
g.springframework.web.servlet.mvc.annotation;version="[3.0, 3.5)"