Here are the details. The managed code loads some name/value pairs from the resource environment like this:
InitialContext ic = new InitialContext();
ref = (Reference)ic.lookup("rep/MyRee");
RefAddr refAddr = ref.get("foo");
assert refAddr.getType().equals("java.lang.String"): "foo's type should be String, not "+refAddr.getType();
String foo = (String) refAddr.getContent();
System.out.println("Loaded value for foo: "+foo);To support this code, I added the following code to bottom of
setupNamingContext() (from the previous post):
Context repCtx = ctx.createSubcontext("rep");
Reference ref = new Reference("unused");
StringRefAddr refAddr = new StringRefAddr("foo", "bar");
ref.add(refAddr);
repCtx.bind("MyRee", ref);That's it!