Glassfish 5.1 missing modules from previous versions

Tags: , ,



We have an application running on Glassfish 5.0.1 and before that 4.1.1 versions. Recently server is updated to Glassfish 5.1.0 and our application can not be compiled due to the missing of javax.inject.Inject. This relevant jar was in the previous Glassfish versions (in the module folder). So I’d like to hear that in glassfish 5.1 should we add this jar as an external library or is there a way to make this work in the latest glassfish ?

Answer

For GlassFish 5.1 the maven coordinates of dependencies are now jakarta.* instead of javax.*. So for the javax.inject.Inject annotation use the maven dependency

<dependency>
    <groupId>jakarta.inject</groupId>
    <artifactId>jakarta.inject-api</artifactId>
    <version>1.0.3</version>
</dependency>


Source: stackoverflow