Question

So I created a custom reference in the domain.xml

<custom-resource res-type="java.lang.String" jndi-name="jndi/myResource" factory-class="org.glassfish.resources.custom.factory.PrimitivesAndStringFactory">
        <property name="value" value="myValue"/>
</custom-resource>

And referencing it through @Resource(lookup = "jndi/myResource") in a @ApplicationScoped bean.

I am also starting the server with the endorsed directory(containing the endorsed-api.jar). Still when I reference the resource, its not injecting and throwing a null.

Looks like everything is setup correctly, not sure what I am missing here. And yes, I have beans.xml in the Meta-inf directory too.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top