I write a web service program on NetBeans . it's work without any problem with GlassFish server but when I want to run by Tomcat 7.xx I received this error:
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.
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. Tomcat, on the other hand, is a barebones servletcontainer which ships with only JSP, Servlet and EL. Tomcat does not ship with JSF bundled.
You need to either install JSF in Tomcat, or to prodive JSF yourself along with the webapp. Glassfish ships with the JSF reference implementation Mojarra . If you download it, you'll find a javax.faces.jar
file in the zip file. 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.
I'd guess you are missing some JAR files in your classpath, read the following similar questions:
http://anilsaldhana.blogspot.de/2009/07/tomcat-error-only-type-can-be-imported.html
Java error: Only a type can be imported. XYZ resolves to a package
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.