在Ubuntu中,我运行的是Tomcat 6,浏览器底部的Tomcat版本显示:
Apache Tomcat/6.0.28
我通过 apt-get 安装了 Tomcat。我制作了一些“hello world”servlet,并确认 Tomcat 6 似乎工作正常。
由于我的最终目标是制作一个 Web 服务,所以我去寻找 axis2。我找不到 axis2 的任何 Ubuntu 软件包,因此我接下来从 此处并将其解压缩到我的主目录中。首先,我指向了一个符号链接
/var/lib/tomcat6/webapps/axis2 ->; /home/doug/.../axis2-1.6.1/webapp/ 基于 这些说明。
浏览到 http://localhost:8080/axis2/ 我希望看到基本的 axis2 (管理?)页面。相反,我收到大量错误,抱怨无法编译 axis2 的 jsp:
Type Exception report
message
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: 6 in the generated java file
Only a type can be imported. org.apache.axis2.Constants resolves to a package
An error occurred at line: 7 in the generated java file
Only a type can be imported. org.apache.axis2.context.ConfigurationContext resolves to a package
An error occurred at line: 8 in the generated java file
Only a type can be imported. org.apache.axis2.description.Parameter resolves to a package
An error occurred at line: 9 in the generated java file
Only a type can be imported. org.apache.axis2.transport.http.AxisServlet resolves to a package
An error occurred at line: 10 in the generated java file
Only a type can be imported. org.apache.axis2.transport.TransportListener resolves to a package
An error occurred at line: 31 in the jsp file: /axis2-web/include/httpbase.jsp
ConfigurationContext cannot be resolved to a type
28:
29: public void jspInit() {
30: ServletContext context = this.getServletConfig().getServletContext();
31: ConfigurationContext configctx = (ConfigurationContext) context.getAttribute(AxisServlet.CONFIGURATION_CONTEXT);
32: if (configctx != null) {
33: Parameter parameter = configctx.getAxisConfiguration().getParameter(Constants.HTTP_FRONTEND_HOST_URL);
34: if (parameter != null) {
An error occurred at line: 31 in the jsp file: /axis2-web/include/httpbase.jsp
ConfigurationContext cannot be resolved to a type
28:
29: public void jspInit() {
30: ServletContext context = this.getServletConfig().getServletContext();
31: ConfigurationContext configctx = (ConfigurationContext) context.getAttribute(AxisServlet.CONFIGURATION_CONTEXT);
32: if (configctx != null) {
33: Parameter parameter = configctx.getAxisConfiguration().getParameter(Constants.HTTP_FRONTEND_HOST_URL);
34: if (parameter != null) {
An error occurred at line: 31 in the jsp file: /axis2-web/include/httpbase.jsp
AxisServlet.CONFIGURATION_CONTEXT cannot be resolved to a type
28:
29: public void jspInit() {
30: ServletContext context = this.getServletConfig().getServletContext();
31: ConfigurationContext configctx = (ConfigurationContext) context.getAttribute(AxisServlet.CONFIGURATION_CONTEXT);
32: if (configctx != null) {
33: Parameter parameter = configctx.getAxisConfiguration().getParameter(Constants.HTTP_FRONTEND_HOST_URL);
34: if (parameter != null) {
An error occurred at line: 33 in the jsp file: /axis2-web/include/httpbase.jsp
Parameter cannot be resolved to a type
30: ServletContext context = this.getServletConfig().getServletContext();
31: ConfigurationContext configctx = (ConfigurationContext) context.getAttribute(AxisServlet.CONFIGURATION_CONTEXT);
32: if (configctx != null) {
33: Parameter parameter = configctx.getAxisConfiguration().getParameter(Constants.HTTP_FRONTEND_HOST_URL);
34: if (parameter != null) {
35: frontendHostUrl = (String) parameter.getValue();
36: }
An error occurred at line: 33 in the jsp file: /axis2-web/include/httpbase.jsp
Constants.HTTP_FRONTEND_HOST_URL cannot be resolved to a type
30: ServletContext context = this.getServletConfig().getServletContext();
31: ConfigurationContext configctx = (ConfigurationContext) context.getAttribute(AxisServlet.CONFIGURATION_CONTEXT);
32: if (configctx != null) {
33: Parameter parameter = configctx.getAxisConfiguration().getParameter(Constants.HTTP_FRONTEND_HOST_URL);
34: if (parameter != null) {
35: frontendHostUrl = (String) parameter.getValue();
36: }
An error occurred at line: 37 in the jsp file: /axis2-web/include/httpbase.jsp
Parameter cannot be resolved to a type
34: if (parameter != null) {
35: frontendHostUrl = (String) parameter.getValue();
36: }
37: Parameter hostnameParam = configctx.getAxisConfiguration().getParameter(TransportListener.HOST_ADDRESS);
38: if (hostnameParam != null) {
39: hostname = (String) hostnameParam.getValue();
40: }
An error occurred at line: 37 in the jsp file: /axis2-web/include/httpbase.jsp
TransportListener.HOST_ADDRESS cannot be resolved to a type
34: if (parameter != null) {
35: frontendHostUrl = (String) parameter.getValue();
36: }
37: Parameter hostnameParam = configctx.getAxisConfiguration().getParameter(TransportListener.HOST_ADDRESS);
38: if (hostnameParam != null) {
39: hostname = (String) hostnameParam.getValue();
40: }
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968)
org.apache.jsp.axis2_002dweb.index_jsp._jspService(index_jsp.java:59)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
我不应该尝试使用 Tomcat 6 最新的 axis2 吗?我应该使用 Ubuntu 软件包吗?
In Ubuntu, I'm running Tomcat 6, the Tomcat version on the bottom of the browser reads:
Apache Tomcat/6.0.28
I installed Tomcat via apt-get
. I made some "hello world" servlets and confirmed that Tomcat 6 appears to be working correctly.
Since my end goal was to make a webservice, I went to look for axis2. I couldn't find any Ubuntu packages for axis2, so I next went and downloaded axis2 v 1.6.1 from here and unzipped it in my home directory. To get started, I pointed a symbolic link from
/var/lib/tomcat6/webapps/axis2 -> /home/doug/.../axis2-1.6.1/webapp/ based on these instructions.
Browsing to http://localhost:8080/axis2/ I expect to see basic axis2 (admin?) pages. Instead I get a slew of errors complaining about failing to compile axis2's jsp:
Type Exception report
message
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: 6 in the generated java file
Only a type can be imported. org.apache.axis2.Constants resolves to a package
An error occurred at line: 7 in the generated java file
Only a type can be imported. org.apache.axis2.context.ConfigurationContext resolves to a package
An error occurred at line: 8 in the generated java file
Only a type can be imported. org.apache.axis2.description.Parameter resolves to a package
An error occurred at line: 9 in the generated java file
Only a type can be imported. org.apache.axis2.transport.http.AxisServlet resolves to a package
An error occurred at line: 10 in the generated java file
Only a type can be imported. org.apache.axis2.transport.TransportListener resolves to a package
An error occurred at line: 31 in the jsp file: /axis2-web/include/httpbase.jsp
ConfigurationContext cannot be resolved to a type
28:
29: public void jspInit() {
30: ServletContext context = this.getServletConfig().getServletContext();
31: ConfigurationContext configctx = (ConfigurationContext) context.getAttribute(AxisServlet.CONFIGURATION_CONTEXT);
32: if (configctx != null) {
33: Parameter parameter = configctx.getAxisConfiguration().getParameter(Constants.HTTP_FRONTEND_HOST_URL);
34: if (parameter != null) {
An error occurred at line: 31 in the jsp file: /axis2-web/include/httpbase.jsp
ConfigurationContext cannot be resolved to a type
28:
29: public void jspInit() {
30: ServletContext context = this.getServletConfig().getServletContext();
31: ConfigurationContext configctx = (ConfigurationContext) context.getAttribute(AxisServlet.CONFIGURATION_CONTEXT);
32: if (configctx != null) {
33: Parameter parameter = configctx.getAxisConfiguration().getParameter(Constants.HTTP_FRONTEND_HOST_URL);
34: if (parameter != null) {
An error occurred at line: 31 in the jsp file: /axis2-web/include/httpbase.jsp
AxisServlet.CONFIGURATION_CONTEXT cannot be resolved to a type
28:
29: public void jspInit() {
30: ServletContext context = this.getServletConfig().getServletContext();
31: ConfigurationContext configctx = (ConfigurationContext) context.getAttribute(AxisServlet.CONFIGURATION_CONTEXT);
32: if (configctx != null) {
33: Parameter parameter = configctx.getAxisConfiguration().getParameter(Constants.HTTP_FRONTEND_HOST_URL);
34: if (parameter != null) {
An error occurred at line: 33 in the jsp file: /axis2-web/include/httpbase.jsp
Parameter cannot be resolved to a type
30: ServletContext context = this.getServletConfig().getServletContext();
31: ConfigurationContext configctx = (ConfigurationContext) context.getAttribute(AxisServlet.CONFIGURATION_CONTEXT);
32: if (configctx != null) {
33: Parameter parameter = configctx.getAxisConfiguration().getParameter(Constants.HTTP_FRONTEND_HOST_URL);
34: if (parameter != null) {
35: frontendHostUrl = (String) parameter.getValue();
36: }
An error occurred at line: 33 in the jsp file: /axis2-web/include/httpbase.jsp
Constants.HTTP_FRONTEND_HOST_URL cannot be resolved to a type
30: ServletContext context = this.getServletConfig().getServletContext();
31: ConfigurationContext configctx = (ConfigurationContext) context.getAttribute(AxisServlet.CONFIGURATION_CONTEXT);
32: if (configctx != null) {
33: Parameter parameter = configctx.getAxisConfiguration().getParameter(Constants.HTTP_FRONTEND_HOST_URL);
34: if (parameter != null) {
35: frontendHostUrl = (String) parameter.getValue();
36: }
An error occurred at line: 37 in the jsp file: /axis2-web/include/httpbase.jsp
Parameter cannot be resolved to a type
34: if (parameter != null) {
35: frontendHostUrl = (String) parameter.getValue();
36: }
37: Parameter hostnameParam = configctx.getAxisConfiguration().getParameter(TransportListener.HOST_ADDRESS);
38: if (hostnameParam != null) {
39: hostname = (String) hostnameParam.getValue();
40: }
An error occurred at line: 37 in the jsp file: /axis2-web/include/httpbase.jsp
TransportListener.HOST_ADDRESS cannot be resolved to a type
34: if (parameter != null) {
35: frontendHostUrl = (String) parameter.getValue();
36: }
37: Parameter hostnameParam = configctx.getAxisConfiguration().getParameter(TransportListener.HOST_ADDRESS);
38: if (hostnameParam != null) {
39: hostname = (String) hostnameParam.getValue();
40: }
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968)
org.apache.jsp.axis2_002dweb.index_jsp._jspService(index_jsp.java:59)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
Should I not be trying the latest axis2 with Tomcat 6? Is there an Ubuntu package I should be using instead?
发布评论
评论(3)
这些令人困惑的 JSP 编译错误实际上
NoClassDefFoundError
都隐藏在其中,在您的特定情况下,这又意味着 Axis 相关库(JAR 文件)不存在于 web 应用程序中运行时类路径。 web 应用程序的/WEB-INF/lib
文件夹是 web 应用程序的运行时类路径的一部分,因此将它们放在那里。Those confusing JSP compilation errors are under the covers actually
NoClassDefFoundError
s, which in your particular case in turn means that the Axis related libraries (JAR files) are not present in the webapp's runtime classpath. The webapp's/WEB-INF/lib
folder is part of the webapp's runtime classpath, so put them in there.您所指的快速入门指南并没有说您应该从 /var/lib/tomcat6/webapps/axis2 -> /home/doug/.../axis2-1.6.1/webapp 创建“符号链接” /”。它说您应该“将 axis2.war 文件复制到 servlet 引擎的 webapps 目录”。有两种方法可以获取 axis2.war 文件:
The quick start guide you are referring to doesn't say that you should create a "symbolic link from /var/lib/tomcat6/webapps/axis2 -> /home/doug/.../axis2-1.6.1/webapp/". It says the you should "Copy the axis2.war file to the webapps directory of your servlet engine". There are two ways to get the axis2.war file:
我已经下载了 axis2-1.6.2-bin.zip 并使用 Window -> 将其添加到 eclipse 中首选项->网络服务 -> Axis2 Preferences -> Axis2 Runtime
然后从java类创建webservice。
使用 axis2-1.6.2-bin 而不是 axis2-1.7.3-bin 解决了该问题。
I have downloaded axis2-1.6.2-bin.zip and added it in eclipse using Window -> Preferences -> Web Services -> Axis2 Preferences ->Axis2 Runtime
Then created webservice from java class.
Using axis2-1.6.2-bin instead of axis2-1.7.3-bin resolved the issue.