0
我部署我的第7 tomcat的web應用到我的生產服務器,我有麻煩......類型不匹配:不能從ArrayList中<?>轉換爲ArrayList的<String>在Tomcat的7
的Web應用程序完美的作品上我的開發機器在Eclicpse Luna內部安裝了tomcat 7。 但是,當我試圖在生產服務器上運行(Ubuntu的12.04 + Tomcat的7 +的OpenJDK-7的JRE,無頭),login.jsp頁面給了我很多的編譯錯誤的:
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 10 in the jsp file: /header.jsp
Type mismatch: cannot convert from ArrayList<?> to ArrayList<String>
7: <head>
8: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
9: <%
10: ArrayList<String> whiteList = new ArrayList<>(
11: Arrays.asList("login.jsp"));
12:
13: String pg = request.getRequestURI().substring(request.getRequestURI().lastIndexOf("/")+1);
An error occurred at line: 10 in the jsp file: /header.jsp
Cannot instantiate the type ArrayList<?>
7: <head>
8: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
9: <%
10: ArrayList<String> whiteList = new ArrayList<>(
11: Arrays.asList("login.jsp"));
12:
13: String pg = request.getRequestURI().substring(request.getRequestURI().lastIndexOf("/")+1);
An error occurred at line: 10 in the jsp file: /header.jsp
Syntax error on token "<", ? expected after this token
7: <head>
8: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
9: <%
10: ArrayList<String> whiteList = new ArrayList<>(
11: Arrays.asList("login.jsp"));
12:
13: String pg = request.getRequestURI().substring(request.getRequestURI().lastIndexOf("/")+1);
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:331)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:457)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
我猜我失去了我的生產機器或在配置文件中的東西...
ArrayList whiteList = new ArrayList ? –
xcoder
2015-03-25 09:49:02
以及它可能是,但爲什麼相同的編譯在我的本地tomcat,而不是在Ubuntu的Tomcat? – lviggiani 2015-03-25 09:52:07
是的...這是問題(對我來說很遺憾)...仍然在想爲什麼它會在我的本地機器上編譯。 – lviggiani 2015-03-25 09:55:49