我一直在努力解决项目中的处女座配置问题,并且有一个图书馆只是拒绝合作 - 阿帕奇速度。
我的包的清单因此(我已经更改或删除了一些内部库的名称):
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
我在长堆栈跟踪结束时得到以下异常:
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)
我已经验证了velocity.jar会在我的包中发布。我对任何其他库都没有任何问题。它似乎看到一些速度类而不是其他类。我尝试将所有单独的速度包放在Import-Package下,没有效果。我尝试过严厉的语言,没有效果。
答案 0 :(得分:1)
您必须将捆绑包和包导入捆绑包中(在下载速度捆绑包并部署到您的提取文件夹之前)
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)"