gpt4 book ai didi

java - 我在 Eclipse 中运行我的动态 Web 项目。我收到这个错误,为什么我不知道

转载 作者:行者123 更新时间:2023-11-28 23:32:26 25 4
gpt4 key购买 nike

    SEVERE: Servlet.service() for servlet [com.servlet.FileCalling] in context with path [/ScfUploaddFile] threw exception [Servlet execution threw an exception] with root cause
java.lang.ClassNotFoundException: javax.ejb.CreateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
at com.bs.theme.migration.loader.utility.QueryBuilder.doTFinvdtoQuery(QueryBuilder.java:355)
at com.bs.theme.migration.loader.action.manager.FGBDataMigration.main(FGBDataMigration.java:61)
at com.servlet.FileCalling.doPost(FileCalling.java:38)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:662)

但是如果我在 Java 控制台应用程序中运行相同的代码,它会被执行并且我在我的控制台中获取值但是当我通过将它与我的 Web 应用程序集成来运行相同的代码时它会抛出我上面提到的错误

    public  String process(String message, int start) {
System.out.println("from process method");
String result = "Unable to Process";
String ejbClientUrl = DBPropertiesLoader.EJBCLIENT_URL;
System.out.println("Connecting : " + ejbClientUrl);
try {

System.getProperties().put("java.naming.factory.initial", "com.ibm.websphere.naming.WsnInitialContextFactory");
System.getProperties().put("java.naming.provider.url", DBPropertiesLoader.TI_EJB_URL);


System.getProperties().put("java.naming.provider.url", ejbClientUrl);

Context ctx = new InitialContext();
Object ejbObject = ctx.lookup("ejb/EnigmaServiceAccess");
System.out.println("EJB Object : "+ejbObject);

查询生成器.java

                    public static String doTFinvdtoQuery(String table, String inputFile,
String lowRange, String highRange) {

Connection connection = null;
String xmlToPost = null;
Statement queryStatement = null;
ResultSet resultSet = null;

try {
connection = ThemeDB.getDBConnection();
queryStatement = connection.createStatement();
System.out.println("****Generating Query****" + "\n");
String query = getQuery(table, inputFile, lowRange, highRange);

resultSet = queryStatement.executeQuery(query);
BeanProcessor bp = new BeanProcessor();
List<ServiceRequest> sRequestItems = new ArrayList<ServiceRequest>();
String finalResult = "Unable to Process";

int num = 0;
int count = 0;
while (resultSet.next()) {

try {

num++;
count = resultSet.getInt("SNO");

ArrayList<InvoiceCustomer> list = new ArrayList<InvoiceCustomer>();
list.add((InvoiceCustomer) bp.toBean(resultSet, InvoiceCustomer.class));

TFinvdtoHandler tfinv = new TFinvdtoHandler();
sRequestItems.add(tfinv
.createTFinvdtoRequest(list));
if (num % 1 == 0) {

xmlToPost = MessageUtil.xmlServiceRequest(
sRequestItems, "TFINVNEW");
logger.debug(xmlToPost);

System.out
.println("**Sending data to TI Plus through EJB Client***"
+ "\n");
finalResult = TIPlusEJBClient.process(xmlToPost, count);

if (!finalResult.equals("Unable to Process")) {

List<ServiceResponse> serviceResponses = MessageUtil
.processResponse(finalResult);
for (ServiceResponse serviceResponse : serviceResponses) {
// System.out.println("**Response Status***"
// +serviceResponse.getResponseHeader().getStatus());
// System.out.println("**Response CorrID***"
// +serviceResponse.getResponseHeader().getStatus());

MigrationUtil.updateMigrationDataStagingStatus(
table, serviceResponse
.getResponseHeader()
.getStatus(), serviceResponse
.getResponseHeader()
.getCorrelationId(),
serviceResponse.getResponseHeader()
.getDetails().getError()
.toString());
}

}
logger.debug("\n");
sRequestItems = new ArrayList<ServiceRequest>();
finalResult = "Unable to Process";
}

} catch (Exception e) {
// TODO: handle exception
logger.debug("Exception Occured ->" + e.getMessage());
e.printStackTrace();
}

}

} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();

logger.debug("Exception Occured ->" + e1.getMessage());
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
logger.debug("Exception Occured ->" + e1.getMessage());
} catch (Exception e) {
logger.debug("Exception Occured ->" + e.getMessage());
} finally {

MigrationUtil.surrenderConnection(connection, resultSet,
queryStatement);

}

/*
* System.out.println("Remaining request count ->" +
* sRequestItems.size()); if (sRequestItems.size() > 0) {
*
* xmlToPost = MessageUtil .xmlServiceRequest(sRequestItems,
* "TFILCDTO"); logger.debug(xmlToPost); finalResult =
* TIPlusEJBClient.process(xmlToPost, count);
*
* System.out
* .println("**Sending remaining data to TI Plus through EJB Client***"
* + "\n"); if (!finalResult.equals("Unable to Process")) {
*
* List<ServiceResponse> serviceResponses = MessageUtil
* .processResponse(finalResult); for (ServiceResponse serviceResponse :
* serviceResponses) { // System.out.println("**Response Status***" //
* +serviceResponse.getResponseHeader().getStatus()); //
* System.out.println("**Response CorrID***" //
* +serviceResponse.getResponseHeader().getStatus());
*
* MigrationUtil.updateMigrationDataStagingStatus(table,
* serviceResponse.getResponseHeader().getStatus(),
* serviceResponse.getResponseHeader() .getCorrelationId(),
* serviceResponse .getResponseHeader().getDetails()
* .getError().toString()); }
*
* }
*
* logger.debug("\n");
*
* }
*/

return xmlToPost;
}

最佳答案

项目 -> 属性 -> Java 构建路径 -> 添加库 -> 服务器运行时 -> 单击下一步 -> 选择您的 EJB 容器

关于java - 我在 Eclipse 中运行我的动态 Web 项目。我收到这个错误,为什么我不知道,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28548196/

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