Jetty 9 in an OSGI environment with JSP support does not start
I am trying to run Jetty 9.0.3 in an OSGI environment and deploy a WAR with a special manifest parameters (in fact it is a jar, JettyTest-0.0.0.jar below). I am following the instructions on http://www.eclipse.org/jetty/documentation/current/framework-jetty-osgi.html
It works fine if I do not include JSP support, ie, if I remove the following lines from the run configuration
osgi.identity;filter:='(osgi.identity=org.eclipse.jetty.osgi.boot.jsp)'
org.eclipse.jetty.osgi.boot.jsp;version='[9.0.3,9.0.4)',
but if I include them and thus include the org.eclipse.jetty.osgi.boot.jsp bundle I get the following error message
! 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
I have searched for over a week now for this error I have looked at the source org.eclipse.jetty.osgi.boot.jasper.JSTLBundleDiscoverer on line 216 I cannot see any obvious mistake.
The error is the same if even if I don't include the JettyTest-0.0.0.jar in the run configuration.
Reading the documentation of Jetty it seems that I should be able to do what I want. I want to know the reason for this error and fix it, I do not want to include pax-web or any other major change in my setup.
Have anyone had a similar problem? or have you done this without problems? Please help me find the root cause of the error.
Here are the files I use:
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
After some improved logging I found the full error message. I seem to miss a JAR with org.xml.sax.ErrorHandler, anyone knows a Apache Felix jar that I can use, or any other library that contains this class?
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/74732.html
上一篇: 启动一个OSGI包