2

我有一个由我的一些同学开发的 OSGi 应用程序,我尝试让它在 OS X 10.8 下的 Eclipse Juno 4.2 和 Java 1.6 中运行。此应用程序的捆绑包之一负责使用 JSP 和 Jetty 提供 Web 界面。当我尝试在 Eclipse 中运行项目时,当我尝试访问 Web 界面时,Equinox 控制台给了我以下异常:

2012-08-21 16:15:30.574:WARN:oejs.ServletHandler:/ner/ner
org.apache.jasper.JasperException: /WEB-INF/ner.jsp(5,68) PWC6226: Could not add one or more tag libraries.

at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:81)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:376)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:133)
at org.apache.jasper.compiler.JspDocumentParser.parse(JspDocumentParser.java:258)
at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:229)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:145)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:212)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:625)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:492)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.equinox.jsp.jasper.JspServlet.service(JspServlet.java:155)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:384)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:598)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:486)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:413)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:271)
at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:98)
at org.eclipse.equinox.http.servlet.internal.RequestDispatcherAdaptor.forward(RequestDispatcherAdaptor.java:30)
at de.uni_sb.coli.nep.webui.NerServlet.doGet(NerServlet.java:150)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:60)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:384)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:598)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:486)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:413)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
at org.eclipse.jetty.server.Server.handle(Server.java:350)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454)
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:890)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:944)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:630)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:606)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:46)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538)
at java.lang.Thread.run(Thread.java:722)

Web界面相关的文件夹结构如下:

WebContent
|----> WEB-INF
       |----> ner.jsp     # This is the template
              lib
              |----> commons-fileupload-1.2.2.jar
                     commons-io-2.0.1.jar
              tld
              |----> c-1_0-rt.tld
                     c-1_0.tld
                     c.tld
                     fmt-1_0-rt.tld
                     fmt-1_0.tld
                     fmt.tld
                     fn.tld
                     permittedTaglibs.tld
                     scriptfree.tld
                     sql-1_0-rt.tld
                     sql-1_0.tld
                     sql.tld
                     x-1_0-rt.tld
                     x-1_0.tld
                     x.tld

Web 界面应该可以访问,http://localhost:8080/ner/ner但 Jetty 只给了我一个 HTTP 500,与上述相同的例外。在终端中,一切正常,但在 Eclipse 中却不行。似乎 Eclipse 期待不同的文件夹结构或其他东西。

你知道什么可能导致这个问题吗?如果您需要查看某些文件的内容,请告诉我,我会将它们添加到此帖子中。提前非常感谢!

4

1 回答 1

0

我发现这个错误是一个皇家 PITA - 不幸的是它可能来自多个来源。对于几种不同的情况,错误消息似乎有点笼统。

首先,您需要确保您在 war 文件中使用的库都“正确对齐”。我发现这个问题在这个问题中得到了最好的回答。

但这仍然可能无法解决问题 - 它没有在这里!因此,如果您有自己的标签库并使用保留字,那似乎也会导致错误。

例如:

    <jsp:directive.attribute
            name="minimize"
            type="java.lang.Boolean"
            required="true"
            description="Compress something"/>

在这种情况下,“最小化”会导致冲突,并且可以通过此错误消息进行报告。

于 2012-09-12T20:08:00.510 回答