简体   繁体   English

Weblogic应用程序服务器在servlet映射到HTML文件的日志中记录JSP错误

[英]Weblogic Application server logs JSP error on servlet mapping to HTML file

I got a Weblogic (12c) application server and deploy an EAR (contining my WAR) to it. 我得到了Weblogic(12c)应用程序服务器,并在其上部署了EAR(继续执行我的WAR)。 In the web.xml I have a servlet-mapping to redirect to a HTML page like the following: 在web.xml中,我有一个servlet映射来重定向到HTML页面,如下所示:

<?xml version="1.0"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         version="3.0">
    <description>my webapp</description>
    <servlet>
        <servlet-name>servlet_name</servlet-name>
        <jsp-file>/webapp/index.html</jsp-file>
    </servlet>
  <servlet-mapping>
    <servlet-name>servlet_name</servlet-name>
    <url-pattern>/webapp/*</url-pattern>
  </servlet-mapping>
</web-app>

This seems working but in my server log I got folloing error message: 这似乎可行,但是在服务器日志中出现以下错误消息:

####<Oct 31, 2018, 1:25:16,132 PM GMT> <Error> .... <[ServletContext@563785877[app:myApp module:myApp-client path:null spec-version:3.1]] Root cause of ServletException.
weblogic.servlet.jsp.CompilationException: Failed to compile JSP /webapp/index.html
Exception occurred while processing '/opt/oracle/product/fusionMy/myDomain/domains/myDomain/servers/myApp/tmp/_WL_user/myApp-client/sz8ux3/war/webapp/index.html'java.lang.NullPointerException
    at weblogic.jsp.internal.ProxySourceFile._check(ProxySourceFile.java:151)
    at weblogic.jsp.internal.SourceFile.masterCheck(SourceFile.java:782)
    at weblogic.jsp.internal.SourceFile.check(SourceFile.java:314)
    at weblogic.jsp.internal.SourceFile.check(SourceFile.java:335)
    at weblogic.jsp.internal.ProxySourceFile.codeGen(ProxySourceFile.java:229)
    at weblogic.jsp.internal.SourceFile.codeGen(SourceFile.java:327)
    at weblogic.jsp.internal.client.ClientUtilsImpl$CodeGenJob.run(ClientUtilsImpl.java:626)
    at weblogic.jsp.internal.client.Job.performJob(Job.java:85)
    at weblogic.jsp.internal.client.ThreadPool$WorkerThread.run(ThreadPool.java:219)
index.html: java.lang.NullPointerException

    at weblogic.servlet.jsp.JavelinxJSPStub.reportCompilationErrorIfNeccessary(JavelinxJSPStub.java:247)
    at weblogic.servlet.jsp.JavelinxJSPStub.compilePage0(JavelinxJSPStub.java:183)
    at weblogic.servlet.jsp.JavelinxJSPStub.access$000(JavelinxJSPStub.java:50)
    at weblogic.servlet.jsp.JavelinxJSPStub$1.run(JavelinxJSPStub.java:111)
    at java.security.AccessController.doPrivileged(Native Method)
    at weblogic.servlet.jsp.JavelinxJSPStub.compilePage(JavelinxJSPStub.java:108)
    at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:267)
    at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:218)
    at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:414)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:304)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:247)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3679)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3649)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:326)
    at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197)
    at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
    at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)
    at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2433)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2281)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2259)
    at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1691)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1651)
    at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:270)
    at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348)
    at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333)
    at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54)
    at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
    at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:640)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:406)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:346)

based on other SO posts I assumed that that should work - but what is this error message saying? 基于其他SO帖子,我认为这应该可行-但是此错误消息在说什么?
Is this not allowed - to redirect to a HTML page in the jsp-file tag? 是否不允许-重定向到jsp-file标记中的HTML页面?
What is the right way of doing this in a WAR file? 在WAR文件中执行此操作的正确方法是什么?

On my local Tomcat (8.5) it seem to work without that error in logs (deployed WAR). 在我的本地Tomcat(8.5)上,它似乎在日志中没有该错误的情况下工作(部署了WAR)。
In Weblogic I first get an error but every further request is working ... 在Weblogic中,我首先收到一个错误,但是每一个进一步的请求都在起作用...

HTML file (one version I tested): HTML文件(我测试过的一个版本):

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Simple Test!</title>
  <base href="/webapp/">
</head>
<body>
    <h1>HALLO</h1>
</body>
</html>

Here you specifiy a jsp file, but you are passing a html file. 在这里,您指定了一个jsp文件,但是您正在传递一个html文件。

 <jsp-file>/webapp/index.html</jsp-file>

Hence your error: 因此,您的错误:

weblogic.servlet.jsp.CompilationException: Failed to compile JSP /webapp/index.html weblogic.servlet.jsp.CompilationException:无法编译JSP /webapp/index.html

You need to swap out index.html for a jsp file to fix this. 您需要将index.html换成jsp文件才能解决此问题。 You can only use a jsp file for the <jsp-file> tag 您只能对<jsp-file>标记使用jsp文件

EDIT: 编辑:

I am mistaken. 我错了 Apparently you can have a html page inside the tag but you need to make sure that it is directly inside your context root. 显然,您可以在标记中包含一个html页面,但是您需要确保它直接位于上下文根目录中。

So in order to fix this, you need to move your .html file to your context root and use the tag like this: 因此,为了解决此问题,您需要将.html文件移动到上下文根目录,并使用如下标记:

<jsp-file>/index.html</jsp-file>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM