Weblogic +无状态本地Bean + DataSource注入错误

时间:2012-10-15 19:51:00

标签: weblogic ejb-3.0 local stateless-session-bean

我有一个像这样的无状态本地Bean:

@Stateless(name="GerencialFacadeBean", mappedName="GerencialFacade")
public class GerencialFacadeBean implements GerencialFacadeBeanLocal {

    @Resource(name="jdbc/adq_sistint", mappedName = "jdbc/adq_sistint")
    private DataSource dataSource;
.. }

所以,当我使用这个bean时,我得到了以下异常:

Caused by: com.bea.core.repackaged.springframework.beans.factory.BeanCreationException: Dependency injection failure: can't find the bean definition about class 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; owner=com.bea.core.repackaged.springframework.context.support.GenericApplicationContext@5d225fc1: display name [com.bea.core.repackaged.springframework.context.support.GenericApplicationContext@5d225fc1]; startup date [Mon Oct 15 16:30:12 BRT 2012]; parent: com.bea.core.repackaged.springframework.context.support.GenericApplicationContext@885e019
    at com.oracle.pitchfork.inject.Jsr250Metadata.applyInjections(Jsr250Metadata.java:241)
    at com.oracle.pitchfork.inject.Jsr250Metadata.inject(Jsr250Metadata.java:223)
    at com.oracle.pitchfork.inject.Jsr250Metadata.injectAndPostConstruct(Jsr250Metadata.java:253)
    at com.oracle.pitchfork.inject.Jsr250MetadataBeanPostProcessor.postProcessAfterInstantiation(Jsr250MetadataBeanPostProcessor.java:40)
    at com.bea.core.repackaged.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:957)
    at com.bea.core.repackaged.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:470)
    ... 66 more
Caused by: 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.springframework.context.support.GenericApplicationContext@5d225fc1: display name [com.bea.core.repackaged.springframework.context.support.GenericApplicationContext@5d225fc1]; startup date [Mon Oct 15 16:30:12 BRT 2012]; parent: com.bea.core.repackaged.springframework.context.support.GenericApplicationContext@885e019
    at com.oracle.pitchfork.inject.Jsr250Metadata.getUniqueInstanceOfType(Jsr250Metadata.java:304)
    at com.oracle.pitchfork.inject.Jsr250Metadata.resolveByType(Jsr250Metadata.java:298)
    at com.oracle.pitchfork.inject.Jsr250Metadata.resolve(Jsr250Metadata.java:285)
    at com.oracle.pitchfork.inject.Jsr250Metadata.applyInjections(Jsr250Metadata.java:235) 

重要的:

我在Webservice(在同一个EAR中)使用此EJB,例如:

.. class MyWebService.. {
 @EJB(name="GerencialFacadeBean", mappedName="GerencialFacade")
 private GerencialFacadeBeanLocal gerencialBean;

}

并且,如果我尝试在Webservice的类上获得数据源,它就可以成功运行。

编辑:

另一个考虑因素:使用REMOTE接口可行。但我想将它与Local interface一起使用。

我正在使用Weblogic 10.3.5。我的数据源是在其他应用程序中创建并运行良好的(由JNDI直接获取),那么,我得到的是什么错误?

0 个答案:

没有答案