Deploying ejb on Jakarta ee9.1 results into error

64 views Asked by At

I am making a sample application using EJB jakarta ee9.1 glassfish server 6.2.5 and java17 but while running I am seeing following exception as soon as an Ejb is added.

If you use EJB component annotations to define the EJB, and an ejb or web deployment descriptor is also used, 
please make sure that the deployment descriptor references a Java EE 5 or higher version schema, 
and that the metadata-complete attribute is not set to true, so the component annotations can be processed as expected. 
Please see server.log for more details.

I checked my web.xml and I could see that I am using the correct webappschema (5) and metadata-complete is explicitly set to false .

I could see many people experienced same error but most of the cases were related to an invalid web.xml but in my case web.xml is correct Could anyone suggest pointers.

2

There are 2 answers

0
alesko On

You're using both annotations AND an web.xml for EJB configuration. Normally, only annotations are used since a long time instead of the definitions in a web.xml.

The web.xml can be used for other purposes other than EJB configuration. But without looking at it it's hard to say.

0
nantitv On

Finally, I understood the issue the output Layout of the ejb artefact was wrongly pointing to WEB-INF directory. Now I pointed it to Module output and it started working.