在Ubuntu中,我正在运行Tomcat 6,浏览器底部的Tomcat版本为:
Apache Tomcat / 6.0.28
我通过apt-get
安装了Tomcat。我制作了一些“hello world”servlet,并确认Tomcat 6似乎正常工作。
由于我的最终目标是创建一个Web服务,我去寻找axis2。我找不到任何用于axis2的Ubuntu软件包,所以我接下来从here下载了axis2 v 1.6.1并将其解压缩到我的主目录中。为了开始,我指出了一个符号链接 / var / lib / tomcat6 / webapps / axis2 - > /home/doug/.../axis2-1.6.1/webapp/基于these instructions。
浏览http://localhost:8080/axis2/我希望看到基本的axis2(admin?)页面。相反,我得到一些错误抱怨无法编译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软件包?
答案 0 :(得分:2)
令人困惑的JSP编译错误在实际 NoClassDefFoundError
的封面下,在您的特定情况下反过来意味着Web应用程序中不存在Axis相关库(JAR文件)运行时类路径。 webapp的/WEB-INF/lib
文件夹是webapp的运行时类路径的一部分,因此将它们放在那里。
答案 1 :(得分:1)
您所指的快速入门指南并未说明您应该从/ var / lib / tomcat6 / webapps / axis2 - > /home/doug /.../axis2-1.6创建“符号链接”。 1 / web应用/”。它说你应该“将axis2.war文件复制到servlet引擎的webapps目录”。获取axis2.war文件有两种方法:
答案 2 :(得分:0)
我已经下载了axis2-1.6.2-bin.zip,并使用Window - >在eclipse中添加了它。偏好 - >网络服务 - > Axis2首选项 - > Axis2运行时
然后从java类创建webservice。
使用axis2-1.6.2-bin而不是axis2-1.7.3-bin解决了这个问题。