• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

JRun4

 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I haven't tried on JRun but as far as I know, it was written to the servlet spec. What problems are you having?
 
Zein Nunna
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Post your servlet code.
Make sure to use the UBB code tags so we can read it
 
Zein Nunna
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Put the commons fileupload jars in WEB-INF/lib.
 
Zein Nunna
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
A timing clock, fuse wire, high explosives and a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic