jboss7 jndi mysql_JNDI在JBoss 7.0.2中查找数据源导致NameNotFoundException

在JBoss7.0.2中部署Liferay6.1简单portlet应用程序遇到数据源JNDI查找失败的问题。尽管在多种配置文件中尝试了不同的命名约定组合,但在试图查看portlet时仍然出现了NameNotFoundException。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

我在JBoss 7.0.2中对数据源的JNDI查找工作正常时遇到了一些问题 . 基本上,这个应用程序应该可以跨多个应用程序服务器进行部署,因此我希望遵循适当的标准 . 有问题的应用程序是一个部署在Liferay 6.1中的简单portlet应用程序,在Jboss托管域中运行;我在web.xml,jboss-web.xml和persistence.xml中尝试了各种命名约定组合;一切都无济于事 . 我当前的配置如下所示:

Spring persistence.xml:

web.xml中:

...

jdbc/surveyDS

javax.sql.DataSource

Container

Shareable

的jboss-web.xml中:

jdbc/surveyDS

java:jboss/datasources/surveyDS

$ /domain/configuration/domain.xml中的数据源定义:

****

com.mysql

false

false

FailingConnectionOnly

****

****

部署portlet应用程序工作得很好;但是,当我尝试实际查看portlet时,我得到以下异常:

15:10:05,493 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/survey-portlets].[surveydisplay Servlet]] (ajp--0.0.0.0-8009-3) Servlet.service() for servlet surveydisplay Servlet threw exception: javax.naming.NameNotFoundException: jdbc/surveyDS -- service jboss.naming.context.java.jdbc.surveyDS

at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:87)

at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:173)

at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:47)

at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:209)

at javax.naming.InitialContext.lookup(InitialContext.java:392) [:1.6.0_26]

at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154) [org.springframework.context-3.0.5.RELEASE.jar:]

at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87) [org.springframework.context-3.0.5.RELEASE.jar:]

at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152) [org.springframework.context-3.0.5.RELEASE.jar:]

at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178) [org.springframework.context-3.0.5.RELEASE.jar:]

at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:104) [org.springframework.context-3.0.5.RELEASE.jar:]

at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105) [org.springframework.context-3.0.5.RELEASE.jar:]

at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:201) [org.springframework.context-3.0.5.RELEASE.jar:]

at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:187) [org.springframework.context-3.0.5.RELEASE.jar:]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477) [org.springframework.beans-3.0.5.RELEASE.jar:]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417) [org.springframework.beans-3.0.5.RELEASE.jar:]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) [org.springframework.beans-3.0.5.RELEASE.jar:]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [org.springframework.beans-3.0.5.RELEASE.jar:]

[ ... stack truncated for brevity ]

我觉得我现在必须遗漏一些非常简单明了的东西,但我不知道它可能是什么 . 任何建议将不胜感激!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值