4

I'm trying to run a web app localy.

When ever I run my server I get "NameNotFoundException", which Is because JNDI lookup doesn't seem to find the module. Even though I made all the required modifications (I guess). I didn't do any changes to the administrator's WAS console. Any one knows what is causing this issue or what settings am I missing?

Web.xml :

<resource-ref id="Ref_1">
    <description>
    </description>
    <res-ref-name>abcDe</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>

in ibm-web-bnd.xml :

<resRefBindings xmi:id="Ref_1" jndiName="jdbc/abcDe">
     <bindingResourceRef href="WEB-INF/web.xml#Ref_1"/> 
</resRefBindings>

Here is the stack trace :

[6/21/16 16:02:50:491 EDT] 0000000e Helpers W NMSV0610I: A NamingException is being thrown from a javax.naming.Context implementation. Details follow: Context implementation: com.ibm.ws.naming.java.javaURLContextRoot Context method: lookup(Name) Context name: java: Target name: comp/env/abcDe Other data: "" Exception stack trace: com.ibm.websphere.naming.CannotInstantiateObjectException: A NameNotFoundException occurred on an indirect lookup on the name java:comp/env/abcDe. The name java:comp/env/abcDe maps to a JNDI name in deployment descriptor bindings for the application performing the JNDI lookup. Make sure that the JNDI name mapping in the deployment descriptor binding is correct. If the JNDI name mapping is correct, make sure the target resource can be resolved with the specified name relative to the default initial context. [Root exception is javax.naming.NameNotFoundException: Context: 5CG61345YTNode04Cell/nodes/5CG61345YTNode04/servers/server1, name: jdbc/abcDe: First component in name abcDe not found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]] at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:998) at com.ibm.ws.naming.urlbase.UrlContextHelper.processBoundObjectForLookup(UrlContextHelper.java:175) at com.ibm.ws.naming.java.javaURLContextRoot.processBoundObjectForLookup(javaURLContextRoot.java:402) at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1249) at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:394) at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:214) at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:154) at javax.naming.InitialContext.lookup(InitialContext.java:436) at com.bnc.grc.core.db.DBAccess.(DBAccess.java:68) at com.bnc.grc.gro.models.i18n.I18NDAO.getListI18nvo(I18NDAO.java:95) at com.bnc.grc.gro.models.i18n.I18NDAO.getContextCol(I18NDAO.java:174) at com.bnc.grc.gro.models.i18n.InternationalizationManager.buildAndPutInCache(InternationalizationManager.java:650) at com.bnc.grc.gro.models.i18n.InternationalizationManager.init(InternationalizationManager.java:392) at com.bnc.grc.gro.models.i18n.InternationalizationManager.startLoading(InternationalizationManager.java:73) at com.bnc.grc.gro.ejb.ProcessScheduleBean.refreshData(ProcessScheduleBean.java:72) at com.bnc.grc.gro.ejb.EJSRemoteStatelessProcessSchedule_7d9d2593.refreshData(EJSRemoteStatelessProcessSchedule_7d9d2593.java:100) at com.bnc.grc.gro.ejb._ProcessSchedule_Stub.refreshData(_ProcessSchedule_Stub.java:363) at com.bnc.grc.gro.pres.schedule.ScheduleDelegate.loadData(ScheduleDelegate.java:63) at com.bnc.grc.gro.web.servlets.GroInitSvlt.init(GroInitSvlt.java:98) at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:325) at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:165) at com.ibm.ws.webcontainer.servlet.ServletWrapper.initialize(ServletWrapper.java:1588) at com.ibm.wsspi.webcontainer.extension.WebExtensionProcessor.createServletWrapper(WebExtensionProcessor.java:98) at com.ibm.ws.webcontainer.webapp.WebApp.getServletWrapper(WebApp.java:936) at com.ibm.ws.webcontainer.webapp.WebApp.getServletWrapper(WebApp.java:857) at com.ibm.ws.webcontainer.webapp.WebApp.initializeTargetMappings(WebApp.java:538) at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinish(WebApp.java:360) at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:292) at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:99) at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:167) at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:722) at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:607) at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:376) at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:668) at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1162) at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1313) at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:611) at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:938) at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:740) at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2092) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:437) at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:122) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:380) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$300(CompositionUnitMgrImpl.java:105) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:928) at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:349) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1527) Caused by: javax.naming.NameNotFoundException: Context: 5CG61345YTNode04Cell/nodes/5CG61345YTNode04/servers/server1, name: jdbc/abcDe: First component in name abcDe not found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0] at com.ibm.ws.naming.jndicos.CNContextImpl.mapNotFoundException(CNContextImpl.java:4360) at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1793) at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1748) at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1499) at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1537) at com.ibm.ws.naming.util.IndirectJndiLookupObjectFactory$1.run(IndirectJndiLookupObjectFactory.java:370) at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118) at com.ibm.ws.naming.util.IndirectJndiLookupObjectFactory.getObjectInstanceExt(IndirectJndiLookupObjectFactory.java:220) at com.ibm.ws.naming.util.IndirectJndiLookupObjectFactory.getObjectInstance(IndirectJndiLookupObjectFactory.java:154) at com.ibm.ws.util.ResRefJndiLookupObjectFactory.getObjectInstance(ResRefJndiLookupObjectFactory.java:144) at javax.naming.spi.NamingManager.getObjectInstanceByFactoryInReference(NamingManager.java:501) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:365) at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:920) ... 46 more Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0 at com.ibm.ws.naming.ipcos.WsnOptimizedNamingImpl.do_resolve_complete_info(WsnOptimizedNamingImpl.java:543) at com.ibm.ws.naming.cosbase.WsnOptimizedNamingImplBase.resolve_complete_info(WsnOptimizedNamingImplBase.java:2163) at com.ibm.WsnOptimizedNaming._NamingContextStub.resolve_complete_info(_NamingContextStub.java:538) at com.ibm.ws.naming.jndicos.CNContextImpl$2.run(CNContextImpl.java:2792) at com.ibm.ws.naming.jndicos.CNContextImpl$2.run(CNContextImpl.java:2788) at com.ibm.ws.naming.util.CommonHelpers.retry(CommonHelpers.java:762) at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve(CNContextImpl.java:2786) at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1789) ... 57 more

Roman C
  • 49,761
  • 33
  • 66
  • 176
MasterJohn
  • 439
  • 4
  • 17

1 Answers1

2

Please try the following

  1. Change the <res-ref-name>abcDe</res-ref-name> to <res-ref-name>jdbc/abcDe</res-ref-name> inside your web.xml file

  2. Make sure that your application and the JDBC datasource are configured at the same level (Cell/Node/Server).

`

Cristian Meneses
  • 4,013
  • 17
  • 32
  • You mean I need to set the JDBC datasource in the was console? – MasterJohn Jun 21 '16 at 20:22
  • Of course! A JNDI resource reference means that your application will make use of a resource that is defined on the container where it will be installed (in this case Websphere). So, in WAS console, you need to create a new JDBC datasource, with JNDI name "jdbc/abcDe" and pointing to the database you want. This way, once started, the server will match your resource-ref with the JNDI resource defined in WAS. – Cristian Meneses Jun 21 '16 at 20:24
  • Thank you sir. You made my day. – MasterJohn Jun 21 '16 at 20:57