Announcement Announcement Module
Collapse
No announcement yet.
Spring-data +cdi = Unable to resolve a bean for 'javax.persistence.EntityManager' Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring-data +cdi = Unable to resolve a bean for 'javax.persistence.EntityManager'

    What can be wrong?

    ---------------------------------------------
    [#|2012-05-20T17:59:22.180+0400|SEVERE|glassfish3.1.2|javax.e nterprise.system.tools.admin.org.glassfish.deploym ent.admin|_ThreadID=53;_ThreadName=Thread-2;|Exception while loading the app : Exception List with 1 exceptions:
    Exception 0 :
    javax.enterprise.inject.UnsatisfiedResolutionExcep tion: Unable to resolve a bean for 'javax.persistence.EntityManager' with qualifiers [@javax.enterprise.inject.Any(), @javax.enterprise.inject.Default()].
    at org.springframework.data.jpa.repository.cdi.JpaRep ositoryExtension.createRepositoryBean(JpaRepositor yExtension.java:110)
    at org.springframework.data.jpa.repository.cdi.JpaRep ositoryExtension.afterBeanDiscovery(JpaRepositoryE xtension.java:89)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.jboss.weld.util.reflection.SecureReflections$1 3.work(SecureReflections.java:264)
    at org.jboss.weld.util.reflection.SecureReflectionAcc ess.run(SecureReflectionAccess.java:52)
    at org.jboss.weld.util.reflection.SecureReflectionAcc ess.runAsInvocation(SecureReflectionAccess.java:13 7)
    at org.jboss.weld.util.reflection.SecureReflections.i nvoke(SecureReflections.java:260)
    at org.jboss.weld.introspector.jlr.WeldMethodImpl.inv okeOnInstance(WeldMethodImpl.java:170)
    at org.jboss.weld.introspector.ForwardingWeldMethod.i nvokeOnInstance(ForwardingWeldMethod.java:51)
    at org.jboss.weld.injection.MethodInjectionPoint.invo keOnInstanceWithSpecialValue(MethodInjectionPoint. java:154)
    at org.jboss.weld.event.ObserverMethodImpl.sendEvent( ObserverMethodImpl.java:241)
    at org.jboss.weld.event.ObserverMethodImpl.sendEvent( ObserverMethodImpl.java:229)
    at org.jboss.weld.event.ObserverMethodImpl.notify(Obs erverMethodImpl.java:207)
    at org.jboss.weld.bootstrap.events.AbstractContainerE vent.fire(AbstractContainerEvent.java:75)
    at org.jboss.weld.bootstrap.events.AbstractDefinition ContainerEvent.fire(AbstractDefinitionContainerEve nt.java:46)
    at org.jboss.weld.bootstrap.events.AfterBeanDiscovery Impl.fire(AfterBeanDiscoveryImpl.java:40)
    at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans (WeldBootstrap.java:346)
    at org.glassfish.weld.WeldDeployer.event(WeldDeployer .java:179)
    at org.glassfish.kernel.event.EventsImpl.send(EventsI mpl.java:128)
    at org.glassfish.internal.data.ApplicationInfo.load(A pplicationInfo.java:277)
    at com.sun.enterprise.v3.server.ApplicationLifecycle. deploy(ApplicationLifecycle.java:460)
    at com.sun.enterprise.v3.server.ApplicationLifecycle. deploy(ApplicationLifecycle.java:240)
    at org.glassfish.deployment.admin.DeployCommand.execu te(DeployCommand.java:389)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.ex ecute(CommandRunnerImpl.java:348)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCo mmand(CommandRunnerImpl.java:363)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCo mmand(CommandRunnerImpl.java:1085)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.acce ss$1200(CommandRunnerImpl.java:95)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$Exec utionContext.execute(CommandRunnerImpl.java:1291)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$Exec utionContext.execute(CommandRunnerImpl.java:1259)
    at com.sun.enterprise.v3.admin.AdminAdapter.doCommand (AdminAdapter.java:461)
    at com.sun.enterprise.v3.admin.AdminAdapter.service(A dminAdapter.java:212)
    at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service( GrizzlyAdapter.java:179)
    at com.sun.enterprise.v3.server.HK2Dispatcher.dispath (HK2Dispatcher.java:117)
    at com.sun.enterprise.v3.services.impl.ContainerMappe r$Hk2DispatcherCallable.call(ContainerMapper.java: 354)
    at com.sun.enterprise.v3.services.impl.ContainerMappe r.service(ContainerMapper.java:195)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(P rocessorTask.java:849)
    at com.sun.grizzly.http.ProcessorTask.doProcess(Proce ssorTask.java:746)
    at com.sun.grizzly.http.ProcessorTask.process(Process orTask.java:1045)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute (DefaultProtocolFilter.java:228)
    at com.sun.grizzly.DefaultProtocolChain.executeProtoc olFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(Defau ltProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(Defau ltProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(Htt pProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(Pr otocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(Selec tionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:7 1)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doW ork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run (AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:722)

  • #2
    Did you resolve this problem? How?
    Thanks

    Comment


    • #3
      Originally posted by pcaetano View Post
      Did you resolve this problem? How?
      Thanks

      Ok, I solved this problem implementing an EntityManager Producer (copied from spring data tests):

      Code:
      class UnqualifiedEntityManagerProducer {
      
      	@Produces
      	public EntityManager createEntityManager(
      			EntityManagerFactory entityManagerFactory) {
      		return entityManagerFactory.createEntityManager();
      	}
      
      	public void close(@Disposes EntityManager entityManager) {
      		entityManager.close();
      	}
      
      }

      Comment


      • #4
        What means "Unqualified" EntityManager producer?

        Comment

        Working...
        X