7 Replies Latest reply: Aug 8, 2011 2:09 PM by Steve Ebersole RSS

Services with missing/unavailable dependencies EntityManager

Raphael Ferreira Newbie

Hello, we have an application running on glassfish jee6 and want to migrate to jboss7. The application is a war and uses two persistence to access two separate base.

 

The persistence:

 

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
      http://java.sun.com/xml/ns/persistence
      http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="siscoex-persistence-unit">
  <provider>org.hibernate.ejb.HibernatePersistence</provider>
  <jta-data-source>jdbc/siscoex</jta-data-source>

 

  <jar-file>lib/siscoex-core-0.3.0-SNAPSHOT.jar</jar-file>-->
  <jar-file>lib/seta-jee-core-0.0.2.jar</jar-file>
  <properties>
   <property name="hibernate.default_schema" value="siscoex" />
   <property name="hibernate.ejb.use_class_enhancer" value="true" />
   <property name="hibernate.show_sql" value="true" />
   <property name="hibernate.bytecode.provider" value="javassist" />
   <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
   <property name="LC_MESSAGES" value="en_us" />
   <!-- <property name="hibernate.hbm2ddl.auto" value="update" /> -->
  </properties>
</persistence-unit>

<persistence-unit name="seta-persistence-unit">
  <provider>org.hibernate.ejb.HibernatePersistence</provider>
  <jta-data-source>jdbc/seta_jee</jta-data-source>
  <jar-file>lib/seta-jee-core-0.0.2.jar</jar-file>
  <properties>
   <property name="hibernate.default_schema" value="seta" />
   <property name="hibernate.show_sql" value="true" />
   <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
   <property name="LC_MESSAGES" value="en_us" />
   <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
      <property name = "hibernate.query.factory_class" value="org.hibernate.hql.classic.ClassicQueryTranslatorFactory"/>
      <property name="hibernate.archive.autodetection" value="class"/>
  </properties>
</persistence-unit>

</persistence>

 

 

The EJB:

 

@Stateless
public class PaisManagerBean implements PaisManager {

@PersistenceContext(unitName = "seta-persistence-unit")
private EntityManager ems;

@Override
public Pais buscarPorCodigoSiscomex(Integer codigoSiscomex) {
  try {
   return ems.createQuery("from Pais where codigoSiscomex = :c", Pais.class).setParameter("c", codigoSiscomex)
     .getSingleResult();
  } catch (NoResultException e) {
   return null;
  }
}
}

 

The Error:

Can anyone give any clues?

 

thk regards,

Raphael

 

10:14:44,929 ERROR [org.jboss.as.deployment] (DeploymentScanner-threads - 1) {"Composite operation failed and was rolled back. Steps that failed:" =>
{"Operation step-2" => {"Services with missing/unavailable dependencies" =>

["jboss.deployment.unit.\"siscoex-internet.war\".component.PaisManagerBean.START missing
[ jboss.naming.context.java.module.siscoex-internet.siscoex-internet.\"env/br.gov.ce.sefaz.seta.jee.core.manager.bean.PaisManagerBean/ems\" ]",

"jboss.deployment.unit.\"siscoex-internet.war\".jndiDependencyService missing
[ jboss.naming.context.java.module.siscoex-internet.siscoex-internet.\"env/br.gov.ce.sefaz.seta.jee.core.manager.bean.UnidadeFederacaoManagerBean/ems\",
  jboss.naming.context.java.module.siscoex-internet.siscoex-internet.\"env/br.gov.ce.sefaz.seta.jee.core.manager.bean.PaisManagerBean/ems\" ]",

"jboss.deployment.unit.\"siscoex-internet.war\".component.UnidadeFederacaoManagerBean.START missing
[ jboss.naming.context.java.module.siscoex-internet.siscoex-internet.\"env/br.gov.ce.sefaz.seta.jee.core.manager.bean.UnidadeFederacaoManagerBean/ems\" ]"]}}}

The Datasource:

               <datasource jndi-name="jdbc/siscoex" pool-name="siscoex_pool_Pool" enabled="true" jta="true" use-java-context="true" use-ccm="true">
                    <connection-url>
                        jdbc:postgresql://localhost:5432/siscoex
                    </connection-url>
                    <driver>
                        postgresql-8.4-701.jdbc4.jar
                    </driver>
                    <security>
                        <user-name>
                            postgres
                        </user-name>
                        <password>
                            postgres

                        </password>
                    </security>
                </datasource>

                <datasource jndi-name="jdbc/seta_jee" pool-name="seta_jee_pool_Pool" enabled="true" jta="true" use-java-context="true" use-ccm="true">
                    <connection-url>
                        jdbc:postgresql://localhost:5432/siscoex
                    </connection-url>
                    <driver>
                        postgresql-8.4-701.jdbc4.jar
                    </driver>
                    <security>
                        <user-name>
                            postgres
                        </user-name>
                        <password>       

                           postgres

                       </password>
                    </security>
                </datasource>

  • 1. Re: Services with missing/unavailable dependencies EntityManager
    Evie White Newbie

    I am experiencing the same problem. I am migrating from Glassfish to JBoss and I want to maintain the dependency injection of the PersistenceContext into the stateless session beans so that they can perform database manipulation via JPA. I am using JBoss AS 7 (Final) with the "standalone" configuration.

     

    I have several stateless session beans and one datasource that are configured in the exact manner outlined by the thread poster Raphael. Upon deployment, all beans receive the "Services with missing/unavailable dependencies" error.

     

    However, if I remove the @PersistenceContext annotation from the EntityManager class variable in one bean then that one bean does NOT fail. (However, now EntityManager is null and any calls to it, obviously, would fail. I was just experimenting.)

     

    Does JBoss AS 7 even support @PersistenceContext?

  • 2. Re: Services with missing/unavailable dependencies EntityManager
    Scott Marlow Master

    Can you attach a zipped up copy of the as/standalone/log/server.log file. 

     

    Also try removing the hibernate.transaction.manager_lookup_class property from your persistence.xml.

     

    Also give us a listing of the war file contents and the archive that contains the persistence.xml (if it is contained in a sub-jar).

  • 3. Re: Services with missing/unavailable dependencies EntityManager
    Scott Marlow Master

    if the EntityManager is null, your situation sounds a little different.  It sounds like your deployment succeeded but the EM injection didn't happen for some reason.

     

    Could you provide the same information as requested of Raphael above?

  • 4. Re: Services with missing/unavailable dependencies EntityManager
    Raphael Ferreira Newbie

    Hi Scott, thk for your attention.

     

    I pulled out the property mentioned and gave the same error. I am sending you the log to analyze. Details on the main project I changed the layout of the injection @ PersistenceContext to use the resources pattern design quickstarted and he did not make that mistake. These are classes that are giving error that will access the second persists and they remain as jar in lib main project. If I change it to use the resources pattern there to ambiguity error because you do not know @ Inject PersistenceContext inject. I even created an @ Qualifier but did not work.

     

    I wonder if without using the standard resource works and what the problem itself.

     

    thks reggards.

     

    LOG

     

    16:04:05,598 INFO  [org.jboss.as.connector.subsystems.datasources] (Controller Boot Thread) Deploying JDBC-compliant driver class org.h2.Driver (version 1.2)
    16:04:05,629 INFO  [org.jboss.as.clustering.infinispan.subsystem] (Controller Boot Thread) Activating Infinispan subsystem.
    16:04:05,911 INFO  [org.jboss.as.naming] (Controller Boot Thread) Activating Naming Subsystem
    16:04:05,926 INFO  [org.jboss.as.naming] (MSC service thread 1-4) Starting Naming Service
    16:04:05,942 INFO  [org.jboss.as.osgi] (Controller Boot Thread) Activating OSGi Subsystem
    16:04:05,989 INFO  [org.jboss.as.security] (Controller Boot Thread) Activating Security Subsystem
    16:04:06,004 INFO  [org.jboss.remoting] (MSC service thread 1-1) JBoss Remoting version 3.2.0.Beta2
    16:04:06,145 INFO  [org.xnio] (MSC service thread 1-1) XNIO Version 3.0.0.Beta3
    16:04:06,270 INFO  [org.xnio.nio] (MSC service thread 1-1) XNIO NIO Implementation Version 3.0.0.Beta3
    16:04:17,630 INFO  [org.apache.catalina.core.AprLifecycleListener] (MSC service thread 1-4) The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Arquivos de programas\Java\jdk1.6.0_21\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Arquivos de programas/java/jre6/bin/client;C:/Arquivos de programas/java/jre6/bin;C:/Arquivos de programas/java/jre6/lib/i386;C:\oracle\ora92\bin;C:\Arquivos de programas\java\jre6\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Arquivos de programas\Intel\DMIX;C:\Arquivos de programas\cvsnt;C:\Raphael\instaladores\maven\apache-maven-3.0-RC3\bin;C:\Arquivos de programas\NetBeans 6.9.1\java\ant\bin;C:\glassfishv3\bin;C:\Arquivos de programas\MySQL\MySQL Server 5.5\bin;C:\eclipse;
    16:04:17,755 INFO  [org.jboss.as.ee] (Controller Boot Thread) Activating EE subsystem
    16:04:17,849 INFO  [org.jboss.as.remoting] (MSC service thread 1-2) Listening on /127.0.0.1:9999
    16:04:17,989 INFO  [org.jboss.as.jmx.JMXConnectorService] (MSC service thread 1-3) Starting remote JMX connector
    16:04:17,989 INFO  [com.arjuna.ats.jbossatx] (MSC service thread 1-2) ARJUNA32010: JBossTS Recovery Service (tag: JBOSSTS_4_15_1_Final) - JBoss Inc.
    16:04:18,052 INFO  [com.arjuna.ats.arjuna] (MSC service thread 1-2) ARJUNA12324: Start RecoveryActivators
    16:04:18,146 INFO  [com.arjuna.ats.arjuna] (Transaction Expired Entry Monitor) ARJUNA12296: ExpiredEntryMonitor running at Qui, 4 Ago 2011 16:04:18
    16:04:18,302 INFO  [com.arjuna.ats.arjuna] (MSC service thread 1-2) ARJUNA12343: RecoveryManagerImple is ready. Socket listener is turned off.
    16:04:18,302 INFO  [com.arjuna.ats.jbossatx] (MSC service thread 1-2) ARJUNA32013: Starting transaction recovery manager
    16:04:18,302 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-1) Starting Coyote HTTP/1.1 on http--127.0.0.1-8080
    16:04:18,365 INFO  [com.arjuna.ats.jbossatx] (MSC service thread 1-2) ARJUNA32017: JBossTS Transaction Service (JTA version - tag: JBOSSTS_4_15_1_Final) - JBoss Inc.
    16:04:18,693 INFO  [org.jboss.as.connector] (MSC service thread 1-2) Starting JCA Subsystem (JBoss IronJacamar 1.0.0.CR2)
    16:04:18,849 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) Bound data source [java:jboss/datasources/ExampleDS]
    16:04:19,896 INFO  [org.jboss.as.deployment] (MSC service thread 1-2) Started FileSystemDeploymentService for directory C:\jboss-as-web-7.0.0.Final\standalone\deployments
    16:04:19,943 INFO  [org.jboss.as.deployment] (DeploymentScanner-threads - 1) Found siscoex-internet.war in deployment directory. To trigger deployment create a file called siscoex-internet.war.dodeploy
    16:04:20,521 INFO  [org.jboss.as.controller] (Controller Boot Thread) Service status report
       New missing/unsatisfied dependencies:
          service jboss.jdbc-driver.ojdbc6_jar (missing)
          service jboss.jdbc-driver.postgresql-8_4-701_jdbc4_jar (missing)

    16:04:20,552 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) Starting deployment of "siscoex-internet.war"
    16:04:27,943 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-4) Class Path entry log4j.jar in "/C:/jboss-as-web-7.0.0.Final/standalone/deployments/siscoex-internet.war/WEB-INF/lib/commons-logging-1.0.2.jar"  does not point to a valid jar for a Class-Path reference.
    16:04:27,943 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-4) Class Path entry log4j-core.jar in "/C:/jboss-as-web-7.0.0.Final/standalone/deployments/siscoex-internet.war/WEB-INF/lib/commons-logging-1.0.2.jar"  does not point to a valid jar for a Class-Path reference.
    16:04:27,943 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-4) Class Path entry jaxb-api.jar in "/C:/jboss-as-web-7.0.0.Final/standalone/deployments/siscoex-internet.war/WEB-INF/lib/jaxb-impl-2.1.3.jar"  does not point to a valid jar for a Class-Path reference.
    16:04:27,943 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-4) Class Path entry activation.jar in "/C:/jboss-as-web-7.0.0.Final/standalone/deployments/siscoex-internet.war/WEB-INF/lib/jaxb-impl-2.1.3.jar"  does not point to a valid jar for a Class-Path reference.
    16:04:27,943 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-4) Class Path entry jsr173_1.0_api.jar in "/C:/jboss-as-web-7.0.0.Final/standalone/deployments/siscoex-internet.war/WEB-INF/lib/jaxb-impl-2.1.3.jar"  does not point to a valid jar for a Class-Path reference.
    16:04:27,943 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-4) Class Path entry jaxb1-impl.jar in "/C:/jboss-as-web-7.0.0.Final/standalone/deployments/siscoex-internet.war/WEB-INF/lib/jaxb-impl-2.1.3.jar"  does not point to a valid jar for a Class-Path reference.
    16:04:27,943 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-4) Class Path entry activation.jar in "/C:/jboss-as-web-7.0.0.Final/standalone/deployments/siscoex-internet.war/WEB-INF/lib/mail-1.4.jar"  does not point to a valid jar for a Class-Path reference.
    16:04:27,943 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-4) Class Path entry xml-apis.jar in "/C:/jboss-as-web-7.0.0.Final/standalone/deployments/siscoex-internet.war/WEB-INF/lib/serializer-2.7.1.jar"  does not point to a valid jar for a Class-Path reference.
    16:04:27,943 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-4) Class Path entry xercesImpl.jar in "/C:/jboss-as-web-7.0.0.Final/standalone/deployments/siscoex-internet.war/WEB-INF/lib/xalan-2.7.1.jar"  does not point to a valid jar for a Class-Path reference.
    16:04:27,943 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-4) Class Path entry xml-apis.jar in "/C:/jboss-as-web-7.0.0.Final/standalone/deployments/siscoex-internet.war/WEB-INF/lib/xalan-2.7.1.jar"  does not point to a valid jar for a Class-Path reference.
    16:04:27,943 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-4) Class Path entry serializer.jar in "/C:/jboss-as-web-7.0.0.Final/standalone/deployments/siscoex-internet.war/WEB-INF/lib/xalan-2.7.1.jar"  does not point to a valid jar for a Class-Path reference.
    16:04:28,490 INFO  [org.jboss.jpa] (MSC service thread 1-4) read persistence.xml for siscoex-persistence-unit
    16:04:28,490 INFO  [org.jboss.jpa] (MSC service thread 1-4) read persistence.xml for seta-persistence-unit
    16:04:28,896 INFO  [org.jboss.weld] (MSC service thread 1-4) Processing CDI deployment: siscoex-internet.war
    16:04:28,959 WARN  [org.jboss.weld] (MSC service thread 1-4) Could not load portable extension class org.jboss.weld.extensions.resourceLoader.servlet.ServletResourceExtension
    16:04:28,959 WARN  [org.jboss.weld] (MSC service thread 1-4) Could not load portable extension class org.jboss.weld.extensions.bean.lookup.IdentifiableBeanExtension
    16:04:28,959 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named UsuarioManagerBean in deployment unit deployment "siscoex-internet.war" are as follows:

    java:global/siscoex-internet/UsuarioManagerBean!br.gov.ce.sefaz.siscoex.core.manager.UsuarioManager
    java:app/siscoex-internet/UsuarioManagerBean!br.gov.ce.sefaz.siscoex.core.manager.UsuarioManager
    java:module/UsuarioManagerBean!br.gov.ce.sefaz.siscoex.core.manager.UsuarioManager
    java:global/siscoex-internet/UsuarioManagerBean
    java:app/siscoex-internet/UsuarioManagerBean
    java:module/UsuarioManagerBean

    16:04:28,990 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named NotaFiscalExportacaoIndiretaManagerBean in deployment unit deployment "siscoex-internet.war" are as follows:

    java:global/siscoex-internet/NotaFiscalExportacaoIndiretaManagerBean!br.gov.ce.sefaz.siscoex.core.manager.NotaFiscalExportacaoIndiretaManager
    java:app/siscoex-internet/NotaFiscalExportacaoIndiretaManagerBean!br.gov.ce.sefaz.siscoex.core.manager.NotaFiscalExportacaoIndiretaManager
    java:module/NotaFiscalExportacaoIndiretaManagerBean!br.gov.ce.sefaz.siscoex.core.manager.NotaFiscalExportacaoIndiretaManager
    java:global/siscoex-internet/NotaFiscalExportacaoIndiretaManagerBean
    java:app/siscoex-internet/NotaFiscalExportacaoIndiretaManagerBean
    java:module/NotaFiscalExportacaoIndiretaManagerBean

    16:04:28,990 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named AdicaoDrawBackManagerBean in deployment unit deployment "siscoex-internet.war" are as follows:

    java:global/siscoex-internet/AdicaoDrawBackManagerBean!br.gov.ce.sefaz.siscoex.core.manager.AdicaoDrawBackManager
    java:app/siscoex-internet/AdicaoDrawBackManagerBean!br.gov.ce.sefaz.siscoex.core.manager.AdicaoDrawBackManager
    java:module/AdicaoDrawBackManagerBean!br.gov.ce.sefaz.siscoex.core.manager.AdicaoDrawBackManager
    java:global/siscoex-internet/AdicaoDrawBackManagerBean
    java:app/siscoex-internet/AdicaoDrawBackManagerBean
    java:module/AdicaoDrawBackManagerBean

    16:04:28,990 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named ItemExportacaoIndiretaManagerBean in deployment unit deployment "siscoex-internet.war" are as follows:

    java:global/siscoex-internet/ItemExportacaoIndiretaManagerBean!br.gov.ce.sefaz.siscoex.core.manager.ItemExportacaoIndiretaManager
    java:app/siscoex-internet/ItemExportacaoIndiretaManagerBean!br.gov.ce.sefaz.siscoex.core.manager.ItemExportacaoIndiretaManager
    java:module/ItemExportacaoIndiretaManagerBean!br.gov.ce.sefaz.siscoex.core.manager.ItemExportacaoIndiretaManager
    java:global/siscoex-internet/ItemExportacaoIndiretaManagerBean
    java:app/siscoex-internet/ItemExportacaoIndiretaManagerBean
    java:module/ItemExportacaoIndiretaManagerBean

    16:04:28,990 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named PaisManagerBean in deployment unit deployment "siscoex-internet.war" are as follows:

    java:global/siscoex-internet/PaisManagerBean!br.gov.ce.sefaz.seta.jee.core.manager.PaisManager
    java:app/siscoex-internet/PaisManagerBean!br.gov.ce.sefaz.seta.jee.core.manager.PaisManager
    java:module/PaisManagerBean!br.gov.ce.sefaz.seta.jee.core.manager.PaisManager
    java:global/siscoex-internet/PaisManagerBean
    java:app/siscoex-internet/PaisManagerBean
    java:module/PaisManagerBean

    16:04:28,990 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named UnidadeFederacaoManagerBean in deployment unit deployment "siscoex-internet.war" are as follows:

    java:global/siscoex-internet/UnidadeFederacaoManagerBean!br.gov.ce.sefaz.seta.jee.core.manager.UnidadeFederacaoManager
    java:app/siscoex-internet/UnidadeFederacaoManagerBean!br.gov.ce.sefaz.seta.jee.core.manager.UnidadeFederacaoManager
    java:module/UnidadeFederacaoManagerBean!br.gov.ce.sefaz.seta.jee.core.manager.UnidadeFederacaoManager
    java:global/siscoex-internet/UnidadeFederacaoManagerBean
    java:app/siscoex-internet/UnidadeFederacaoManagerBean
    java:module/UnidadeFederacaoManagerBean

    16:04:28,990 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named AdicaoDiferimentoManagerBean in deployment unit deployment "siscoex-internet.war" are as follows:

    java:global/siscoex-internet/AdicaoDiferimentoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.AdicaoDiferimentoManager
    java:app/siscoex-internet/AdicaoDiferimentoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.AdicaoDiferimentoManager
    java:module/AdicaoDiferimentoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.AdicaoDiferimentoManager
    java:global/siscoex-internet/AdicaoDiferimentoManagerBean
    java:app/siscoex-internet/AdicaoDiferimentoManagerBean
    java:module/AdicaoDiferimentoManagerBean

    16:04:28,990 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named ParametroManagerBean in deployment unit deployment "siscoex-internet.war" are as follows:

    java:global/siscoex-internet/ParametroManagerBean!br.gov.ce.sefaz.siscoex.core.manager.ParametroManager
    java:app/siscoex-internet/ParametroManagerBean!br.gov.ce.sefaz.siscoex.core.manager.ParametroManager
    java:module/ParametroManagerBean!br.gov.ce.sefaz.siscoex.core.manager.ParametroManager
    java:global/siscoex-internet/ParametroManagerBean
    java:app/siscoex-internet/ParametroManagerBean
    java:module/ParametroManagerBean

    16:04:28,990 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named RepresentanteManagerBean in deployment unit deployment "siscoex-internet.war" are as follows:

    java:global/siscoex-internet/RepresentanteManagerBean!br.gov.ce.sefaz.siscoex.core.manager.RepresentanteManager
    java:app/siscoex-internet/RepresentanteManagerBean!br.gov.ce.sefaz.siscoex.core.manager.RepresentanteManager
    java:module/RepresentanteManagerBean!br.gov.ce.sefaz.siscoex.core.manager.RepresentanteManager
    java:global/siscoex-internet/RepresentanteManagerBean
    java:app/siscoex-internet/RepresentanteManagerBean
    java:module/RepresentanteManagerBean

    16:04:28,990 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named EmailService in deployment unit deployment "siscoex-internet.war" are as follows:

    java:global/siscoex-internet/EmailService!br.gov.ce.sefaz.siscoex.core.service.EmailService
    java:app/siscoex-internet/EmailService!br.gov.ce.sefaz.siscoex.core.service.EmailService
    java:module/EmailService!br.gov.ce.sefaz.siscoex.core.service.EmailService
    java:global/siscoex-internet/EmailService
    java:app/siscoex-internet/EmailService
    java:module/EmailService

    16:04:28,990 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named AdicaoPagamentoManagerBean in deployment unit deployment "siscoex-internet.war" are as follows:

    java:global/siscoex-internet/AdicaoPagamentoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.AdicaoPagamentoManager
    java:app/siscoex-internet/AdicaoPagamentoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.AdicaoPagamentoManager
    java:module/AdicaoPagamentoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.AdicaoPagamentoManager
    java:global/siscoex-internet/AdicaoPagamentoManagerBean
    java:app/siscoex-internet/AdicaoPagamentoManagerBean
    java:module/AdicaoPagamentoManagerBean

    16:04:28,990 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named DeclaracaoImportacaoManagerBean in deployment unit deployment "siscoex-internet.war" are as follows:

    java:global/siscoex-internet/DeclaracaoImportacaoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.DeclaracaoImportacaoManager
    java:app/siscoex-internet/DeclaracaoImportacaoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.DeclaracaoImportacaoManager
    java:module/DeclaracaoImportacaoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.DeclaracaoImportacaoManager
    java:global/siscoex-internet/DeclaracaoImportacaoManagerBean
    java:app/siscoex-internet/DeclaracaoImportacaoManagerBean
    java:module/DeclaracaoImportacaoManagerBean

    16:04:28,990 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named ItemExportacaoManagerBean in deployment unit deployment "siscoex-internet.war" are as follows:

    java:global/siscoex-internet/ItemExportacaoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.ItemExportacaoManager
    java:app/siscoex-internet/ItemExportacaoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.ItemExportacaoManager
    java:module/ItemExportacaoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.ItemExportacaoManager
    java:global/siscoex-internet/ItemExportacaoManagerBean
    java:app/siscoex-internet/ItemExportacaoManagerBean
    java:module/ItemExportacaoManagerBean

    16:04:28,990 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named ContribuinteManagerBean in deployment unit deployment "siscoex-internet.war" are as follows:

    java:global/siscoex-internet/ContribuinteManagerBean!br.gov.ce.sefaz.siscoex.core.manager.ContribuinteManager
    java:app/siscoex-internet/ContribuinteManagerBean!br.gov.ce.sefaz.siscoex.core.manager.ContribuinteManager
    java:module/ContribuinteManagerBean!br.gov.ce.sefaz.siscoex.core.manager.ContribuinteManager
    java:global/siscoex-internet/ContribuinteManagerBean
    java:app/siscoex-internet/ContribuinteManagerBean
    java:module/ContribuinteManagerBean

    16:04:28,990 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named ReciboManagerBean in deployment unit deployment "siscoex-internet.war" are as follows:

    java:global/siscoex-internet/ReciboManagerBean!br.gov.ce.sefaz.siscoex.core.manager.ReciboManager
    java:app/siscoex-internet/ReciboManagerBean!br.gov.ce.sefaz.siscoex.core.manager.ReciboManager
    java:module/ReciboManagerBean!br.gov.ce.sefaz.siscoex.core.manager.ReciboManager
    java:global/siscoex-internet/ReciboManagerBean
    java:app/siscoex-internet/ReciboManagerBean
    java:module/ReciboManagerBean

    16:04:28,990 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named NotaFiscalEventoManagerBean in deployment unit deployment "siscoex-internet.war" are as follows:

    java:global/siscoex-internet/NotaFiscalEventoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.NotaFiscalEventoManager
    java:app/siscoex-internet/NotaFiscalEventoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.NotaFiscalEventoManager
    java:module/NotaFiscalEventoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.NotaFiscalEventoManager
    java:global/siscoex-internet/NotaFiscalEventoManagerBean
    java:app/siscoex-internet/NotaFiscalEventoManagerBean
    java:module/NotaFiscalEventoManagerBean

    16:04:28,990 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named PendenciaManagerBean in deployment unit deployment "siscoex-internet.war" are as follows:

    java:global/siscoex-internet/PendenciaManagerBean!br.gov.ce.sefaz.siscoex.core.manager.PendenciaManager
    java:app/siscoex-internet/PendenciaManagerBean!br.gov.ce.sefaz.siscoex.core.manager.PendenciaManager
    java:module/PendenciaManagerBean!br.gov.ce.sefaz.siscoex.core.manager.PendenciaManager
    java:global/siscoex-internet/PendenciaManagerBean
    java:app/siscoex-internet/PendenciaManagerBean
    java:module/PendenciaManagerBean

    16:04:28,990 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named HistoricoManagerBean in deployment unit deployment "siscoex-internet.war" are as follows:

    java:global/siscoex-internet/HistoricoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.HistoricoManager
    java:app/siscoex-internet/HistoricoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.HistoricoManager
    java:module/HistoricoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.HistoricoManager
    java:global/siscoex-internet/HistoricoManagerBean
    java:app/siscoex-internet/HistoricoManagerBean
    java:module/HistoricoManagerBean

    16:04:28,990 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named DeclaracaoImportacaoFacadeBean in deployment unit deployment "siscoex-internet.war" are as follows:

    java:global/siscoex-internet/DeclaracaoImportacaoFacadeBean!br.gov.ce.sefaz.siscoex.core.facade.DeclaracaoImportacaoFacade
    java:app/siscoex-internet/DeclaracaoImportacaoFacadeBean!br.gov.ce.sefaz.siscoex.core.facade.DeclaracaoImportacaoFacade
    java:module/DeclaracaoImportacaoFacadeBean!br.gov.ce.sefaz.siscoex.core.facade.DeclaracaoImportacaoFacade
    java:global/siscoex-internet/DeclaracaoImportacaoFacadeBean
    java:app/siscoex-internet/DeclaracaoImportacaoFacadeBean
    java:module/DeclaracaoImportacaoFacadeBean

    16:04:28,990 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named AdicaoManagerBean in deployment unit deployment "siscoex-internet.war" are as follows:

    java:global/siscoex-internet/AdicaoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.AdicaoManager
    java:app/siscoex-internet/AdicaoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.AdicaoManager
    java:module/AdicaoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.AdicaoManager
    java:global/siscoex-internet/AdicaoManagerBean
    java:app/siscoex-internet/AdicaoManagerBean
    java:module/AdicaoManagerBean

    16:04:28,990 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named PessoaManagerBean in deployment unit deployment "siscoex-internet.war" are as follows:

    java:global/siscoex-internet/PessoaManagerBean!br.gov.ce.sefaz.siscoex.core.manager.PessoaManager
    java:app/siscoex-internet/PessoaManagerBean!br.gov.ce.sefaz.siscoex.core.manager.PessoaManager
    java:module/PessoaManagerBean!br.gov.ce.sefaz.siscoex.core.manager.PessoaManager
    java:global/siscoex-internet/PessoaManagerBean
    java:app/siscoex-internet/PessoaManagerBean
    java:module/PessoaManagerBean

    16:04:28,990 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named ItemAdicaoManagerBean in deployment unit deployment "siscoex-internet.war" are as follows:

    java:global/siscoex-internet/ItemAdicaoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.ItemAdicaoManager
    java:app/siscoex-internet/ItemAdicaoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.ItemAdicaoManager
    java:module/ItemAdicaoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.ItemAdicaoManager
    java:global/siscoex-internet/ItemAdicaoManagerBean
    java:app/siscoex-internet/ItemAdicaoManagerBean
    java:module/ItemAdicaoManagerBean

    16:04:28,990 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named SolicitacaoManagerBean in deployment unit deployment "siscoex-internet.war" are as follows:

    java:global/siscoex-internet/SolicitacaoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.SolicitacaoManager
    java:app/siscoex-internet/SolicitacaoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.SolicitacaoManager
    java:module/SolicitacaoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.SolicitacaoManager
    java:global/siscoex-internet/SolicitacaoManagerBean
    java:app/siscoex-internet/SolicitacaoManagerBean
    java:module/SolicitacaoManagerBean

    16:04:28,990 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named NotaFiscalDevolucaoManagerBean in deployment unit deployment "siscoex-internet.war" are as follows:

    java:global/siscoex-internet/NotaFiscalDevolucaoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.NotaFiscalDevolucaoManager
    java:app/siscoex-internet/NotaFiscalDevolucaoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.NotaFiscalDevolucaoManager
    java:module/NotaFiscalDevolucaoManagerBean!br.gov.ce.sefaz.siscoex.core.manager.NotaFiscalDevolucaoManager
    java:global/siscoex-internet/NotaFiscalDevolucaoManagerBean
    java:app/siscoex-internet/NotaFiscalDevolucaoManagerBean
    java:module/NotaFiscalDevolucaoManagerBean

    16:04:28,990 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named FileNFExportacaoIndiretaManagerBean in deployment unit deployment "siscoex-internet.war" are as follows:

    java:global/siscoex-internet/FileNFExportacaoIndiretaManagerBean!br.gov.ce.sefaz.siscoex.core.manager.FileNFExportacaoIndiretaManager
    java:app/siscoex-internet/FileNFExportacaoIndiretaManagerBean!br.gov.ce.sefaz.siscoex.core.manager.FileNFExportacaoIndiretaManager
    java:module/FileNFExportacaoIndiretaManagerBean!br.gov.ce.sefaz.siscoex.core.manager.FileNFExportacaoIndiretaManager
    java:global/siscoex-internet/FileNFExportacaoIndiretaManagerBean
    java:app/siscoex-internet/FileNFExportacaoIndiretaManagerBean
    java:module/FileNFExportacaoIndiretaManagerBean

    16:04:30,412 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-1) Deploying non-JDBC-compliant driver class org.postgresql.Driver (version 8.4)
    16:04:30,412 INFO  [org.jboss.weld] (MSC service thread 1-1) Starting Services for CDI deployment: siscoex-internet.war
    16:04:30,459 INFO  [org.jboss.weld.Version] (MSC service thread 1-1) WELD-000900 1.1.2 (AS7)
    16:04:30,584 INFO  [org.jboss.weld] (MSC service thread 1-3) Starting weld service
    16:04:34,866 ERROR [org.jboss.as] (MSC service thread 1-4) JBoss AS 7.0.0.Final "Lightning" started (with errors) in 33471ms - Started 420 of 528 services (51 services failed or missing dependencies, 57 services are passive or on-demand)
    16:04:35,084 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployment of "siscoex-internet.war" was rolled back with failure message {"Services with missing/unavailable dependencies" => ["jboss.deployment.unit.\"siscoex-internet.war\".component.UnidadeFederacaoManagerBean.START missing [ jboss.naming.context.java.module.siscoex-internet.siscoex-internet.\"env/br.gov.ce.sefaz.seta.jee.core.manager.bean.UnidadeFederacaoManagerBean/ems\" ]","jboss.deployment.unit.\"siscoex-internet.war\".jndiDependencyService missing [ jboss.naming.context.java.module.siscoex-internet.siscoex-internet.\"env/br.gov.ce.sefaz.seta.jee.core.manager.bean.UnidadeFederacaoManagerBean/ems\", jboss.naming.context.java.module.siscoex-internet.siscoex-internet.\"env/br.gov.ce.sefaz.seta.jee.core.manager.bean.PaisManagerBean/ems\" ]","jboss.deployment.unit.\"siscoex-internet.war\".component.PaisManagerBean.START missing [ jboss.naming.context.java.module.siscoex-internet.siscoex-internet.\"env/br.gov.ce.sefaz.seta.jee.core.manager.bean.PaisManagerBean/ems\" ]"]}
    16:04:35,131 INFO  [org.jboss.weld] (MSC service thread 1-4) Stopping weld service
    16:04:35,381 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) Stopped deployment siscoex-internet.war in 298ms
    16:04:35,381 ERROR [org.jboss.as.deployment] (DeploymentScanner-threads - 1) {"Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"Services with missing/unavailable dependencies" => ["jboss.deployment.unit.\"siscoex-internet.war\".component.UnidadeFederacaoManagerBean.START missing [ jboss.naming.context.java.module.siscoex-internet.siscoex-internet.\"env/br.gov.ce.sefaz.seta.jee.core.manager.bean.UnidadeFederacaoManagerBean/ems\" ]","jboss.deployment.unit.\"siscoex-internet.war\".jndiDependencyService missing [ jboss.naming.context.java.module.siscoex-internet.siscoex-internet.\"env/br.gov.ce.sefaz.seta.jee.core.manager.bean.UnidadeFederacaoManagerBean/ems\", jboss.naming.context.java.module.siscoex-internet.siscoex-internet.\"env/br.gov.ce.sefaz.seta.jee.core.manager.bean.PaisManagerBean/ems\" ]","jboss.deployment.unit.\"siscoex-internet.war\".component.PaisManagerBean.START missing [ jboss.naming.context.java.module.siscoex-internet.siscoex-internet.\"env/br.gov.ce.sefaz.seta.jee.core.manager.bean.PaisManagerBean/ems\" ]"]}}}

  • 5. Re: Services with missing/unavailable dependencies EntityManager
    Evie White Newbie

    Scott & Raphael,

     

    I know what is happening in my situation. In short, I am receiving a "org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags" error. Based on some research and then verification, I have found that this is a Hibernate issue that results from using a FetchType.EAGER on a @OneToMany entity attribute where the attribute is a List collection. To fix the issue, there are two things that can be done: 1) do not use FetchType.EAGER (use the default of LAZY) or 2) use a Set as the collection type for the @OneToMany instead of a List.

     

    I will provide sample code below that will demonstrate the problem.

     

    1. "TestDomain" - An Entity object that contains two collections. Both are @OneToMany that use an EAGER fetch strategy and are contained in List collections. (This is the problem: can't use EAGER or can't use List; use Set, for example.)

     

    package foo.domain;

    import java.util.List;

    import javax.persistence.CascadeType;

    import javax.persistence.Column;

    import javax.persistence.Entity;

    import javax.persistence.FetchType;

    import javax.persistence.GeneratedValue;

    import javax.persistence.GenerationType;

    import javax.persistence.Id;

    import javax.persistence.OneToMany;

    import javax.persistence.Table;

     

    @Entity

    @Table(name="test")

    public class TestDomain {

     

       @Id

       @GeneratedValue(strategy=GenerationType.IDENTITY)

       @Column(name="id")

       private Long id;

     

       @Column(name="name", length=255, nullable=false)

       private String name;

     

       @OneToMany(cascade={CascadeType.REMOVE}, fetch=FetchType.EAGER, mappedBy="test")

       private List<TestCommentDomain> comments;

     

       @OneToMany(cascade={CascadeType.REMOVE}, fetch=FetchType.EAGER, mappedBy="test")

       private List<TestPersonDomain> persons;

     

       public Long getId() {

          return id;

       }

       public void ListId(Long id) {

          this.id = id;

       }

       public String getName() {

          return name;

       }

       public void ListName(String name) {

          this.name = name;

       }

       public List<TestCommentDomain> getComments() {

          return comments;

       }

       public void ListComments(List<TestCommentDomain> comments) {

          this.comments = comments;

       }

       public List<TestPersonDomain> getPersons() {

          return persons;

       }

       public void ListPersons(List<TestPersonDomain> persons) {

          this.persons = persons;

       }

    }

     

     

    2. "TestCommentDomain" - An Entity object that is referenced by "TestDomain"

     

    package foo.domain;

    import javax.persistence.Column;

    import javax.persistence.Entity;

    import javax.persistence.GeneratedValue;

    import javax.persistence.GenerationType;

    import javax.persistence.Id;

    import javax.persistence.JoinColumn;

    import javax.persistence.ManyToOne;

    import javax.persistence.Table;

     

    @Entity

    @Table(name="test_comment")

    public class TestCommentDomain {

     

       @Id

       @GeneratedValue(strategy=GenerationType.IDENTITY)

       @Column(name="id")

       private Long id;

     

       @ManyToOne(optional=false)

       @JoinColumn(name="test_id", nullable=false)

       private TestDomain test;

     

       @Column(name="comment", nullable=false)

       private String comment;

     

       public Long getId() {

          return id;

       }

       public void setId(Long id) {

          this.id = id;

       }

       public TestDomain getTest() {

          return test;

       }

       public void setTest(TestDomain test) {

          this.test = test;

       }

       public String getComment() {

          return comment;

       }

       public void setComment(String comment) {

          this.comment = comment;

       }

    }

     

     

    3. "TestPersonDomain" - A second Entity that is referenced by "TestDomain"

     

    package foo.domain;

    import javax.persistence.Column;

    import javax.persistence.Entity;

    import javax.persistence.GeneratedValue;

    import javax.persistence.GenerationType;

    import javax.persistence.Id;

    import javax.persistence.JoinColumn;

    import javax.persistence.ManyToOne;

    import javax.persistence.Table;

     

    @Entity

    @Table(name="test_person")

    public class TestPersonDomain {

     

       @Id

       @GeneratedValue(strategy=GenerationType.IDENTITY)

       @Column(name="id")

       private Long id;

     

       @ManyToOne(optional=false)

       @JoinColumn(name="test_id", nullable=false)

       private TestDomain test;

     

       @Column(name="name", nullable=false)

       private String name;

     

       public Long getId() {

          return id;

       }

       public void setId(Long id) {

          this.id = id;

       }

       public TestDomain getTest() {

          return test;

       }

       public void setTest(TestDomain test) {

          this.test = test;

       }

       public String getName() {

          return name;

       }

       public void setName(String name) {

          this.name = name;

       }

    }

     

    4. "TestBean" - Remote interface for EJB stateless session bean.

     

    package foo.bean;

    import javax.ejb.Remote;

    import foo.domain.TestDomain;

     

    @Remote

    public interface TestBean {

       public TestDomain find(Long id);

    }

     

    5. "TestBeanImpl" - EJB stateless session bean implementation. This is where the PersistenceContext is used.

     

    package foo.bean.impl;

    import javax.ejb.Stateless;

    import javax.ejb.TransactionAttribute;

    import javax.ejb.TransactionAttributeType;

    import javax.persistence.EntityManager;

    import javax.persistence.PersistenceContext;

    import foo.bean.TestBean;

    import foo.domain.TestDomain;

     

    @Stateless

    @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)

    public class TestBeanImpl implements TestBean {

     

       @PersistenceContext(unitName="bobo")

       private EntityManager manager;

     

       public TestDomain find(Long id) {

          return manager.find(TestDomain.class, id);

       }

    }

     

    6. persistence.xml

     

    <?xml version="1.0" encoding="UTF-8"?>

    <persistence

        xmlns="http://java.sun.com/xml/ns/persistence"

        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

        xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"

        version="2.0">

        <persistence-unit name="bobo">

            <jta-data-source>java:jboss/datasources/testDS</jta-data-source>

            <properties>

                <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />

                <property name="show_sql" value="false" />

                <property name="format_sql" value="true" />

                <property name="use_sql_comments" value="false" />

            </properties>

        </persistence-unit>

    </persistence>

     

    7. portion of standalone.xml

     


    <subsystem xmlns="urn:jboss:domain:datasources:1.0">

    <datasources>

    <datasource jndi-name="java:jboss/datasources/testDS" pool-name="testDS" enabled="true" jta="true" use-java-context="true" use-ccm="true">

    <connection-url>

    jdbc:mysql://localhost:3306/bobo

    </connection-url>

    <driver>

    mysql-connector-java-5.1.7-bin.jar

    </driver>

    <pool>

    <min-pool-size>

    1

    </min-pool-size>

    <max-pool-size>

    5

    </max-pool-size>

    <prefill>

    true

    </prefill>

    <use-strict-min>

    false

    </use-strict-min>

    <flush-strategy>

    FailingConnectionOnly

    </flush-strategy>

    </pool>

    <security>

    <user-name>

    test

    </user-name>

    <password>

    test

    </password>

    </security>

    </datasource>

    <drivers>

    <driver name="h2" module="com.h2database.h2">

    <xa-datasource-class>

    org.h2.jdbcx.JdbcDataSource

    </xa-datasource-class>

    </driver>

    </drivers>

    </datasources>

    </subsystem>

     

     

    8. Packaged into a JAR:

    foo\bean\TestBean.class

    foo\bean\impl\TestBeanImpl.class

    foo\domain\TestCommentDomain.class

    foo\domain\TestDomain.class

    foo\domain\TestPersonDomain.class

    META-INF\MANIFEST.MF

    META-INF\persistence.xml

    log4j.properties

     

     

    9. A portion of the stack trace:

     

    11:53:52,662 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC00001: Failed to start service jboss.persistenceunit."test.jar#bobo": org.jboss.msc.service.StartException in service jboss.persistenceunit."test.jar#bobo": Failed to start service

        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1786)

        at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)

        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_14]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_14]

        at java.lang.Thread.run(Thread.java:619) [:1.6.0_14]

    Caused by: javax.persistence.PersistenceException: [PersistenceUnit: bobo] Unable to build EntityManagerFactory

        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:903)

        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:879)

        at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)

        at org.jboss.as.jpa.service.PersistenceUnitService.createContainerEntityManagerFactory(PersistenceUnitService.java:170)

        at org.jboss.as.jpa.service.PersistenceUnitService.start(PersistenceUnitService.java:80)

        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)

        ... 4 more

    Caused by: org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags

        at org.hibernate.loader.BasicLoader.postInstantiate(BasicLoader.java:92)

        at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:118)

        at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:70)

        at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:53)

        at org.hibernate.loader.entity.BatchingEntityLoader.createBatchingEntityLoader(BatchingEntityLoader.java:131)

        at org.hibernate.persister.entity.AbstractEntityPersister.createEntityLoader(AbstractEntityPersister.java:1976)

        at org.hibernate.persister.entity.AbstractEntityPersister.createEntityLoader(AbstractEntityPersister.java:1999)

        at org.hibernate.persister.entity.AbstractEntityPersister.createLoaders(AbstractEntityPersister.java:3248)

        at org.hibernate.persister.entity.AbstractEntityPersister.postInstantiate(AbstractEntityPersister.java:3234)

        at org.hibernate.persister.entity.SingleTableEntityPersister.postInstantiate(SingleTableEntityPersister.java:770)

        at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:419)

        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1720)

        at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:77)

        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:894)

        ... 9 more

     

    11:53:52,912 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) Stopped deployment test.jar in 6ms

    11:53:52,912 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) Starting deployment of "test.jar"

    11:53:52,912 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 1) Replacement of deployment "test.jar" by deployment "test.jar" was rolled back with failure message {"Failed services" => {"jboss.persistenceunit.\"test.jar#bobo\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"test.jar#bobo\": Failed to start service"},"Services with missing/unavailable dependencies" => ["jboss.deployment.unit.\"test.jar\".jndiDependencyService missing [ jboss.naming.context.java.comp.test.test.TestBeanImpl.\"env/foo.bean.impl.TestBeanImpl/manager\" ]","jboss.deployment.unit.\"test.jar\".component.TestBeanImpl.START missing [ jboss.naming.context.java.comp.test.test.TestBeanImpl.\"env/foo.bean.impl.TestBeanImpl/manager\" ]"]}

    11:53:52,912 INFO  [org.jboss.jpa] (MSC service thread 1-3) read persistence.xml for bobo

    11:53:52,928 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-7) JNDI bindings for session bean named TestBeanImpl in deployment unit deployment "test.jar" are as follows:

     

        java:global/test/TestBeanImpl!foo.bean.TestBean

        java:app/test/TestBeanImpl!foo.bean.TestBean

        java:module/TestBeanImpl!foo.bean.TestBean

        java:global/test/TestBeanImpl

        java:app/test/TestBeanImpl

        java:module/TestBeanImpl

  • 6. Re: Services with missing/unavailable dependencies EntityManager
    Evie White Newbie

    Raphael,

     

    I don't see a MultipleBagFetchException in the abbreviated stack trace you provided, but, do you have that exception in your server.log stack trace when you deploy your JARs and WARs?

     

    If so, what do your entity objects  (@Entity) look like? Do you have a situation where you are doing an EAGER fetch using a List collection?

     

    I, too, used Glassfish and the toplink ORM did not have a problem with this. But, it looks like the Hibernate version with JBoss AS 7 does not accept this.

  • 7. Re: Services with missing/unavailable dependencies EntityManager
    Steve Ebersole Apprentice

    Hibernate adheres *strictly* to the java contracts for collections.  List is defined as a collection with a defined order.  The problem with mapping a list in the manner done here is that Hibernate cannot rebuild that order when reading the rows from the database.  So it makes a specific distinction here between a list and what it calls a bag (think java.util.Collection).  In order to have Hibernbate treat this as a list you must tell it about the column in the database that is used to store the index/position information.  Prior to version 2,  JPA provided no means to accomplish that.  So prior to JPA 2 you had to use the Hibernater specific annotation org.hibernate.annotations.IndexColumn.  JPA 2 added the annotation javax.persistence.OrderColumn which serves the same purpose. 

     

    Or as pointed out, if you want to continue to map these collections as bags you will have to make one or the other (or both!) non-eager.  Or you can map them as Sets which have a different semantic altogether.