从Tomcat 移到weblogic6.1sp2,出现。。。。。。。。。。

freedy_hu 2002-06-25 06:28:08
我从Tomcat移到weblogic6.1下上传怎么出错呢?提示如下:

Error 500--Internal Server Error
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.5.1 500 Internal Server Error
The server encountered an unexpected condition which prevented it from fulfilling the request.

在Tomcat没问题!
%>
<LINK REL="stylesheet" TYPE="text/css" HREF="WF.css">
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*" %>
<%@ page import="FileUploadBean"%>
<%@ page import="dbconn"%>
<%@ page import="Query"%>
<jsp:useBean id="upload" scope="page" class="FileUploadBean" />
<jsp:useBean id="conn" class="dbconn"/>
<jsp:useBean id="db" class="Query"/>
<%
ResultSet RS;
String sSql = "SELECT * FROM DOC_PATH";
conn.init();
RS = conn.executeSQL(sSql);
RS.next();
String path=RS.getString("DOC_PATH");
path = "../webapps/workjsp" + path;
upload.setSavePath(path);

upload.doUpload(request);
。。。

%>
我把upload.doUpload(request);屏蔽掉就没有出错,好像是这句出错!
帮我一把!谢谢!
...全文
37 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Domino 2002-07-12
  • 打赏
  • 举报
回复
将web-inf中的临时文件夹删除!
记得给分哦!
freedy_hu 2002-06-26
  • 打赏
  • 举报
回复
doUpload是FileUploadBean的一个方法,不知道怎么解决,帮我一般,已经好
几天了!谢谢!!!

FileUploadBean.java

import javax.servlet.http.HttpServletRequest;
import javax.servlet.ServletInputStream;
import java.util.Dictionary;
import java.util.Hashtable;
import java.io.*;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Date;
import java.text.*;

public class FileUploadBean
{
private String savePath, filepath, filename, contentType, saveFileName;
private Dictionary fields;

public String getFilename()
{
return filename;
}

public String getSaveFileName()
{
return saveFileName;
}

public String getFilepath()
{
return filepath;
}

public void setSavePath(String savePath)
{
this.savePath = savePath;
}

public String getContentType()
{
return contentType;
}

public String getFieldValue(String fieldName)
{
if (fields == null || fieldName == null)
return null;
return (String) fields.get(fieldName);
}

private void setFilename(String s)
{
if (s==null)
return;

int pos = s.indexOf("filename=\"");
if (pos != -1)
{
filepath = s.substring(pos+10, s.length()-1);
//System.out.println("filepath: " + filepath);
File f = new File(filepath);
if (f.exists())
{
//System.out.println("filepath exist: " + filepath);
}
else
{
filepath = "";
//System.out.println("filepath not exist: " + filepath);
}

// Windowsä¯ÀÀÆ÷·¢ËÍÍêÕûµÄÎļþ·¾¶ºÍÃû×Ö,µ«Linux/UnixºÍMacä¯ÀÀÆ÷Ö»·¢ËÍÎļþÃû×Ö
pos = filepath.lastIndexOf("\\");
if(pos != -1) filename = filepath.substring(pos + 1);
else filename = filepath;
//System.out.println("filename: " + filename);
}
}

private void setContentType(String s)
{
if (s==null)
return;

int pos = s.indexOf(": ");
if(pos != -1) contentType = s.substring(pos+2, s.length());
}

public void doUpload(HttpServletRequest request) throws IOException
{
ServletInputStream in = request.getInputStream();

byte[] line = new byte[256];
int i = in.readLine(line, 0, 256);
//System.out.println("line: " + line);
//System.out.println("line i : " + i);
if(i < 3) return;
int boundaryLength = i - 2;

String boundary = new String(line, 0, boundaryLength); //-2¶ªÆú»»ÐÐ×Ö·û
fields = new Hashtable();

while (i != -1)
{
String newLine = new String(line, 0, i);
//System.out.println("new line: " + newLine);
if (newLine.startsWith("Content-Disposition: form-data; name=\""))
{
if (newLine.indexOf("filename=\"") != -1)
{
setFilename(new String(line, 0, i-2));
int now_m=new Date().getMonth()+1,
now_d=new Date().getDate(),
now_y=new Date().getYear()+1900,
now_hour=new Date().getHours(),
now_min=new Date().getMinutes(),
now_sec=new Date().getSeconds();
String now_t=""+now_y+now_m+now_d+now_hour+now_min+now_sec;
saveFileName = now_t + filename;

if(filename==null) return;
//ÎļþÄÚÈÝ
i = in.readLine(line, 0, 256);
setContentType(new String(line, 0, i-2));
i = in.readLine(line, 0, 256);
//¿ÕÐÐ
i = in.readLine(line, 0, 256);
newLine = new String(line, 0, i);
PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter((savePath==null? "" : savePath) + saveFileName)));
while (i != -1 && !newLine.startsWith(boundary))
{
// ÎļþÄÚÈݵÄ×îºóÒ»Ðаüº¬»»ÐÐ×Ö·ûÒò´ËÎÒÃDZØÐë¼ì²éµ±Ç°ÐÐÊÇ·ñÊÇ×îºóÒ»ÐÐ
i = in.readLine(line, 0, 256);
if((i==boundaryLength+2 || i==boundaryLength+4)&&(new String(line, 0, i).startsWith(boundary)))pw.print(newLine.substring(0, newLine.length()-2));
else pw.print(newLine);
newLine = new String(line, 0, i);
}
pw.close();
}
else
{
// ÆÕͨ±íµ¥ÊäÈëÔªËØ,»ñÈ¡ÊäÈëÔªËØÃû×Ö
int pos = newLine.indexOf("name=\"");
String fieldName = newLine.substring(pos+6, newLine.length()-3);
i = in.readLine(line, 0, 256);
i = in.readLine(line, 0, 256);
newLine = new String(line, 0, i);
StringBuffer fieldValue = new StringBuffer(256);
while (i != -1 && !newLine.startsWith(boundary))
{
// ×îºóÒ»Ðаüº¬»»ÐÐ×Ö·û,Òò´ËÎÒÃDZØÐë¼ì²éµ±Ç°ÐÐÊÇ·ñÊÇ×îºóÒ»ÐÐ
i = in.readLine(line, 0, 256);
if ((i==boundaryLength+2 || i==boundaryLength+4)&& (new String(line, 0, i).startsWith(boundary))) fieldValue.append(newLine.substring(0, newLine.length()-2));
else fieldValue.append(newLine);
newLine = new String(line, 0, i);
}
fields.put(fieldName, fieldValue.toString());
}
}
i = in.readLine(line, 0, 256);
}
}
}
Andrawu 2002-06-25
  • 打赏
  • 举报
回复
你的upload.doUpload(request);是做什么的?不知道doUpload(request)里面是怎么处理的。

如果在Tomcat下可以。移到weblogic6.1不行了?是不是你的path = "../webapps/workjsp" + path;的问题呢?

你的问题较难回答:)。

1,236

社区成员

发帖
与我相关
我的任务
社区描述
企业软件 中间件技术
社区管理员
  • 中间件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧