Websphere - 找不到 JDNI 名称

Websphere - JDNI name not found

我正在尝试 运行 本地网络应用程序。

每当我 运行 我的服务器时,我得到 "NameNotFoundException",这是因为 JNDI 查找似乎没有找到该模块。即使我做了所有必要的修改(我猜)。我没有对管理员的 WAS 控制台做任何更改。任何人都知道是什么导致了这个问题或者我缺少什么设置?

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>

在 ibm-web-bnd.xml 中:

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

这是堆栈跟踪:

[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.access0(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.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.run(CNContextImpl.java:2792) at com.ibm.ws.naming.jndicos.CNContextImpl.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

请尝试以下操作

  1. web.xml 文件中的 <res-ref-name>abcDe</res-ref-name> 更改为 <res-ref-name>jdbc/abcDe</res-ref-name>

  2. 确保您的应用程序和 JDBC 数据源配置在同一级别 (Cell/Node/Server)。

`