gpt4 book ai didi

java - Weblogic 10.3 MDB 抛出 javax.sql.DataSource 异常

转载 作者:行者123 更新时间:2023-11-30 11:58:33 25 4
gpt4 key购买 nike

以下是我正在使用的应用程序:

  1. 网络逻辑 10.3.3
  2. Websphere MQ 7.0
  3. Oracle 11g 快捷版(数据库)

这是当前的流程:

  1. 一条消息由 Weblogic 从 Websphere MQ 队列中读取并由 MDB 处理
  2. MDB将消息保存到DB
  3. MDB 将消息写入另一个 Websphere MQ 队列

这是一个 XA 事务,因此如果以上任何操作失败,消息将返回到原始队列。

这是我在 Websphere MQ 队列上放置消息以启动进程时的错误:

<Jun 29, 2010 11:15:15 PM CDT> <Error> <EJB> <BEA-010080> <An error occurred whi
le attempting to process a message inside a message-driven bean: com.bea.core.re
packaged.springframework.beans.factory.BeanCreationException: Dependency injecti
on failure: can't find the bean definition about class interface javax.sql.DataS
ource; nested exception is com.bea.core.repackaged.springframework.beans.factory
.NoSuchBeanDefinitionException: No unique bean of type [javax.sql.DataSource] is
defined: No beans of type javax.sql.DataSource; owner=com.bea.core.repackaged.s
pringframework.context.support.GenericApplicationContext@3de84b8: display name [
com.bea.core.repackaged.springframework.context.support.GenericApplicationContex
t@3de84b8]; startup date [Tue Jun 29 23:14:53 CDT 2010]; parent: com.bea.core.re
packaged.springframework.context.support.GenericApplicationContext@3dd694f
Nested exception: com.bea.core.repackaged.springframework.beans.factory.NoSuchBe
anDefinitionException: No unique bean of type [javax.sql.DataSource] is defined:
No beans of type javax.sql.DataSource; owner=com.bea.core.repackaged.springfram
ework.context.support.GenericApplicationContext@3de84b8: display name [com.bea.c
ore.repackaged.springframework.context.support.GenericApplicationContext@3de84b8
]; startup date [Tue Jun 29 23:14:53 CDT 2010]; parent: com.bea.core.repackaged.
springframework.context.support.GenericApplicationContext@3dd694f
Exception is : com.bea.core.repackaged.springframework.beans.factory.BeanCreatio
nException: Dependency injection failure: can't find the bean definition about c
lass interface javax.sql.DataSource; nested exception is com.bea.core.repackaged
.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of
type [javax.sql.DataSource] is defined: No beans of type javax.sql.DataSource; o
wner=com.bea.core.repackaged.springframework.context.support.GenericApplicationC
ontext@3de84b8: display name [com.bea.core.repackaged.springframework.context.su
pport.GenericApplicationContext@3de84b8]; startup date [Tue Jun 29 23:14:53 CDT
2010]; parent: com.bea.core.repackaged.springframework.context.support.GenericAp
plicationContext@3dd694f
at com.bea.core.repackaged.springframework.jee.inject.Jsr250Metadata.app
lyInjections(Jsr250Metadata.java:244)
at com.bea.core.repackaged.springframework.jee.inject.Jsr250Metadata.inj
ect(Jsr250Metadata.java:226)
at com.bea.core.repackaged.springframework.jee.spi.EjbComponentCreatorBr
okerImpl.injection(EjbComponentCreatorBrokerImpl.java:112)
at com.bea.core.repackaged.springframework.jee.spi.EjbComponentCreatorBr
okerImpl.getBean(EjbComponentCreatorBrokerImpl.java:70)
at weblogic.ejb.container.injection.EjbComponentCreatorImpl.getBean(EjbC
omponentCreatorImpl.java:68)
at weblogic.ejb.container.manager.BaseEJBManager.createNewBeanInstance(B
aseEJBManager.java:216)
at weblogic.ejb.container.manager.BaseEJBManager.allocateBean(BaseEJBMan
ager.java:231)
at weblogic.ejb.container.manager.MessageDrivenManager.createBean(Messag
eDrivenManager.java:288)
at weblogic.ejb.container.pool.MessageDrivenPool.createBean(MessageDrive
nPool.java:174)
at weblogic.ejb.container.pool.MessageDrivenPool.getBean(MessageDrivenPo
ol.java:99)
at weblogic.ejb.container.internal.MDListener.execute(MDListener.java:43
4)
at weblogic.ejb.container.internal.MDListener.transactionalOnMessage(MDL
istener.java:371)
at weblogic.ejb.container.internal.NewJMSMessagePoller.processOneMessage
(NewJMSMessagePoller.java:248)
at weblogic.ejb.container.internal.NewJMSMessagePoller.run(NewJMSMessage
Poller.java:121)
at weblogic.ejb.container.internal.NewJMSMessagePoller.timerExpired(NewJ
MSMessagePoller.java:208)
at weblogic.timers.internal.TimerImpl.run(TimerImpl.java:273)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTunin
gWorkManagerImpl.java:528)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused by: com.bea.core.repackaged.springframework.beans.factory.NoSuchBeanDefin
itionException: No unique bean of type [javax.sql.DataSource] is defined: No bea
ns of type javax.sql.DataSource; owner=com.bea.core.repackaged.springframework.c
ontext.support.GenericApplicationContext@3de84b8: display name [com.bea.core.rep
ackaged.springframework.context.support.GenericApplicationContext@3de84b8]; star
tup date [Tue Jun 29 23:14:53 CDT 2010]; parent: com.bea.core.repackaged.springf
ramework.context.support.GenericApplicationContext@3dd694f
at com.bea.core.repackaged.springframework.jee.inject.Jsr250Metadata.get
UniqueInstanceOfType(Jsr250Metadata.java:305)
at com.bea.core.repackaged.springframework.jee.inject.Jsr250Metadata.res
olveByType(Jsr250Metadata.java:299)
at com.bea.core.repackaged.springframework.jee.inject.Jsr250Metadata.res
olve(Jsr250Metadata.java:286)
at com.bea.core.repackaged.springframework.jee.inject.Jsr250Metadata.app
lyInjections(Jsr250Metadata.java:238)
at com.bea.core.repackaged.springframework.jee.inject.Jsr250Metadata.inj
ect(Jsr250Metadata.java:227)
at com.bea.core.repackaged.springframework.jee.spi.EjbComponentCreatorBr
okerImpl.injection(EjbComponentCreatorBrokerImpl.java:112)
at com.bea.core.repackaged.springframework.jee.spi.EjbComponentCreatorBr
okerImpl.getBean(EjbComponentCreatorBrokerImpl.java:74)
... 15 more
>
<Jun 29, 2010 11:15:15 PM CDT> <Warning> <EJB> <BEA-010065> <MessageDrivenBean t
hrew an Exception in onMessage(). The exception was:
com.bea.core.repackaged.springframework.beans.factory.BeanCreationException: De
pendency injection failure: can't find the bean definition about class interface
javax.sql.DataSource; nested exception is com.bea.core.repackaged.springframewo
rk.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.sq
l.DataSource] is defined: No beans of type javax.sql.DataSource; owner=com.bea.c
ore.repackaged.springframework.context.support.GenericApplicationContext@3de84b8
: display name [com.bea.core.repackaged.springframework.context.support.GenericA
pplicationContext@3de84b8]; startup date [Tue Jun 29 23:14:53 CDT 2010]; parent:
com.bea.core.repackaged.springframework.context.support.GenericApplicationConte
xt@3dd694f.
com.bea.core.repackaged.springframework.beans.factory.BeanCreationException: Dep
endency injection failure: can't find the bean definition about class interface
javax.sql.DataSource; nested exception is com.bea.core.repackaged.springframewor
k.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.sql
.DataSource] is defined: No beans of type javax.sql.DataSource; owner=com.bea.co
re.repackaged.springframework.context.support.GenericApplicationContext@3de84b8:
display name [com.bea.core.repackaged.springframework.context.support.GenericAp
plicationContext@3de84b8]; startup date [Tue Jun 29 23:14:53 CDT 2010]; parent:
com.bea.core.repackaged.springframework.context.support.GenericApplicationContex
t@3dd694f
at com.bea.core.repackaged.springframework.jee.inject.Jsr250Metadata.app
lyInjections(Jsr250Metadata.java:244)
at com.bea.core.repackaged.springframework.jee.inject.Jsr250Metadata.inj
ect(Jsr250Metadata.java:226)
at com.bea.core.repackaged.springframework.jee.spi.EjbComponentCreatorBr
okerImpl.injection(EjbComponentCreatorBrokerImpl.java:112)
at com.bea.core.repackaged.springframework.jee.spi.EjbComponentCreatorBr
okerImpl.getBean(EjbComponentCreatorBrokerImpl.java:70)
at weblogic.ejb.container.injection.EjbComponentCreatorImpl.getBean(EjbC
omponentCreatorImpl.java:68)
Truncated. see log file for complete stacktrace

这是我如何在我的代码中连接到我的数据库

// Datasource declaration
@Resource(name = "database", mappedName = "datasource/oracle-11g")
private DataSource database;
...
// Save data to messages table
String sql = "insert into messages(payload) values(?)";
OracleConnection dbConn = (OracleConnection) database.getConnection();
OraclePreparedStatement insertSql = (OraclePreparedStatement)
dbConn.prepareStatement(sql);
insertSql.setStringForClob(1, msgPayload);
insertSql.execute();

到目前为止,我已完成以下故障排除:

  1. 我检查了我的数据源以确认 jndi 名称确实是“datasource/oracle-11g”
  2. 我已经能够在数据源设置期间通过“测试配置”按钮成功连接到数据库
  3. 我已验证消息表确实存在于数据库中

有没有办法打开日志记录,以便我可以看到任何特定的 JDBC 数据库连接错误?

最佳答案

您可能没有为 weblogic 管理控制台中定义的数据源设置目标管理服务器。如果设置正确,则不应出现此错误。

关于java - Weblogic 10.3 MDB 抛出 javax.sql.DataSource 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3154433/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com