无法找到所需的类

无法找到所需的类

本文介绍了无法找到所需的类(javax.activation.DataHandler 和 javax.mail.internet.MimeMultipart).附件支持已禁用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在调用 Web 服务中存在的方法时遇到问题.wsdl 是使用 AXIS 创建的.

I am facing problems in invoking a method present in a web service. The wsdl was created using AXIS.

当我尝试使用我的 java 代码调用它时,我从服务响应中获取空值.

When I try to invoke it using my java code, I am getting null values from the service response.

我在控制台中收到警告消息:

I am getting the warning message getting printed in my console:

无法找到所需的类(javax.activation.DataHandler 和 javax.mail.internet.MimeMultipart).附件支持已禁用.

在尝试解决此问题时,我在工作区构建路径中添加了 activation.jar 和 mail.jar,并重新启动了服务器.

While trying to solve this, I added activation.jar and mail.jar in my workspace build path, restarted the server.

右键单击 WSDL ==> 生成客户端

Right Click on the WSDL ==> Generate CLient

然后我得到了一个代理类,用它我写了这个来调用服务方法:

Then I got a proxy class, using it I wrote this to invoke the service method:

public class CallingWebService1 {

public static void main(String[] args) throws Exception {

    WebService1Proxy proxy1 = new WebService1Proxy();
    proxy1.setEndpoint("http://localhost:8045/WebService1/services/WebService1");

    EmployeeDetails details = proxy1.getDetails();
    System.out.println("Employee Id: " + details.getEmpId());
    System.out.println("Employee Name: " + details.getEmpName());
    System.out.println("Dept Id: " + details.getDeptId());
    System.out.println("Dept Name" + details.getDeptName());
    System.out.println("Age: " + details.getAge());
}

问题依旧存在:(

更多信息:

getDetails() 方法正在执行从 Oracle DB 中获取一些记录的 DB 操作.为了执行 DB 操作,使用 class12.jar.这与我现在的调用服务方法有关吗?

The getDetails() method is performing a DB operation fetching some records from the Oracle DB. For performing the DB operation, class12.jar is used. Does it have something to do with invoking the service method the way I am doing?

推荐答案

为了解决 javax.activation.DataHandler 问题,您必须添加 JavaBeans Activation Framework activation.jar 在您的类路径中.

In order to fix the javax.activation.DataHandler issue you must add the JavaBeans Activation Framework activation.jar in your classpath.

为了修复 javax.mail.internet.mimeMultipart 问题,您必须添加 Java Mail API 类路径中的 mail.jar.

In order to fix the javax.mail.internet.mimeMultipart issue you must add the Java Mail API mail.jar in your classpath.

控制台中打印的警告消息表明上述 jar 不在类路径中.

The warning messages printed in your console shows that the above jars are not in the classpath.

这篇关于无法找到所需的类(javax.activation.DataHandler 和 javax.mail.internet.MimeMultipart).附件支持已禁用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 18:10