Here are the applications that I'm using:
- Weblogic 10.3.3
- Websphere MQ 7.0
- Oracle 11g Express Edition (DB)
Here is the current process flow:
- A message is read off a Websphere MQ queue by Weblogic and processed by the MDB
- The MDB saves the message to the DB
- The MDB writes the message to another Websphere MQ queue
This is an XA transaction so if anything above fails, the message will be returned to the original queue.
Here is the error when I put a message on the Websphere MQ queue to start the process:
<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
Here is how I'm connecting to my database in my code
// 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();
I've done the following to troubleshoot so far:
- I've checked my datasource to confirm that the jndi name is indeed "datasource/oracle-11g
- I have successfully been able to connect to the database via Test Configuration button during datasource setup
- I've validated that the messages table does exist in the db
Is there anyway to turn up logging so I can see any specific JDBC connections errors to the database?