1

我一直在解决一个项目的 virgo 配置问题,并且有一个库拒绝合作 - apache velocity。

因此,我的包的清单是(我已经更改或删除了一些内部库的名称):

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 下,但没有效果。我试过粗话,没有效果。

4

1 回答 1

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)"
于 2013-10-30T19:09:44.307 回答