主题: 3.5.2上传图片“服务器发生故障”
作者: johs, 发布日期: 2011-01-12 15:27:07, 浏览数: 9889

我在本地tomcat环境下已经测试通过了,但是上传到服务器之后不能上传图片。

请各位高人及管理员帮忙解决。

firebug报错信息如下:

 

JSP 处理错误

HTTP 错误代码:   500

 

错误消息:

 

JSPG0049E: /kindeditor/jsp/upload_json.jsp 无法编译:

JSPG0091E: 文件 /kindeditor/jsp/upload_json.jsp 中的第 99 行发生错误

JSPG0093E: 文件 /kindeditor/jsp/upload_json.jsp 生成 servlet 错误

D:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\temp\web2Node01\server1\web1-new_war\web1-new.war\kindeditor\jsp\_upload_5F_json.java : 43 : The method put(Object, Object) in the type HashMap is not applicable for the arguments (String, int)

JSPG0091E: 文件 /kindeditor/jsp/upload_json.jsp 中的第 73 行发生错误

JSPG0093E: 文件 /kindeditor/jsp/upload_json.jsp 生成 servlet 错误

D:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\temp\web2Node01\server1\web1-new_war\web1-new.war\kindeditor\jsp\_upload_5F_json.java : 151 : Syntax error, parameterized types are only available if source level is 5.0

JSPG0091E: 文件 /kindeditor/jsp/upload_json.jsp 中的第 73 行发生错误

JSPG0093E: 文件 /kindeditor/jsp/upload_json.jsp 生成 servlet 错误

D:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\temp\web2Node01\server1\web1-new_war\web1-new.war\kindeditor\jsp\_upload_5F_json.java : 151 : The method asList(Object[]) of type Arrays is not generic; it cannot be parameterized with arguments <String>

JSPG0091E: 文件 /kindeditor/jsp/upload_json.jsp 中的第 88 行发生错误

JSPG0093E: 文件 /kindeditor/jsp/upload_json.jsp 生成 servlet 错误

D:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\temp\web2Node01\server1\web1-new_war\web1-new.war\kindeditor\jsp\_upload_5F_json.java : 166 : The method put(Object, Object) in the type HashMap is not applicable for the arguments (String, int)

 

根本原因:

 

com.ibm.ws.jsp.JspCoreException: JSPG0049E: /kindeditor/jsp/upload_json.jsp 无法编译:

JSPG0091E: 文件 /kindeditor/jsp/upload_json.jsp 中的第 99 行发生错误

JSPG0093E: 文件 /kindeditor/jsp/upload_json.jsp 生成 servlet 错误

D:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\temp\web2Node01\server1\web1-new_war\web1-new.war\kindeditor\jsp\_upload_5F_json.java : 43 : The method put(Object, Object) in the type HashMap is not applicable for the arguments (String, int)

JSPG0091E: 文件 /kindeditor/jsp/upload_json.jsp 中的第 73 行发生错误

JSPG0093E: 文件 /kindeditor/jsp/upload_json.jsp 生成 servlet 错误

D:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\temp\web2Node01\server1\web1-new_war\web1-new.war\kindeditor\jsp\_upload_5F_json.java : 151 : Syntax error, parameterized types are only available if source level is 5.0

JSPG0091E: 文件 /kindeditor/jsp/upload_json.jsp 中的第 73 行发生错误

JSPG0093E: 文件 /kindeditor/jsp/upload_json.jsp 生成 servlet 错误

D:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\temp\web2Node01\server1\web1-new_war\web1-new.war\kindeditor\jsp\_upload_5F_json.java : 151 : The method asList(Object[]) of type Arrays is not generic; it cannot be parameterized with arguments <String>

JSPG0091E: 文件 /kindeditor/jsp/upload_json.jsp 中的第 88 行发生错误

JSPG0093E: 文件 /kindeditor/jsp/upload_json.jsp 生成 servlet 错误

D:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\temp\web2Node01\server1\web1-new_war\web1-new.war\kindeditor\jsp\_upload_5F_json.java : 166 : The method put(Object, Object) in the type HashMap is not applicable for the arguments (String, int)

at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.translateJsp(AbstractJSPExtensionServletWrapper.java:556)

at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper._checkForTranslation(AbstractJSPExtensionServletWrapper.java:429)

at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.checkForTranslation(AbstractJSPExtensionServletWrapper.java:291)

at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:146)

at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3548)

at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:269)

at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:831)

at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1478)

at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:133)

at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:450)

at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:508)

at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:296)

at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)

at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)

at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)

at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)

at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)

at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:196)

at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:751)

at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:881)

at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1497)

 

作者: johs, 发布日期: 2011-01-12 15:31:26
本地环境用的是sun jdk6.0,服务器环境用的是ibm jdk5.0
回复
作者: johs, 发布日期: 2011-01-12 16:54:45
看样子是ibm的websphere所带的jdk的兼容问题
回复
作者: johs, 发布日期: 2011-01-17 16:31:05

根据asList的错误,修改内容如下,将原来的代码屏蔽改成:

String newFileTypes = "gif,jpg,jpeg,png,bmp";

if(fileExt==null || fileExt.equals("") || newFileTypes.indexOf(fileExt.toLowerCase())<0){

out.println(getError("上传文件扩展名是不允许的扩展名。"));

return;

}

回复
作者: johs, 发布日期: 2011-01-17 16:35:24

根据arguments (String, int)的错误,将

obj.put("error",0);

改成

obj.put("error", Integer.valueOf(0));

3个问题全部能排除并能返回200,但是出现了新的报错信息“上传目录没有写权限。”

回复
作者: johs, 发布日期: 2011-01-17 17:04:18

终于找到原因了,原来是路径没写对,现在ok了,哇哈哈哈

String savePath = pageContext.getServletContext().getRealPath("/") + "/warePics/ke/" + luser.getId().toString() + "/";

回复
作者: johs, 发布日期: 2011-01-17 17:04:44
自给自足,丰衣足食,给大家做个参考吧。
回复
发表新帖 发表回复