简体   繁体   English

Glassfish和Tomcat

[英]Glassfish and Tomcat

I write a web service program on NetBeans . 我在NetBeans上编写了一个Web服务程序。 it's work without any problem with GlassFish server but when I want to run by Tomcat 7.xx I received this error: 它的工作没有GlassFish服务器的任何问题,但当我想运行Tomcat 7.xx时,我收到此错误:

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. com.sun.faces.facelets.tag.jsf.core.ConvertDateTimeHandler resolves to a package

Stacktrace:
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:97)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:457)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:374)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:352)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:339)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:594)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:344)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)

Anybody can help me? 有人可以帮帮我吗?

The in the exception message mentioned class is part of JSF. 在提到的异常消息中,类是JSF的一部分。

Glassfish is a full fledged Java EE application server and ships with JSP, Servlet, EL, JSF, JPA, EJB, JAX-RS and all that other fancy Java EE stuff bundled. Glassfish是一个成熟的Java EE应用服务器,附带JSP,Servlet,EL,JSF,JPA,EJB,JAX-RS以及其他所有其他精美的Java EE产品。 Tomcat, on the other hand, is a barebones servletcontainer which ships with only JSP, Servlet and EL. 另一方面,Tomcat是一个独立的servlet容器,它只附带JSP,Servlet和EL。 Tomcat does not ship with JSF bundled. Tomcat不附带JSF捆绑。

You need to either install JSF in Tomcat, or to prodive JSF yourself along with the webapp. 您需要在Tomcat中安装JSF,或者自己使用webapp来激活JSF。 Glassfish ships with the JSF reference implementation Mojarra . Glassfish附带JSF参考实现Mojarra If you download it, you'll find a javax.faces.jar file in the zip file. 如果你下载它,你会在zip文件中找到一个javax.faces.jar文件。 If you copy this into the /WEB-INF/lib folder of your webapp, rebuild the webapp and redeploy to Tomcat, then this problem should disappear. 如果将其复制到webapp的/WEB-INF/lib文件夹中,重建webapp并重新部署到Tomcat,则此问题应该消失。

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

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