7 Replies Latest reply on Jun 22, 2012 2:18 AM by apatispelikan

    Missing dependencies due to variables in persistence.xml

    apatispelikan

      Hello,

       

      I use JBoss AS 7.1.2 and as mentioned in https://issues.jboss.org/browse/AS7-3195 the usage of variables in persistence.xml should work.

       

      I tested this behaviour using this persistence.xml:

       

      <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="customersDomain" transaction-type="JTA">

                          <provider>org.hibernate.ejb.HibernatePersistence</provider>

        <jta-data-source>java:/datasources/DsForAllCustomers</jta-data-source>

        <shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode>

        <properties>

       

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

        <property name="hibernate.show_sql" value="${showsql}"></property>

       

        <property name="hibernate.cache.use_second_level_cache" value="true"/>

        <property name="hibernate.cache.use_query_cache" value="true" />

        <property name="hibernate.cache.use_minimal_puts" value="true"/>

       

        </properties>

        </persistence-unit>

      </persistence>

       

      and a this entry in host.xml (I use domain mode):

       

          <servers>

              <server name="entw01" group="entw" auto-start="true">

                  <system-properties>

                       <property name="ipadserverds.jndipath" value="java:/datasources/DsForAllCustomers" boot-time="false"/>

                      <property name="showsql" value="true" boot-time="false"/>

                  </system-properties>

                  <socket-bindings socket-binding-group="full-ha-sockets"/>

              </server>

          </servers>

       

      and it works fine. Hibernate shows the SQLs. Setting the variable to "false" also leads to the expected behaviour that no SQLs are shown. That means variable-substitution in persistence.xml works fine.

       

      But when I use the variable within the tag "jta-data-source" I get this error adding the deployment to the server/servergroup:

       

      12:01:55,895 INFO  [org.jboss.as.server] (host-controller-connection-threads - 2) JBAS015870: Deploy of deployment "pdfWhitelabelServer.ear" was rolled back with failure message {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.war\".component.\"javax.faces.webapp.FacetTag\".START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.war\".jboss.security.jacc Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.jar\".component.PushNotificationMDB.START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.jar\".component.ServicesImpl.START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.jar\".component.IssueDataVNKiosk_MDB.START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.war\".component.\"at.apa.webadmin.actions.LoginServlet\".START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.jar\".jndiDependencyService Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.jar\".component.IssueDataAllgaeuer_MDB.START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.persistenceunit.\"pdfWhitelabelServer.ear/pdfWhitelabelServer.jar#ipadDomain\" Missing[jboss.naming.context.java.\"${ipadserverds.jndipath}\"]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.jar\".component.MonitoringMailCron.START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.jar\".component.PushNotificationCron.START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.web.deployment.default-host./ Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.jar\".component.StatisticsCron.START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.jar\".jboss.security.jacc Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.war\".component.\"org.apache.jasper.servlet.JspServlet\".START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.jar\".component.MasterChecker.START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.war\".component.\"javax.servlet.jsp.jstl.tlv.ScriptFreeTLV\".START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.war\".component.Services2Impl.START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.jar\".component.IssueDataVN_MDB.START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.jar\".component.IssueDataWZ_MDB.START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.jar\".component.MasterCheckerServiceImpl.START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.war\".component.\"org.apache.catalina.servlets.DefaultServlet\".START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.naming.context.java.comp.pdfWhitelabelServer.\"pdfWhitelabelServer.jar\".ServicesImpl.env.\"at.apa.pdfwlserver.ServicesBase\".manager Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.web.deployment.default-host./pdfWhitelabelServer Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.war\".component.\"com.sun.faces.config.ConfigureListener\".START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.jar\".component.MaintenanceServicesImpl.START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.war\".component.\"at.apa.pdfwlserver.SecurityServlet\".START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.war\".component.\"at.apa.webadmin.actions.LogoutServlet\".START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.jar\".component.IssueBuilderCron.START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.naming.context.java.comp.pdfWhitelabelServer.\"pdfWhitelabelServer.jar\".MaintenanceServicesImpl.env.\"at.apa.pdfwlserver.webadmin.maintenance.MaintenanceServicesImpl\".manager Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.jar\".component.IssueDataAugsburger_MDB.START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.jar\".component.IssueDataWirtschaftsblatt_MDB.START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.jar\".component.PushServicesImpl.START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.war\".jndiDependencyService Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.war\".component.\"at.apa.pdfwlserver.EjbInjectedFilter\".START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.naming.context.java.module.pdfWhitelabelServer.\"pdfWhitelabelServer.war\".env.\"at.apa.pdfwlserver.ServicesBase\".manager Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.jar\".component.WebadminServicesImpl.START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.jar\".component.IssueDataApaValue_MDB.START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.jar\".component.IssueDataTT_MDB.START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.jar\".component.IssueDataKurierMDB.START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.naming.context.java.comp.pdfWhitelabelServer.\"pdfWhitelabelServer.jar\".WebadminServicesImpl.env.\"at.apa.pdfwlserver.webadmin.WebadminServicesImpl\".manager Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.naming.context.java.comp.pdfWhitelabelServer.\"pdfWhitelabelServer.jar\".PushServicesImpl.env.\"at.apa.pdfwlserver.pushNotification.PushServicesImpl\".manager Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.war\".component.\"javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV\".START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.jar\".component.MaintenanceWebserviceImpl.START Missing[JBAS014861: <one or more transitive dependencies>]",

      "jboss.deployment.subunit.\"pdfWhitelabelServer.ear\".\"pdfWhitelabelServer.war\".component.\"org.apache.struts2.dispatcher.FilterDispatcher\".START Missing[JBAS014861: <one or more transitive dependencies>]"]}

       

      I marked the relevant section in red (it's the only line not containing <one or more transitive dependencies>). Of cource I already checked any missspelling and the DS is available (tested using the JNDI-path as plain-text instead of the variable). It seems that serveral deployment-checks are done before any variable-substitation has been done. Is this a bug or is anything wrong with my deployment? I really need this feature - is there a workaround possible?

       

      Thanks,

      Stephan

       

      PS: My indent for this usage is to deploy an ear in different servers/servergroups and each servergroup is for a different customer and should connect to a different database. By-the-way: different databases are neccessary to avoid resource-dependences between the customers.

        • 1. Re: Missing dependencies due to variables in persistence.xml
          ctomc

          Hi,

           

          does it work if you run server passing variable manualy?

           

          for example running

           

          standlone.(sh|bat) -Dipadserverds.jndipath=java:/datasources/DsForAllCustomers

           

           

          --

          tomaz

          • 2. Re: Missing dependencies due to variables in persistence.xml
            apatispelikan

            Hello,

             

            I don't know because I use domain-mode. Do you asume an domain-mode-specific error?

             

            Is it possible to do so for domain.sh? I would prefer not to configure standalone-mode - but if there is no other way I will do it. Currently I use only one server in domain-mode - other servers will follow after my initial tests (this is a migration from JBoss 5.1).

             

            Stephan

            • 3. Re: Missing dependencies due to variables in persistence.xml
              apatispelikan

              Hello Tomaz,

               

              in meantime I prepared a standalone server but your suggested solution doesn't work either.

               

              Do you know a workaround?

               

              Is this a bug - should I open an issue for that?

               

              Stephan

              • 4. Re: Missing dependencies due to variables in persistence.xml
                ctomc

                Hi,

                 

                first sorry for late answer...

                 

                Just btw, do you really need domain mode? you know that running domain mode has nothing to do with clustering, but just the way servers are managed...

                Said that, yes there is a difference between how operations are applyed on standalone or domain mode, so in some cases there is problem only in domain mode but not standalone...

                 

                Given that you have tested and confirmend that it also does not work in standalone mode, please create issue so we can investigate furher.

                 

                --

                tomaz

                • 5. Re: Missing dependencies due to variables in persistence.xml
                  apatispelikan

                  Hello Tomaz,

                   

                  >Just btw, do you really need domain mode? you know that running domain mode has nothing to do with clustering, but just the way servers are managed...

                   

                  Yes, at the moment we have to manage 16 instances for a single application - end soon we getting more. Everything is fine - domain-mode fits our needs perfectly.

                   

                  > Given that you have tested and confirmend that it also does not work in standalone mode, please create issue so we can investigate furher.

                   

                  Yes, I will.

                   

                  Thanks,

                  Stephan

                  • 6. Re: Missing dependencies due to variables in persistence.xml
                    smarlow

                    The solution is to change configuration file as7/standalone/configuration/standalone.xml (or whichever your using).

                     

                    From:
                       <spec-descriptor-property-replacement>false</spec-descriptor-property-replacement>

                     

                    To:

                       <spec-descriptor-property-replacement>true</spec-descriptor-property-replacement>

                     

                    And then start the AS:
                    ./standalone.sh "-Dtest.ds=java:jboss/datasources/ExampleDS"

                     

                    This is also mentioned in AS7-5015.

                     

                    Scott

                    • 7. Re: Missing dependencies due to variables in persistence.xml
                      apatispelikan

                      it also works in domain-environment

                       

                      Thanks,

                      Stephan