首页

配置Weblogic数据源DataSource报错 - javax.naming.NameNotFoundException..

标签:weblogic,ws,dataSource,JNDI,NameNotFoundException,异常,LinkException,ModuleException,BeanCreationException     发布时间:2016-07-13   

一、异常描述

通过WebLogic的“服务-数据源”配置JDBC数据源,程序通过JNDI名称访问,部署运行后报出配置异常Caused By: javax.naming.NameNotFoundException: While trying to lookup 'jndi.UATEinsuDataSource' didn't find subcontext 'jndi'. Resolved ''; remaining name 'jndi/UATEinsuDataSource',详细日志如下

<2016-7-11 下午01时56分02秒 CST> <Warning> <HTTP> <BEA-101162> <User defined listener org.springframework.web.context.ContextLoaderListener failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext-data.xml]: Invocation of init method failed; nested exception is javax.naming.LinkException:  [Root exception is javax.naming.NameNotFoundException: While trying to lookup 'jndi.UATEinsuDataSource' didn't find subcontext 'jndi'. Resolved ''; remaining name 'jndi/UATEinsuDataSource']; Link Remaining Name: 'jndi/UATEinsuDataSource'.@b@org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext-data.xml]: Invocation of init method failed; nested exception is javax.naming.LinkException:  [Root exception is javax.naming.NameNotFoundException: While trying to lookup 'jndi.UATEinsuDataSource' didn't find subcontext 'jndi'. Resolved ''; remaining name 'jndi/UATEinsuDataSource']; Link Remaining Name: 'jndi/UATEinsuDataSource'@b@	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1148)@b@	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427)@b@	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)@b@	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:144)@b@	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)@b@	Truncated. see log file for complete stacktrace@b@Caused By: javax.naming.LinkException:  [Root exception is javax.naming.NameNotFoundException: While trying to lookup 'jndi.UATEinsuDataSource' didn't find subcontext 'jndi'. Resolved ''; remaining name 'jndi/UATEinsuDataSource']; Link Remaining Name: 'jndi/UATEinsuDataSource'@b@	at weblogic.jndi.internal.WLNamingManager.getObjectInstance(WLNamingManager.java:104)@b@	at weblogic.jndi.internal.BasicNamingNode.resolveObject(BasicNamingNode.java:884)@b@	at weblogic.jndi.internal.ApplicationNamingNode.resolveObject(ApplicationNamingNode.java:187)@b@	at weblogic.jndi.internal.BasicNamingNode.resolveObject(BasicNamingNode.java:856)@b@	at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:209)@b@	Truncated. see log file for complete stacktrace@b@Caused By: javax.naming.NameNotFoundException: While trying to lookup 'jndi.UATEinsuDataSource' didn't find subcontext 'jndi'. Resolved ''; remaining name 'jndi/UATEinsuDataSource'@b@	at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)@b@	at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:247)@b@	at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182)@b@	at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)@b@	at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)@b@	Truncated. see log file for complete stacktrace@b@> @b@<2016-7-11 下午01时56分02秒 CST> <Error> <Deployer> <BEA-149231> <Unable to set the activation state to true for the application 'tpl-einsu-web'.@b@weblogic.application.ModuleException: @b@	at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1510)@b@	at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:482)@b@	at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)@b@	at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)@b@	at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)@b@	Truncated. see log file for complete stacktrace@b@Caused By: javax.naming.NameNotFoundException: While trying to lookup 'jndi.UATEinsuDataSource' didn't find subcontext 'jndi'. Resolved ''; remaining name 'jndi/UATEinsuDataSource'@b@	at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)@b@	at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:247)@b@	at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182)@b@	at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)@b@	at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)@b@	Truncated. see log file for complete stacktrace

二、解决步骤

1. 查看weblogic资源配置,如下

<resource-description>@b@    <jndi-name>jndi/UATEinsuDataSource</jndi-name>@b@    <res-ref-name>jdbc/DataSource</res-ref-name>@b@ </resource-description>

2. 登录到weblogic后台,点击“服务”-“数据源”,配置JNDI名称为“jndi/UATEinsuDataSource”,如下图所示

配置Weblogic数据源DataSource报错 - javax.naming.NameNotFoundException..

<<热门下载>>