Tomcat 使用 selenium 时无法编译 class
Tomcat can't compile class when using selenium
我在笔记本电脑上 运行ning Debian Jessie。安装了 Tomcat8 服务器。当 运行 一个简单的网络应用程序时,这似乎工作正常。
但是在添加 selenium (selenium-server-standalone-2.45.0.jar) 我得到
HTTP Status 500 - Unable to compile class for JSP: type Exception report
message Unable to compile class for JSP:
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: [31] in the generated java file: [<path>]
The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory
通过右键单击“库”>“添加库”将 jar 添加到 WEB-INF/lib 中的 eclipse 或 netbeans 中
取出硒罐后,一切正常。
当我 运行 安装的项目 tomcat 失败时。当我 运行 带有 tomcat 服务器的项目在 netbeans 中失败时。
当同一个项目从我的电脑导出并导入 运行ning windows 的朋友电脑时,它工作得很好。
有人知道我做错了什么吗?谢谢!
问题是 selenium-server-jar 旨在 运行 作为一个独立的应用程序。因此它包含自己的 servlet 容器。
当您尝试在另一个 servlet 容器(您的 tomcat)中 运行 它时,tomcat-运行 时间会尝试编译一个 jsp但是对于这个网络应用程序,selenium-jar 似乎放在 tomcat 自己的罐子之前的 class 路径上。由于 tomcat 和 selenium 的 jasper 版本之间似乎也存在版本不匹配,这必然会导致 trouble:tomcat 使用 servlet-version 3.1 并期望 getJspApplicationContext(ServletContext)
中的方法 class javax.servlet.jsp.JspFactory
(这是在 servlet-spec 2.1 中添加的)。但是这个 class 似乎是从 selenium-jar 加载的并且包含一个旧的 jasper-version 仍然缺少这个方法(它似乎只支持 servlet-version 2.0)。
tl;博士:
不要在 servlet 容器中使用 selenium-server-jar。
我在笔记本电脑上 运行ning Debian Jessie。安装了 Tomcat8 服务器。当 运行 一个简单的网络应用程序时,这似乎工作正常。 但是在添加 selenium (selenium-server-standalone-2.45.0.jar) 我得到
HTTP Status 500 - Unable to compile class for JSP: type Exception report
message Unable to compile class for JSP:
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: [31] in the generated java file: [<path>]
The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory
通过右键单击“库”>“添加库”将 jar 添加到 WEB-INF/lib 中的 eclipse 或 netbeans 中 取出硒罐后,一切正常。 当我 运行 安装的项目 tomcat 失败时。当我 运行 带有 tomcat 服务器的项目在 netbeans 中失败时。 当同一个项目从我的电脑导出并导入 运行ning windows 的朋友电脑时,它工作得很好。
有人知道我做错了什么吗?谢谢!
问题是 selenium-server-jar 旨在 运行 作为一个独立的应用程序。因此它包含自己的 servlet 容器。
当您尝试在另一个 servlet 容器(您的 tomcat)中 运行 它时,tomcat-运行 时间会尝试编译一个 jsp但是对于这个网络应用程序,selenium-jar 似乎放在 tomcat 自己的罐子之前的 class 路径上。由于 tomcat 和 selenium 的 jasper 版本之间似乎也存在版本不匹配,这必然会导致 trouble:tomcat 使用 servlet-version 3.1 并期望 getJspApplicationContext(ServletContext)
中的方法 class javax.servlet.jsp.JspFactory
(这是在 servlet-spec 2.1 中添加的)。但是这个 class 似乎是从 selenium-jar 加载的并且包含一个旧的 jasper-version 仍然缺少这个方法(它似乎只支持 servlet-version 2.0)。
tl;博士: 不要在 servlet 容器中使用 selenium-server-jar。