SoftwareSavant
SoftwareSavant

Reputation: 9757

JAX-WS webservice that uses Custom POJO as parameter and return value from a separate project

I am attempting to implement a Web Service that uses a POJO as a return value and a parameter as well. Whenver I do that though, I get the following Exception...

Exception while deploying the app [EnterpriseLoggingPoCEAR] : Invalid ejb jar [EnterpriseLoggingPoC.jar]: it contains zero ejb. 

Is there something I should be annotating my POJO with? The POJO was included in the Build path... I know in .net you have to annotate your class with [DataContract]... Do I have to do the same for JAX-WS pojo's?

One thing that I neglected to mention was that the POJO was in a package and a project that was not part of the Web Service project. Once I moved the package into my project the error cleared up and I was able to deploy the project locally. Now I thought I added my project to the build path of the other web service project. But it would still throw that exception. Any ideas?

Upvotes: 0

Views: 458

Answers (1)

Paul Vargas
Paul Vargas

Reputation: 42040

eclipse can help with references between projects for to reuse classes and libraries. For example, if you have an EAR project that contains a Web module and a EJB module, you can share between them domain classes (e.g. with @Entity annotation) or interfaces (with @Remote o @Local annotation).

If you check the project properties of EnterpriseLoggingPoCEAR, you could see something similar to:

enter image description here

In the images, the project ExampleModel is a typical Java project. This project has a additional facet: Utility Module. This facet is add automatically when you using the Add... button in the EAR properties.

enter image description here

The error that you mention is because you add a EJB module without any EJB.

enter image description here

Also instead of reference to another project, you can add a jar in the lib folder of EAR.

enter image description here

By the way, if you reference the project, this is also done automatically.

Upvotes: 1

Related Questions