Websphere - 未找到JDNI名称

时间:2016-06-21 20:12:11

标签: java jdbc jndi websphere-7

我试图在网上运行一个网络应用。

当我运行我的服务器时,我得到" 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:从javax.naming.Context实现抛出NamingException。细节如下:   上下文实现:com.ibm.ws.naming.java.javaURLContextRoot   上下文方法:查找(名称)   上下文名称:java:   目标名称:comp / env / abcDe   其他数据:&#34;&#34;   异常堆栈跟踪:com.ibm.websphere.naming.CannotInstantiateObjectException:对名称java:comp / env / abcDe进行间接查找时发生NameNotFoundException。名称java:comp / env / abcDe映射到执行JNDI查找的应用程序的部署描述符绑定中的JNDI名称。确保部署描述符绑定中的JNDI名称映射是正确的。如果JNDI名称映射正确,请确保可以使用相对于默认初始上下文的指定名称来解析目标资源。 [根异常是javax.naming.NameNotFoundException:上下文:5CG61345YTNode04Cell / nodes / 5CG61345YTNode04 / servers / server1,名称:jdbc / abcDe:找不到名称abcDe中的第一个组件。 [root例外是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)       在com.ibm.ws.naming.java.javaURLContextRoot.processBoundObjectForLookup(javaURLContextRoot.java:402)       在com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1249)       在com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:394)       在com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:214)       在com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:154)       在javax.naming.InitialContext.lookup(InitialContext.java:436)       在com.bnc.grc.core.db.DBAccess。(DBAccess.java:68)       在com.bnc.grc.gro.models.i18n.I18NDAO.getListI18nvo(I18NDAO.java:95)       在com.bnc.grc.gro.models.i18n.I18NDAO.getContextCol(I18NDAO.java:174)       在com.bnc.grc.gro.models.i18n.InternationalizationManager.buildAndPutInCache(InternationalizationManager.java:650)       在com.bnc.grc.gro.models.i18n.InternationalizationManager.init(InternationalizationManager.java:392)       在com.bnc.grc.gro.models.i18n.InternationalizationManager.startLoading(InternationalizationManager.java:73)       在com.bnc.grc.gro.ejb.ProcessScheduleBean.refreshData(ProcessScheduleBean.java:72)       at com.bnc.grc.gro.ejb.EJSRemoteStatelessProcessSchedule_7d9d2593.refreshData(EJSRemoteStatelessProcessSchedule_7d9d2593.java:100)       在com.bnc.grc.gro.ejb._ProcessSchedule_Stub.refreshData(_ProcessSchedule_Stub.java:363)       在com.bnc.grc.gro.pres.schedule.ScheduleDelegate.loadData(ScheduleDelegate.java:63)       在com.bnc.grc.gro.web.servlets.GroInitSvlt.init(GroInitSvlt.java:98)       在com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:325)       在com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:165)       在com.ibm.ws.webcontainer.servlet.ServletWrapper.initialize(ServletWrapper.java:1588)       在com.ibm.wsspi.webcontainer.extension.WebExtensionProcessor.createServletWrapper(WebExtensionProcessor.java:98)       在com.ibm.ws.webcontainer.webapp.WebApp.getServletWrapper(WebApp.java:936)       在com.ibm.ws.webcontainer.webapp.WebApp.getServletWrapper(WebApp.java:857)       在com.ibm.ws.webcontainer.webapp.WebApp.initializeTargetMappings(WebApp.java:538)       在com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinish(WebApp.java:360)       在com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:292)       在com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:99)       在com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:167)       在com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:722)       在com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:607)       在com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:376)       在com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:668)       在com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1162)       at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1313)       在com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:611)       在com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:938)       在com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:740)       在com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2092)       在com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:437)       在com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:122)       在com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:380)       在com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access $ 300(CompositionUnitMgrImpl.java:105)       在com.ibm.ws.runtime.component.CompositionUnitMgrImpl $ CUInitializer.run(CompositionUnitMgrImpl.java:928)       at com.ibm.wsspi.runtime.component.WsComponentImpl $ _AsynchInitializer.run(WsComponentImpl.java:349)       在com.ibm.ws.util.ThreadPool $ Worker.run(ThreadPool.java:1527)   引起:javax.naming.NameNotFoundException:上下文:5CG61345YTNode04Cell / nodes / 5CG61345YTNode04 / servers / server1,name:jdbc / abcDe:找不到名称abcDe中的第一个组件。 [root例外是org.omg.CosNaming.NamingContextPackage.NotFound:IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]       at com.ibm.ws.naming.jndicos.CNContextImpl.mapNotFoundException(CNContextImpl.java:4360)       在com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1793)       在com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1748)       在com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1499)       在com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1537)       at com.ibm.ws.naming.util.IndirectJndiLookupObjectFactory $ 1.run(IndirectJndiLookupObjectFactory.java:370)       在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)       在javax.naming.spi.NamingManager.getObjectInstanceByFactoryInReference(NamingManager.java:501)       在javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:365)       在com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:920)       ......还有46个   引起: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)       在com.ibm.ws.naming.jndicos.CNContextImpl $ 2.run(CNContextImpl.java:2792)       在com.ibm.ws.naming.jndicos.CNContextImpl $ 2.run(CNContextImpl.java:2788)       在com.ibm.ws.naming.util.CommonHelpers.retry(CommonHelpers.java:762)       在com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve(CNContextImpl.java:2786)       在com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1789)       ......还有57个

1 个答案:

答案 0 :(得分:1)

请尝试以下

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

  2. 确保您的应用程序和JDBC数据源配置在同一级别(单元/节点/服务器)。

  3. `