| Author |
JRun4
|
Zein Nunna
Ranch Hand
Joined: Mar 31, 2005
Posts: 245
|
|
Does anyone know if the Jakarta commons/upload etc.. is compatible with JRun4 servlet container? Ive had a look at the jakarta website (http://jakarta.apache.org/commons/fileupload/) cant seem to find anything to do with compatibility. I have some issues and dont know if it is my code or JRun 4 thats interferring? Thanks
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
|
I haven't tried on JRun but as far as I know, it was written to the servlet spec. What problems are you having?
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
Zein Nunna
Ranch Hand
Joined: Mar 31, 2005
Posts: 245
|
|
Im getting the error below: 500 org/apache/commons/fileupload/FileUploadBase org/apache/commons/fileupload/FileUploadBase I dont know if its a compatibility issue or a coding one. There seems to be sort of issue with trying to get the header (content-type) from the JSP? Im trying to do the following: String type = request.getContentType(); And it throws the error as stated above! The JSP looks like below.... <%@ page contentType="text/html; charset=ISO-8859-1" %> <%@ page import="java.sql.*" %> <html> <head> <link rel="stylesheet" type="text/css" href="REJ_r_panel.css" /> <title>new paper</title> <%@ page language="java" %> </head> <body> <div style="position: absolute; width: 806px; height: 400px; z-index: 6; left: 0px; top: 13px; border: 1px solid #C0C0C0" id="layer6"> <div style="position: absolute; width: 31px; height: 27px; z-index: 6; left: 189px; top: 199px" id="layer12"> <font face="Arial">File</font></div> <% String user_id = request.getParameter("username"); String paper_id = request.getParameter("paper_id"); %> <div style="position: absolute; width: 460px; height: 97px; z-index: 4; left: 224px; top: 119px" id="layer10"> <form method="POST" action="./servlet/REJfiles.UploadServlet" enctype="multipart/form-data"> <p><input type="text" name="paperTitle" size="50"></p> <p><input type="text" name="coAuthors" size="50"></p> <p><input type="file" name="file" size="50"></p> <p><font face="Arial">Please make sure you have read the 'instructions for authors'</font></p> <input type="submit" value="Submit.." /> <p> </p> <p> </p> <p> </p> </form> Any ideas where im going wrong?
|
 |
Zein Nunna
Ranch Hand
Joined: Mar 31, 2005
Posts: 245
|
|
Ok ignore the above comment, I'm kind of getting to the bottom this problem now. Right in my servelet I have the line of code String arg = request.getHeader("Content-type"); This returns -------> multipart/form-data; boundary=---------------------------7d51af2016026a <------ However when I have the line boolean isMultipart = FileUpload.isMultipartContent(request); it retuns an error 500 org/apache/commons/fileupload/FileUploadBase org/apache/commons/fileupload/FileUploadBase Examining the FileUpload.isMultipartContent(request) method it has an if statement in the method that is like request.getHeader("Content-type"); if i!= null return true, else false Wheres the error comming from??
|
 |
Zein Nunna
Ranch Hand
Joined: Mar 31, 2005
Posts: 245
|
|
Just clarify the above. When i have the line String arg = request.getHeader("Content-type"); The code returns the value of the header etc.. Howevere when I have a call to a class [FileUpload.isMultipartContent(request);] that does exactly the same as (inside the method isMultipat(reuest)) request.getHeader("Content-type"); It throws an error: 500 org/apache/commons/fileupload/FileUploadBase org/apache/commons/fileupload/FileUploadBase What could be causing the error? In compilation I have no problems. What could it be? Class path error? Thanks Zein
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
Post your servlet code. Make sure to use the UBB code tags so we can read it
|
 |
Zein Nunna
Ranch Hand
Joined: Mar 31, 2005
Posts: 245
|
|
Ok i think I know what it is now. See it seems that the fileUpload package doesnt seem to want to work. During compilation I have no probs, only when I call the servlet. now the fileUpload.jar should be in the filepath? Now from the jakarta website i downloaded the commons etc.. but there wasnt a jar, so unzipped the zip and put org/apache..... in the filepath. Should I have a jar in the filepath or is it suffice to do what ive done? If so where do i get the jar from? Could this be causing the problem, that at compile time its fine, but runtime it has issues? Will post the code later for the servlet. Thanks Zein
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
|
Put the commons fileupload jars in WEB-INF/lib.
|
 |
Zein Nunna
Ranch Hand
Joined: Mar 31, 2005
Posts: 245
|
|
Thanks for the advice above Ben By default i dont have the folder WEB-INF/lib Do i just create it? Also I cant seem to find fileUpload.jar (I have got hold of a coipy from elsewhere) at the jakarta website, they have zip's and tar.gz? What others jars do I need aside from fileUpload.jar Thanks Zein
|
 |
Zein Nunna
Ranch Hand
Joined: Mar 31, 2005
Posts: 245
|
|
Well ive ironed out the bug finally. The apache package wasnt in the classpath, Im suprised it would compile without errors though? Regradless thanks for the help guys Zein
|
 |
 |
|
|
subject: JRun4
|
|
|