Reputation: 860
I want to do something like that (Very basic...) :
@Resource(lookup = "my/jndi/name")
private String someString;
And the glassfish console isn't clear about how to configure a jndi String resource named "my/jndi/name".
Upvotes: 1
Views: 1113
Reputation: 5378
You might also want to take a look at the Configuration stuff in DeltaSpike.
Upvotes: 1
Reputation: 860
If you want to do something like that :
@Resource(lookup = "your/jndi/name")
private String someString;
You can use the glassfish console and add a custom resource :
Note that you must add a property with "value" as name.
And here is the corresponding glassfish-resource.xml file :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC
"-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN"
"http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
<resources>
<custom-resource jndi-name="your/jndi/name" res-type="java.lang.String" factory- class="org.glassfish.resources.custom.factory.PrimitivesAndStringFactory">
<property name="value" value="your value"></property>
</custom-resource>
</resources>
Upvotes: 3