Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
803 views
in Technique[技术] by (71.8m points)

java - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled

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

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:

Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.

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

EDIT:

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());
}

But still the problem persists :(

Further Info:

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...