My Oracle Support Banner

Error While Restarting An application With Dependency Injection into an EJB (Doc ID 1490482.1)

Last updated on APRIL 12, 2018

Applies to:

Oracle Weblogic Server - Version 12.1.1.0 to 12.1.1.0 [Release 12c]
Information in this document applies to any platform.

Symptoms

When attempting to restart an application deployed to a cluster with EJB Resource Dependency Injection in the code, such us:

  @Singleton
  @Startup
  public class TroubleShootTesting {
  @Resource(mappedName="datasource")
  private DataSource mclsDataSourceSingle = null;
  }

     If we remove @Startup (and of course @Resource) then error is gone.

or

 if two EJBs deployed in a cluster that uses @Singleton , @Startup and @Resource and @DependsOn referring a data-source.

  @Singleton
  @Startup
  public class TroubleShootTesting {
  @Resource(mappedName="datasource")
  private DataSource mclsDataSourceSingle = null;
  }


  @Singleton
  @Startup
  @DependsOn("TroubleShootTesting")
  public class TroubleShootTesting2 {
  @EJB
  private TroubleShootTesting mclsTroubleShoot = null;
  }

 

or


  @Stateless(mappedName="TestEjb")
  @WebService(endpointInterface="hu.test.service.TestEjbWSInterface", serviceName="TestEjb")
  public class TestEjb
    implements TestEjbRemote, TestEjbWSInterface
  {
 
    @EJB
    private TestDao dao;
    ...

 ----

 @Local
 public abstract interface TestDao

 

Among others,  the following error occurs:


  weblogic.application.ModuleException: Exception starting module: EJBModule(TroubleShootJar.jar)

  Unable to deploy EJB: TroubleShootTesting from TroubleShootJar.jar:

  Singleton TroubleShootTesting(Application: TroubleShootEar, EJBComponent: TroubleShootJar.jar) failed to initialize.
:com.bea.core.repackaged.springframework.beans.factory.NoSuchBeanDefinitionException:No unique bean of type [javax.sql.DataSource] is defined: No beans of typejavax.sql.DataSource;
owner=com.bea.core.repackaged.springframework.context.support.GenericApplicationContext@1a431fd: display name [com.bea.core.repackaged.springframework.context.support.GenericApplicationContext@1a431fd]; startup date [Tue Jun 12 13:33:15 CLT 2012]; parent:
com.bea.core.repackaged.springframework.context.support.GenericApplicationContext@168e546
at com.oracle.pitchfork.inject.Jsr250Metadata.getUniqueInstanceOfType(Jsr250Metadata.java:351)
at com.oracle.pitchfork.inject.Jsr250Metadata.resolveByType(Jsr250Metadata.java:345)
at com.oracle.pitchfork.inject.Jsr250Metadata.resolve(Jsr250Metadata.java:275)
at com.oracle.pitchfork.inject.Jsr250Metadata.applyInjections(Jsr250Metadata.java:228)
at com.oracle.pitchfork.inject.Jsr250Metadata.inject(Jsr250Metadata.java:219)
Truncated. see log file for complete stacktrace

 

 

 

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Cause
Solution
References

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.