Nope..still groping for an answer.
I have made a simplest
test.
TestServlet (load on startup 1)
public void init() throws ServletException {
// TODO Auto-generated method stub
super.init();
System.out.println("Helllo............");
try {
InitialContext ctx = new InitialContext();
TimerManager mgr = (TimerManager)ctx.lookup("java:comp/env/timer/mytimer");
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
web.xml
<resource-ref id="ResourceRef_1285669031941">
<res-ref-name>timer/mytimer</res-ref-name>
<res-type>commonj.timers.TimerManager</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
ibm-web-bnd.xmi
<resRefBindings xmi:id="ResourceRefBinding_1285669031941" jndiName="timer/mytimer">
<bindingResourceRef href="WEB-INF/web.xml#ResourceRef_1285669031941"/>
</resRefBindings>
as you can see, everything I did this time is with help RAD, from adding a
servlet to adding reference, I created it through
IDE. no handwritten part this except those few lines in init method of the servlet.
RAD also checked that commonj.timers.TimerManager is not a broken link.(give a wrong path, and it will complain)
But still I am getting this Exception
[9/28/10 17:29:38:063 IST] 00000013 Helpers W NMSV0605W: A Reference object looked up from the context "java:" with the name "comp/env/timer/mytimer" was sent to the JNDI Naming Manager and an exception resulted. Reference data follows:
Reference Factory Class Name: com.ibm.ws.util.ResRefJndiLookupObjectFactory
Reference Factory Class Location URLs: <null>
Reference Class Name: java.lang.Object
Type: ResRefJndiLookupInfo
Content: com.ibm.ws.util.ResRefJndiLookupInfo@608799d1 ResRefJndiLookupInfo: Look up Name="timer/mytimer";JndiLookupInfo: jndiName="timer/mytimer"; providerURL=""; initialContextFactory=""
Exception data follows:
javax.naming.NameNotFoundException: Context: CSCINDAF405024Node02Cell/nodes/CSCINDAF405024Node02/servers/server1, name: timer/mytimer: First component in name timer/mytimer not found. Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
at com.ibm.ws.naming.ipcos.WsnOptimizedNamingImpl.handleNameNotFound(WsnOptimizedNamingImpl.java:2252)
at com.ibm.ws.naming.ipcos.WsnOptimizedNamingImpl.getNextWsnOptimizedNamingContext(WsnOptimizedNamingImpl.java:1448)
at com.ibm.ws.naming.cosbase.WsnOptimizedNamingImplBase.getTargetContext(WsnOptimizedNamingImplBase.java:4396)
at com.ibm.ws.naming.cosbase.WsnOptimizedNamingImplBase$LeafOperationData.<init>(WsnOptimizedNamingImplBase.java:5012)
at com.ibm.ws.naming.cosbase.WsnOptimizedNamingImplBase.resolve_complete_info(WsnOptimizedNamingImplBase.java:2205)
at com.ibm.WsnOptimizedNaming._NamingContextStub.resolve_complete_info(Unknown Source)
at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve(CNContextImpl.java:4043)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1746)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1707)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1412)
at com.ibm.ws.naming.util.IndirectJndiLookupObjectFactory$1.run(IndirectJndiLookupObjectFactory.java:372)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java(Compiled Code))
at com.ibm.ws.naming.util.IndirectJndiLookupObjectFactory.getObjectInstanceExt(IndirectJndiLookupObjectFactory.java:221)
at com.ibm.ws.naming.util.IndirectJndiLookupObjectFactory.getObjectInstance(IndirectJndiLookupObjectFactory.java:149)
at com.ibm.ws.util.ResRefJndiLookupObjectFactory.getObjectInstance(ResRefJndiLookupObjectFactory.java:138)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:314)
at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:894)
at com.ibm.ws.naming.urlbase.UrlContextHelper.processBoundObjectForLookup(UrlContextHelper.java:191)
at com.ibm.ws.naming.java.javaURLContextRoot.processBoundObjectForLookup(javaURLContextRoot.java:403)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1280)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:201)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:142)
at javax.naming.InitialContext.lookup(InitialContext.java:361)
at com.nil.TestServlet.init(TestServlet.java:48)