如何从错误调试的OFBiz应用“865(HTTP-0.0.0.0-443-5)[JavaEventHandler.ja VA:100:ERROR]”

进出口新的ofbiz.So是我的问题是有什么错误原谅我的mistakes.Im新的ofbiz,所以我不知道在ofbiz.Sometimes一些术语,我的问题是因为在ofbiz.So试图知识的缺乏不明确明白我的问题,并给我很高的水平相对于我的level.Because很好地解决了一些解决方案能不能够理解me.So请给有很好的例子解决方案。

我的项目即“productionmgntSystem”是folder.In项目中,我有一个文件,即“app_details_1.ftl”具有以下的编码“的ofbiz /热部署”

<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <!--<meta http-equiv="Content-Type" content="multipart/form-data; charset=ISO-8859-1">--> <title>Insert title here</title> <script TYPE="TEXT/JAVASCRIPT" language=""JAVASCRIPT"> function uploadFile() { //alert("Before calling upload.jsp"); window.location='<@ofbizUrl>testing_service1</@ofbizUrl>' } function logout1() { //alert("Logout1"); alert("<@ofbizUrl>logout1</@ofbizUrl>"); window.location='<@ofbizUrl>logout1</@ofbizUrl>' } </script> </head> <!-- <form action="<@ofbizUrl>testing_service1</@ofbizUrl>" enctype="multipart/form-data" name="app_details_frm"> --> <form enctype="multipart/form-data" action="<@ofbizUrl>uploadAttachFile</@ofbizUrl>" METHOD=POST> <center style="height: 299px; "> <table border="0" style="height: 177px; width: 788px"> <tr style="height: 115px; "> <td style="width: 103px; "> <td style="width: 413px; "><h1>APPLICATION DETAILS</h1> <td style="width: 55px; "> </tr> <tr> <td style="width: 125px; ">Application name : </td> <td> <input name="app_name_txt" id="txt_1" value=" " /> </td> </tr> <tr> <td style="width: 125px; ">Excell sheet &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </td> <td> <input type="file" name="filename"/> </td> </tr> <tr> <td> <input type="button" name="logout1_cmd" value="Logout" onclick="logout1()"/> <!-- <input type="submit" name="logout_cmd" value="logout"/>--> </td> <td> <input type="submit" name="upload_cmd" value="UPLOAD" /> <!-- <input type="button" name="upload1_cmd" value="Upload" onclick="uploadFile()"/> --> </td> </tr> </table> </center> </form> </html>

下面是一些本的编码中的“controller.xml”文件

.......... .......... ........... <request-map uri="uploadAttachFile"> <security https="true" auth="true"/> <!-- <event type="simple" invoke="createCommunicationContent" path="component://productionmgntSystem/script/org/ofbiz/productionmgntSystem/CommunicationEventEvents.xml"/> --> <event type="java" path="org.ofbiz.productionmgntSystem.web_app_req.Uploading" invoke="uploadFile"/> <response name="AttachementSuccess" type="view" value="AttachementSuccess"/> <response name="AttachementException" type="view" value="AttachementException"/> </request-map> ............... ........... ............ <!-- I DEFINED - START --> <view-map name="AttachmentError" type="ftl" page="file_attach_error.ftl"/> <view-map name="AttachementException" type="ftl" page="file_attach_error.ftl"/> <view-map name="AttachementSuccess" type="ftl" page="AttachementSuccess.ftl"/> <!-- I DEFINED - END --> ............... ............... .............

以下是在文件“AttachementSuccess.ftl”的编码

<html> <head> <title>FILE ATTACH SUCCESS</title> </head> <form action="<@ofbizUrl>logout1</@ofbizUrl>" enctype="multipart/form-data" name="file_attach_error_frm"> <table> <tr> <td> <td> <td> </tr> <tr> <td> <td>File attachement success</td> <td> </tr> <tr> <td> <td><input type="submit" value="LOGOUT"/></td> <td> </tr> </table> </form> </html>

以下是编码本中的文件“file_attach_error.ftl”

<html> <head> <title>FILE ATTACH ERROR</title> </head> <form action="<@ofbizUrl>logout1</@ofbizUrl>" enctype="multipart/form-data" name="file_attach_error_frm"> <table> <tr> <td> <td> <td> </tr> <tr> <td> <td>File attachement error</td> <td> </tr> <tr> <td> <td><input type="submit" value="LOGOUT"/></td> <td> </tr> </table> </form> </html>

以下是文件中的编码“Uploading.java”

//UPLOADING A CONTENT TO THE SERVER package org.ofbiz.productionmgntSystem.web_app_req; import java.io.File; import java.nio.ByteBuffer; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; import org.ofbiz.service.ServiceUtil; import java.util.List; public class Uploading { public static String uploadFile(HttpServletRequest request,HttpServletResponse response) { //ServletFileUpload fu = new ServletFileUpload(new DiskFileItemFactory(10240, new File(new File("runtime"), "tmp"))); //Creation of servletfileupload System.out.println("\n\n\t****************************************\n\tuploadFile(HttpServletRequest request,HttpServletResponse response) - start\n\t"); ServletFileUpload fu = new ServletFileUpload(new DiskFileItemFactory()); //Creation of servletfileupload java.util.List lst = null; String result="AttachementException"; try { lst = fu.parseRequest(request); } catch (FileUploadException fup_ex) { System.out.println("\n\n\t****************************************\n\tException of FileUploadException \n\t"); fup_ex.printStackTrace(); result="AttachementException"; return(result); } if(lst.size()==0) //There is no item in lst { System.out.println("\n\n\t****************************************\n\tLst count is 0 \n\t"); result="AttachementException"; return(result); } FileItem file_item = null; FileItem selected_file_item=null; //Checking for form fields - Start for (int i=0; i < lst.size(); i++) { file_item=(FileItem)lst.get(i); String fieldName = file_item.getFieldName(); //Check for the attributes for user selected file - Start if(fieldName.equals("filename")) { selected_file_item=file_item; break; } //Check for the attributes for user selected file - End } //Checking for form fields - End //Uploading the file content - Start if(selected_file_item==null) //If selected file item is null { System.out.println("\n\n\t****************************************\n\tThe selected file item is null\n\t"); result="AttachementException"; return(result); } byte[] file_bytes=selected_file_item.get(); ByteBuffer byteWrap=ByteBuffer.wrap(file_bytes); byte[] extract_bytes=null; byteWrap.get(extract_bytes); System.out.println("\n\n\t****************************************\n\tExtract succeeded :content are : \n\t"); if(extract_bytes==null) { System.out.println("\n\n\t****************************************\n\tExtract bytes is null\n\t"); result="AttachementException"; return(result); } for(int k=0;k<extract_bytes.length;k++) System.out.print((char)extract_bytes[k]); System.out.println("\n\n\t****************************************\n\tuploadFile(HttpServletRequest request,HttpServletResponse response) - end\n\t"); return("AttachementSuccess"); //Uploading the file content - End } }

我想用“tag.When我执行在浏览器中显示以下错误应用程序上传文件到服务器。 如何从错误调试的OFBiz应用“865(HTTP-0.0.0.0-443-5)[JavaEventHandler.ja VA:100:ERROR]”


在堆栈跟踪打印在控制台下

[java] 2010-12-29 10:56:38,336 (http-0.0.0.0-443-1) [ JavaEventHandler.ja va:100:ERROR] [java] ---- runtime exception report -------------------------------------- ------------ [java] Problems Processing Event [java] Exception: java.lang.NullPointerException [java] Message: null [java] ---- stack trace --------------------------------------------------- ------------ [java] java.lang.NullPointerException [java] java.nio.ByteBuffer.get(ByteBuffer.java:675) [java] org.ofbiz.productionmgntSystem.web_app_req.Uploading.uploadFile(Uplo ading.java:76) [java] sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [java] sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl .java:39) [java] sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce ssorImpl.java:25) [java] java.lang.reflect.Method.invoke(Method.java:597) [java] org.ofbiz.webapp.event.JavaEventHandler.invoke(JavaEventHandler.java :92) [java] org.ofbiz.webapp.event.JavaEventHandler.invoke(JavaEventHandler.java :78) [java] org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java :592) [java] org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.jav a:361) [java] org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:20 2) [java] org.ofbiz.webapp.control.ControlServlet.doPost(ControlServlet.java:7 8) [java] javax.servlet.http.HttpServlet.service(HttpServlet.java:710) [java] javax.servlet.http.HttpServlet.service(HttpServlet.java:803) [java] org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(App licationFilterChain.java:290) [java] org.apache.catalina.core.ApplicationFilterChain.doFilter(Application FilterChain.java:206) [java] org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:2 59) [java] org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(App licationFilterChain.java:235) [java] org.apache.catalina.core.ApplicationFilterChain.doFilter(Application FilterChain.java:206) [java] org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapper Valve.java:233) [java] org.apache.catalina.core.StandardContextValve.invoke(StandardContext Valve.java:175) [java] org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve. java:128) [java] org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve. java:102) [java] org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVa lve.java:109) [java] org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java :568) [java] org.ofbiz.catalina.container.CrossSubdomainSessionValve.invoke(Cross SubdomainSessionValve.java:62) [java] org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.ja va:286) [java] org.apache.coyote.http11.Http11Processor.process(Http11Processor.jav a:844) [java] org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proc ess(Http11Protocol.java:583) [java] org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:4 47) [java] java.lang.Thread.run(Thread.java:619) [java] -------------------------------------------------------------------- ------------ [java] [java] 2010-12-29 10:56:38,336 (http-0.0.0.0-443-1) [ ControlServlet.ja va:205:ERROR] [java] ---- exception report ---------------------------------------------- ------------ [java] Error in request handler: [java] Exception: org.ofbiz.webapp.event.EventHandlerException [java] Message: Problems processing event: java.lang.NullPointerException ( null) [java] ---- cause --------------------------------------------------------- ------------ [java] Exception: java.lang.NullPointerException [java] Message: null [java] ---- stack trace --------------------------------------------------- ------------ [java] java.lang.NullPointerException [java] java.nio.ByteBuffer.get(ByteBuffer.java:675) [java] org.ofbiz.productionmgntSystem.web_app_req.Uploading.uploadFile(Uplo ading.java:76) [java] sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [java] sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl .java:39) [java] sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce ssorImpl.java:25) [java] java.lang.reflect.Method.invoke(Method.java:597) [java] org.ofbiz.webapp.event.JavaEventHandler.invoke(JavaEventHandler.java :92) [java] org.ofbiz.webapp.event.JavaEventHandler.invoke(JavaEventHandler.java :78) [java] org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java :592) [java] org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.jav a:361) [java] org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:20 2) [java] org.ofbiz.webapp.control.ControlServlet.doPost(ControlServlet.java:7 8) [java] javax.servlet.http.HttpServlet.service(HttpServlet.java:710) [java] javax.servlet.http.HttpServlet.service(HttpServlet.java:803) [java] org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(App licationFilterChain.java:290) [java] org.apache.catalina.core.ApplicationFilterChain.doFilter(Application FilterChain.java:206) [java] org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:2 59) [java] org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(App licationFilterChain.java:235) [java] org.apache.catalina.core.ApplicationFilterChain.doFilter(Application FilterChain.java:206) [java] org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapper Valve.java:233) [java] org.apache.catalina.core.StandardContextValve.invoke(StandardContext Valve.java:175) [java] org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve. java:128) [java] org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve. java:102) [java] org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVa lve.java:109) [java] org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java :568) [java] org.ofbiz.catalina.container.CrossSubdomainSessionValve.invoke(Cross SubdomainSessionValve.java:62) [java] org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.ja va:286) [java] org.apache.coyote.http11.Http11Processor.process(Http11Processor.jav a:844) [java] org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proc ess(Http11Protocol.java:583) [java] org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:4 47) [java] java.lang.Thread.run(Thread.java:619) [java] -------------------------------------------------------------------- ------------ [java] [java] 2010-12-29 10:56:38,336 (http-0.0.0.0-443-1) [ ControlServlet.ja va:221:ERROR] An error occurred, going to the errorPage: /error/error.jsp [java] 2010-12-29 10:56:38,351 (http-0.0.0.0-443-1) [ ControlServlet.ja va:228:ERROR] Including errorPage: /error/error.jsp [java] 2010-12-29 10:56:38,367 (http-0.0.0.0-443-1) [ ControlServlet.ja va:302:INFO ] [[[uploadAttachFile] Request Done- total:0.063,since last([uploadA ttachFile...):0.063]]

我不能能解决issue.So请帮我解决这个问题。

感谢和问候,Sivakumar.J

--------------解决方案-------------

Uploading.uploadFile()方法有两条线(接近尾声)所示:

byte[] extract_bytes=null;
byteWrap.get(extract_bytes);

因为你是传递一个null数组来get()方法,你得到一个NullPointerException

分类:java的 时间:2015-03-14 人气:0
分享到:

相关文章

Copyright (C) 55228885.com, All Rights Reserved.

55228885 版权所有 京ICP备15002868号

processed in 1.309 (s). 10 q(s)