带有JSP支持的OSGI环境中的Jetty 9无法启动

我试图在OSGI环境中运行Jetty 9.0.3,并使用特殊的清单参数部署WAR(实际上它是一个jar,下面的JettyTest-0.0.0.jar)。 我遵循http://www.eclipse.org/jetty/documentation/current/framework-jetty-osgi.html上的说明

如果我不包含JSP支持,也就是说,如果我从运行配置中删除以下行,它会正常工作

osgi.identity;filter:='(osgi.identity=org.eclipse.jetty.osgi.boot.jsp)'
org.eclipse.jetty.osgi.boot.jsp;version='[9.0.3,9.0.4)',

但如果我包含它们并包含org.eclipse.jetty.osgi.boot.jsp包,则会收到以下错误消息

! Failed to start bundle org.eclipse.jetty.osgi.boot-9.0.3.v20130506, exception activator error org/xml/sax/ErrorHandler from: org.eclipse.jetty.osgi.boot.jasper.JSTLBundleDiscoverer:fixupDtdResolution#216

我已经搜索了一个多星期,现在这个错误我已经看了216线源org.eclipse.jetty.osgi.boot.jasper.JSTLBundleDiscoverer我看不到任何明显的错误。

即使我没有在运行配置中包含JettyTest-0.0.0.jar,错误也是一样的。

阅读Jetty的文档,似乎我应该能够做到我想要的。 我想知道这个错误的原因并解决它,我不想在我的设置中包含pax-web或任何其他重大更改。

有没有人有类似的问题? 或者你没有问题就完成了这个任务? 请帮我找出错误的根源。

这里是我使用的文件:

JettyTest-0.0.0.jar

META-INF
    MANIFEST.MF
WEB-INF
    classes
    lib
    web.xml
index.html
test.jsp

MANIFEST.MF

Manifest-Version: 1.0
Class-Path: 
Bundle-ManifestVersion: 2
Bundle-SymbolicName: JettyTest
Import-Package: javax.servlet,javax.servlet.http

web.xml中

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns="http://java.sun.com/xml/ns/javaee" 
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" 
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" 
version="3.0">
  <display-name>Example</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
  </welcome-file-list>
</web-app>

的index.html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
Hello World?
</body>
</html>

test.jsp的

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%= "Hello World!" %>
</body>
</html>

run.bndrun

-runfw: org.apache.felix.framework;version='[4.2.1,4.2.1]'
-runee: JavaSE-1.7
-resolve.effective: active
-runrequires: osgi.identity;filter:='(osgi.identity=org.eclipse.jetty.deploy)',
    osgi.identity;filter:='(osgi.identity=org.eclipse.jetty.http)',
    osgi.identity;filter:='(osgi.identity=org.eclipse.jetty.security)',
    osgi.identity;filter:='(osgi.identity=org.eclipse.jetty.server)',
    osgi.identity;filter:='(osgi.identity=org.eclipse.jetty.servlet)',
    osgi.identity;filter:='(osgi.identity=org.eclipse.jetty.util)',
    osgi.identity;filter:='(osgi.identity=org.eclipse.jetty.webapp)',
    osgi.identity;filter:='(osgi.identity=org.eclipse.jetty.osgi.boot)',
    osgi.identity;filter:='(osgi.identity=org.eclipse.jetty.io)',
    osgi.identity;filter:='(osgi.identity=org.eclipse.jetty.xml)',
    osgi.identity;filter:='(osgi.identity=com.sun.el)',
    osgi.identity;filter:='(osgi.identity=javax.el)',
    osgi.identity;filter:='(osgi.identity=javax.servlet.jsp)',
    osgi.identity;filter:='(osgi.identity=javax.servlet.jsp.jstl)',
    osgi.identity;filter:='(osgi.identity=org.apache.taglibs.standard.glassfish)',
    osgi.identity;filter:='(osgi.identity=org.apache.jasper.glassfish)',
    osgi.identity;filter:='(osgi.identity=org.eclipse.jdt.core.compiler.batch)',
    osgi.identity;filter:='(osgi.identity=JettyTest)',
    osgi.identity;filter:='(osgi.identity=org.eclipse.jetty.osgi.boot.jsp)'
-runrepos: Releases,
    Local,
    Bndtools Hub
-resolve: auto
-runbundles: JettyTest;version='[0.0.0,0.0.1)',
    com.sun.el;version='[2.2.0,2.2.1)',
    javax.el;version='[2.2.0,2.2.1)',
    javax.servlet;version='[3.0.0,3.0.1)',
    javax.servlet.jsp;version='[2.2.0,2.2.1)',
    javax.servlet.jsp.jstl;version='[1.2.0,1.2.1)',
    org.apache.felix.configadmin;version='[1.4.0,1.4.1)',
    org.apache.felix.log;version='[1.0.1,1.0.2)',
    org.apache.jasper.glassfish;version='[2.2.2,2.2.3)',
    org.apache.taglibs.standard.glassfish;version='[1.2.0,1.2.1)',
    org.eclipse.jdt.core.compiler.batch;version='[3.8.2,3.8.3)',
    org.eclipse.jetty.deploy;version='[9.0.3,9.0.4)',
    org.eclipse.jetty.http;version='[9.0.3,9.0.4)',
    org.eclipse.jetty.io;version='[9.0.3,9.0.4)',
    org.eclipse.jetty.osgi.boot;version='[9.0.3,9.0.4)',
    org.eclipse.jetty.osgi.boot.jsp;version='[9.0.3,9.0.4)',
    org.eclipse.jetty.security;version='[9.0.3,9.0.4)',
    org.eclipse.jetty.server;version='[9.0.3,9.0.4)',
    org.eclipse.jetty.servlet;version='[9.0.3,9.0.4)',
    org.eclipse.jetty.util;version='[9.0.3,9.0.4)',
    org.eclipse.jetty.webapp;version='[9.0.3,9.0.4)',
    org.eclipse.jetty.xml;version='[9.0.3,9.0.4)',
    osgi.cmpn;version='[4.2.0,4.2.1)'
-runvm: -Djetty.home.bundle=org.eclipse.jetty.osgi.boot

UPDATE

在改进日志记录之后,我发现了完整的错误消息。 我似乎错过了org.xml.sax.ErrorHandler的JAR,任何人都知道我可以使用的Apache Felix jar,或任何其他包含此类的库?

ERROR: Bundle org.eclipse.jetty.osgi.boot [20] Error starting osgi-dp:org.eclipse.jetty.osgi.boot (org.osgi.framework.BundleException: Activator start error in
bundle org.eclipse.jetty.osgi.boot [20].)
java.lang.NoClassDefFoundError: org/xml/sax/ErrorHandler
        at org.eclipse.jetty.osgi.boot.jasper.JSTLBundleDiscoverer.fixupDtdResolution(JSTLBundleDiscoverer.java:216)
        at org.eclipse.jetty.osgi.boot.jasper.JSTLBundleDiscoverer.<init>(JSTLBundleDiscoverer.java:91)
        at org.eclipse.jetty.osgi.boot.jsp.FragmentActivator.start(FragmentActivator.java:57)
        at org.eclipse.jetty.osgi.boot.utils.internal.PackageAdminServiceTracker.invokeFragmentActivators(PackageAdminServiceTracker.java:280)
        at org.eclipse.jetty.osgi.boot.utils.internal.PackageAdminServiceTracker.setup(PackageAdminServiceTracker.java:87)
        at org.eclipse.jetty.osgi.boot.utils.internal.PackageAdminServiceTracker.<init>(PackageAdminServiceTracker.java:67)
        at org.eclipse.jetty.osgi.boot.JettyBootstrapActivator.start(JettyBootstrapActivator.java:87)
        at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:645)
        at org.apache.felix.framework.Felix.activateBundle(Felix.java:1977)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1895)
        at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1191)
        at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.xml.sax.ErrorHandler not found
by org.apache.jasper.glassfish [32]
        at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1460)
        at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)
        at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 13 more
链接地址: http://www.djcxy.com/p/74731.html

上一篇: Jetty 9 in an OSGI environment with JSP support does not start

下一篇: setting startlevel for OSGI bundle