tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: javax.enterprise.inject.UnsatisfiedResolutionException: org.slf4j.Logger
Date Wed, 01 Feb 2012 22:23:45 GMT
create a CDI producer:

public class MyLoggerFactory {
  @Produces
  public Logger logger() {
    return LoggerFactory.getLogger("my-app");
  }
}

- Romain


2012/2/1 maxsilva <maxsilva@gmail.com>

> Hi,
>
> I make test using EjbContainer + maven. In my testcase I would like
> inject org.slf4j.Logger class (Logger logger) but I get errors below:
>
> Please, how I can configure EjbContainer to inject org.slf4j.Logger?
>
> logs:
> 01/02/2012 20:00:35 org.apache.openejb.cdi.CdiBuilder initializeOWB
> INFO: Created new singletonService
> org.apache.openejb.cdi.ThreadSingletonServiceImpl@e80d1ff
> 01/02/2012 20:00:35 org.apache.openejb.cdi.CdiBuilder initializeOWB
> INFO: succeeded in installing singleton service
> Apache OpenEJB 4.0.0-beta-2    build: 20120115-08:26
> http://openejb.apache.org/
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup]
>      openejb.home = D:\projetos\workspace2\tutorial-core
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup]
>      openejb.base = D:\projetos\workspace2\tutorial-core
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.options]
>      Using 'javax.ejb.embeddable.EJBContainer=true'
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.config]
>      openejb configuration file is
> 'D:\projetos\workspace2\tutorial-core\conf\openejb.xml'
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.config]
>      Configuring Service(id=Default Security Service, type=SecurityService,
> provider-id=Default Security Service)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.config]
>      Configuring Service(id=Default Transaction Manager,
> type=TransactionManager, provider-id=Default Transaction Manager)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.config]
>      Configuring Service(id=My DataSource, type=Resource,
> provider-id=Default JDBC Database)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.config]
>      Configuring Service(id=My Unmanaged DataSource, type=Resource,
> provider-id=Default JDBC Database)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.config]
>      Configuring Service(id=My JMS Resource Adapter, type=Resource,
> provider-id=Default JMS Resource Adapter)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.config]
>      Configuring Service(id=My JMS Connection Factory, type=Resource,
> provider-id=Default JMS Connection Factory)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.config]
>      Configuring Service(id=tutorialtestDS, type=Resource,
> provider-id=Default JDBC Database)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.config]
>      Configuring Service(id=My CMP Container, type=Container,
> provider-id=Default CMP Container)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.config]
>      Configuring Service(id=My BMP Container, type=Container,
> provider-id=Default BMP Container)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.config]
>      Configuring Service(id=My Stateful Container, type=Container,
> provider-id=Default Stateful Container)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.config]
>      Configuring Service(id=My Stateless Container, type=Container,
> provider-id=Default Stateless Container)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.config]
>      Configuring Service(id=My MDB Container , type=Container,
> provider-id=Default MDB Container)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.service]
>      Creating TransactionManager(id=Default Transaction Manager)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.service]
>      Creating SecurityService(id=Default Security Service)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.service]
>      Creating Resource(id=My DataSource)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.service]
>      Creating Resource(id=My Unmanaged DataSource)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.service]
>      Creating Resource(id=tutorialtestDS)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.service]
>      Creating Resource(id=My JMS Resource Adapter)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.service]
>      Creating Resource(id=My JMS Connection Factory)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.service]
>      Creating ConnectionManager for Resource(id=My JMS Connection Factory)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.service]
>      Creating Container(id=My CMP Container)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.service]
>      Creating Container(id=My BMP Container)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.service]
>      Creating Container(id=My Stateful Container)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.service]
>      Creating Container(id=My Stateless Container)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.service]
>      Creating Container(id=My MDB Container )
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.config]
>      Beginning load: D:\projetos\workspace2\tutorial-core\target\classes
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.config]
>      Beginning load:
> D:\projetos\workspace2\tutorial-core\target\test-classes
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.config]
>      Configuring enterprise application:
> D:\projetos\workspace2\tutorial-core
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.config]
>      Configuring Service(id=Default Managed Container, type=Container,
> provider-id=Default Managed Container)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.config]
>      Auto-creating a container for bean tutorial-core.Comp:
> Container(type=MANAGED, id=Default Managed Container)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.service]
>      Creating Container(id=Default Managed Container)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.config]
>      Configuring PersistenceUnit(name=tutorial-test-pu,
> provider=org.hibernate.ejb.HibernatePersistence)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.config]
>      Auto-creating a Resource with id 'tutorialtestDSNonJta' of type
> 'DataSource for 'tutorial-test-pu'.
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.config]
>      Configuring Service(id=tutorialtestDSNonJta, type=Resource,
> provider-id=tutorialtestDS)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.service]
>      Creating Resource(id=tutorialtestDSNonJta)
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.config]
>      Adjusting PersistenceUnit tutorial-test-pu <non-jta-data-source> to
> Resource ID 'tutorialtestDSNonJta' from 'null'
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup.config]
>      Enterprise application "D:\projetos\workspace2\tutorial-core" loaded.
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup]
>      Assembling app: D:\projetos\workspace2\tutorial-core
> INFO  01/02/2012 20:00 MP_FRAMEWORK
> [org.apache.bval.jsr303.ConfigurationImpl]
>      ignoreXmlConfiguration == true
> INFO  01/02/2012 20:00 MP_FRAMEWORK
> [org.apache.bval.jsr303.ConfigurationImpl]
>      ignoreXmlConfiguration == true
> INFO  01/02/2012 20:00 MP_FRAMEWORK
> [org.apache.bval.jsr303.ConfigurationImpl]
>      ignoreXmlConfiguration == true
> INFO  01/02/2012 20:00 MP_FRAMEWORK
> [org.hibernate.annotations.common.Version]
>      HCANN000001: Hibernate Commons Annotations {4.0.0.Final}
> INFO  01/02/2012 20:00 MP_FRAMEWORK [org.hibernate.Version]
>      HHH000412: Hibernate Core {4.0.0.CR6}
> INFO  01/02/2012 20:00 MP_FRAMEWORK [org.hibernate.cfg.Environment]
>      HHH000206: hibernate.properties not found
> INFO  01/02/2012 20:00 MP_FRAMEWORK [org.hibernate.cfg.Environment]
>      HHH000021: Bytecode provider name : javassist
> INFO  01/02/2012 20:00 MP_FRAMEWORK [org.hibernate.ejb.Ejb3Configuration]
>      HHH000204: Processing PersistenceUnitInfo [
>        name: tutorial-test-pu
>        ...]
> INFO  01/02/2012 20:00 MP_FRAMEWORK
> [service.jdbc.connections.internal.ConnectionProviderInitiator]
>      HHH000130: Instantiating explicit connection provider:
> org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
> INFO  01/02/2012 20:00 MP_FRAMEWORK [org.hibernate.dialect.Dialect]
>      HHH000400: Using dialect: org.hibernate.dialect.SQLServerDialect
> INFO  01/02/2012 20:00 MP_FRAMEWORK
> [hibernate.engine.transaction.internal.TransactionFactoryInitiator]
>      HHH000268: Transaction strategy:
> org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory
> INFO  01/02/2012 20:00 MP_FRAMEWORK
> [hibernate.hql.internal.ast.ASTQueryTranslatorFactory]
>      HHH000397: Using ASTQueryTranslatorFactory
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup]
>      PersistenceUnit(name=tutorial-test-pu,
> provider=org.hibernate.ejb.HibernatePersistence) - provider time 844ms
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup]
>
>
> Jndi(name="java:global/tutorial-core/ProdutoBC!br.gov.mg.mp.tutorial.business.cadastro.IProdutoBC")
> INFO  01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup]
>      Jndi(name="java:global/tutorial-core/ProdutoBC")
> 01/02/2012 20:00:37 org.apache.openejb.cdi.CdiBuilder build
> INFO: existing thread singleton service in SystemInstance()
> org.apache.openejb.cdi.ThreadSingletonServiceImpl@e80d1ff
> 01/02/2012 20:00:37 org.apache.openejb.cdi.OpenEJBLifecycle
> startApplication
> INFO: OpenWebBeans Container is starting...
> 01/02/2012 20:00:37 org.apache.webbeans.plugins.PluginLoader startUp
> INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
> ERROR 01/02/2012 20:00 MP_FRAMEWORK [OpenEJB.startup]
>      CDI Beans module deployment failed
> javax.enterprise.inject.UnsatisfiedResolutionException: Api type
> [org.slf4j.Logger] is not found with the qualifiers
> Qualifiers: [@javax.enterprise.inject.Default()]
> for injection into Field Injection Point, field name :  log, Bean Owner :
> [PersistenceTest, Name:null, WebBeans Type:MANAGED, API
> Types:[br.gov.mg.mp.tutorial.domain.PersistenceTest,java.lang.Object],
> Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default]]
>        at
>
> org.apache.webbeans.util.InjectionExceptionUtils.throwUnsatisfiedResolutionException(InjectionExceptionUtils.java:92)
>        at
>
> org.apache.webbeans.container.ResolutionUtil.checkResolvedBeans(ResolutionUtil.java:98)
>        at
>
> org.apache.webbeans.container.InjectionResolver.checkInjectionPoints(InjectionResolver.java:193)
>        at
>
> org.apache.webbeans.container.BeanManagerImpl.validate(BeanManagerImpl.java:1134)
>        at
> org.apache.openejb.cdi.BeansDeployer.validate(BeansDeployer.java:262)
>        at
>
> org.apache.openejb.cdi.BeansDeployer.validateInjectionPoints(BeansDeployer.java:215)
>        at
>
> org.apache.openejb.cdi.OpenEJBLifecycle.startApplication(OpenEJBLifecycle.java:306)
>        at
>
> org.apache.openejb.cdi.ThreadSingletonServiceImpl.initialize(ThreadSingletonServiceImpl.java:107)
>        at org.apache.openejb.cdi.CdiBuilder.build(CdiBuilder.java:50)
>        at
>
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:754)
>        at
>
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:497)
>        at
>
> org.apache.openejb.OpenEjbContainer$Provider.createEJBContainer(OpenEjbContainer.java:288)
>        at
> javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:56)
>        at br.gov.mg.mp.test.MpmgRunner.init(MpmgRunner.java:61)
>        at br.gov.mg.mp.test.MpmgRunner.<init>(MpmgRunner.java:28)
>        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
>        at
>
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>        at
>
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>        at
>
> org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
>        at
>
> org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
>        at
>
> org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
>        at
>
> org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
>        at
>
> org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
>        at
> org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
>        at
>
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)
>        at
>
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
>        at
>
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
>        at
>
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
>        at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
>        at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>        at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>        at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>
> My test class:
> public class PersistenceTest {
>
>        @PersistenceContext
>        private EntityManager entityManager;
>
>        @Inject
>        private Logger log;
>
>        @Test
>        public void test() {
>
>                log.info("teste");
>        }
> }
>
> Maxwell
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/javax-enterprise-inject-UnsatisfiedResolutionException-org-slf4j-Logger-tp4349676p4349676.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message