0

我在 Eclipse 中创建了一个基本的 Java 项目,然后使用 File->New "Web Service Client" 向导添加了一个 Web Service Client。

这正确生成了我的存根,并且我能够连接到 Web 服务,但是,我在运行时收到以下错误/警告:

警告:找不到所需的类(javax.activation.DataHandler 和 javax.mail.internet.MimeMultipart)。附件支持被禁用。

然后我尝试使用动态 Web 项目(而不是基本的 Java 项目)创建客户端,错误消失了。

这显然是因为动态 Web 项目包含基本 Java 项目中不包含的库。

我的问题是,为什么我需要制作一个动态 Web 项目(看起来有点矫枉过正)只是为了制作一个 Web 服务客户端?您会推荐使用一些更简单的项目类型吗?

谢谢你。

4

1 回答 1

0

Since it is just a warning, you could leave it as is. To make it go away, you could look up the jars that contain those classes and add them to your project.

I think we normally use a JavaEE project type, and that may bring in some extra library files. I wouldn't normally think you need a dynamic web project to make the error go away.

The only difference in the project type is the Libraries included automatically for you when you start them. You can start any project as a Java project and then in the Project Properties, Build Path, Libraries tab add additional libraries to the project.

Both of the missing classes above are in the j2ee.jar file, so if you can add that jar to your build path of the project it should go away.

于 2013-01-21T00:44:12.450 回答