问题描述
我有一个用Java编写的Web应用程序。运行webLogic服务器时,该服务器正在运行。但是,当我发送SOAP请求时,它给出了无法解析'xxx-yyyy-zzz-JNDI'的信息。解决 '';其余名称为“ xxx-yyyy-zzz-JNDI”。
我测试了我的jndi配置,它正在工作(密码和用户名正确)。我意识到在weblogic的“监视”选项卡中没有此数据源的已部署实例。我认为问题就在这里。你有什么主意吗?
我的错误代码:Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'efaturaQdbDataSource' defined in class path resource [applicationContext-efatura-data.xml]: Invocation of init method Failed; nested exception is javax.naming.NameNotFoundException: Unable to resolve 'xxx-yyyy-zzz-JNDI'. Resolved ''; remaining name 'xxx-yyyy-zzz-JNDI' at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.initializeBean(AbstractAutowireCapablebeanfactory.java:1455) at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.doCreateBean(AbstractAutowireCapablebeanfactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.createBean(AbstractAutowireCapablebeanfactory.java:456) at org.springframework.beans.factory.support.Abstractbeanfactory$1.getobject(Abstractbeanfactory.java:294) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) at org.springframework.beans.factory.support.Abstractbeanfactory.doGetBean(Abstractbeanfactory.java:291) at org.springframework.beans.factory.support.Abstractbeanfactory.getBean(Abstractbeanfactory.java:193) at org.springframework.beans.factory.support.BeanDeFinitionValueResolver.resolveReference(BeanDeFinitionValueResolver.java:322) ... 98 more Caused by: javax.naming.NameNotFoundException: Unable to resolve 'xxx-yyyy-zzz-JNDI'. Resolved ''; remaining name 'xxx-yyyy-zzz-JNDI' at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139) at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:252) at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182) at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206) at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254) at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:393) at javax.naming.InitialContext.lookup(InitialContext.java:392) at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154) at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87) at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152) at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178) at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95) at org.springframework.jndi.JndiobjectLocator.lookup(JndiobjectLocator.java:105) at org.springframework.jndi.Jndiobjectfactorybean.lookupWithFallback(Jndiobjectfactorybean.java:201) at org.springframework.jndi.Jndiobjectfactorybean.afterPropertiesSet(Jndiobjectfactorybean.java:187) at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.invokeInitMethods(AbstractAutowireCapablebeanfactory.java:1514) at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.initializeBean(AbstractAutowireCapablebeanfactory.java:1452) ... 105 more
解决方法
非常感谢您共享整个堆栈跟踪信息,现在问题可以更容易理解了。
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'efaturaQdbDataSource' defined in class path resource [applicationContext-
efatura-data.xml]
我认为您正在面对名为efaturaQdbDataSource的数据源问题。因此,您应该首先在此guide之后创建数据源。完成这些步骤后,您将在JNDI树中看到数据源。
以我的经验,这是管理数据源的最佳方法,而不是将其包含在应用程序中为什么?因为您将从应用程序中拆分数据源的配置及其管理,这在您的应用程序投入生产时非常有用。