Missing dependencies due to variables in persistence.xml
apatispelikan Jun 12, 2012 6:54 AMHello,
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.