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

时间:2013-06-15 10:58:02

标签: jsp jetty osgi embedded-jetty bndtools

我正在尝试在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

更新

经过一些改进的日志记录后,我发现了完整的错误消息。我好像错过了一个带有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

0 个答案:

没有答案
相关问题