gpt4 book ai didi

java - HTTP 状态 500 - 实例化 servlet 类时出错

转载 作者:行者123 更新时间:2023-11-29 00:02:00 24 4
gpt4 key购买 nike

<分区>

我在 eclipse 中创建了一个 Web 项目,为了在 Tomcat 服务器中运行该项目,我以 .war 格式导出了文件。我保留了一台单独的计算机来运行该项目,因此我可以在不同的计算机上使用它,因为它具有静态 IP。

我目前的错误是:

HTTP Status 500 - Error instantiating servlet class com.complexible.common.csv.DisplayRecord

我正在添加我的 web.xml 文件。请提供可能的解决方案。

<?xml version="1.0" encoding="UTF-8" ?> 
- <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>Museumnew</display-name>
- <welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
<welcome-file>/axis2-web/index.jsp</welcome-file>
</welcome-file-list>
- <servlet>
<description />
<display-name>DisplayRecord</display-name>
<servlet-name>DisplayRecord</servlet-name>
<servlet-class>com.complexible.common.csv.DisplayRecord</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>DisplayRecord</servlet-name>
<url-pattern>/DisplayRecord</url-pattern>
</servlet-mapping>
- <servlet>
<display-name>Apache-Axis Servlet</display-name>
<servlet-name>AxisServlet</servlet-name>
<servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/servlet/AxisServlet</url-pattern>
</servlet-mapping>
- <servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>*.jws</url-pattern>
</servlet-mapping>
- <servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
- <servlet>
<display-name>Axis Admin Servlet</display-name>
<servlet-name>AdminServlet</servlet-name>
<servlet-class>org.apache.axis.transport.http.AdminServlet</servlet-class>
<load-on-startup>100</load-on-startup>
</servlet>
- <servlet-mapping>
<servlet-name>AdminServlet</servlet-name>
<url-pattern>/servlet/AdminServlet</url-pattern>
</servlet-mapping>
- <servlet>
<display-name>Apache-Axis Admin Servlet Web Admin</display-name>
<servlet-name>AxisAdminServlet</servlet-name>
<servlet-class>org.apache.axis2.transport.http.AxisAdminServlet</servlet-class>
<load-on-startup>100</load-on-startup>
</servlet>
- <servlet-mapping>
<servlet-name>AxisAdminServlet</servlet-name>
<url-pattern>/axis2-admin/*</url-pattern>
</servlet-mapping>
</web-app>

这是一个servlet代码。

package com.complexible.common.csv;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.json.JSONException;
import org.json.simple.parser.ParseException;

/**
* Servlet implementation class DisplayRecord
*/
public class DisplayRecord extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @throws IOException
* @throws ParseException
* @throws JSONException
* @see HttpServlet#HttpServlet()
*/
public DisplayRecord() throws IOException, JSONException, ParseException {
super();

String getrec=GetRecord.getrec("http://phdprototype.tk/collectionimage/4D0BFF17-5810-4644-A550-D35EE090D4A8.png","3","0");
System.out.println(getrec);
// TODO Auto-generated constructor stub
}

/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
PrintWriter out= response.getWriter();
//out.print("hesadlo");

String abc="";

try {
abc = GetRecord.getrec("http://phdprototype.tk/collectionimage/4D0BFF17-5810-4644-A550-D35EE090D4A8.png","3","0");
} catch (JSONException | ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
out.print(abc);
// TODO Auto-generated method stub
}

/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}

}

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com