13 Replies Latest reply on Sep 7, 2011 11:28 AM by jedierikb

    Error to start application (persistence.xml problem)

    spiritfox26

      I have this error when the server try to deploy mi app.

       

       [org.jboss.as.server.deployment] (MSC service thread 1-1) Starting deployment of "ITIL.war"
      15:58:34,883 INFO  [org.jboss.jpa] (MSC service thread 1-6) read persistence.xml for itil
      15:58:35,971 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployment of "ITIL.war" was rolled back with failure message {"Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"ITIL.war#itil\" missing [ jboss.naming.context.java.java:ds/ItilDS ]"]}
      15:58:35,972 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) Service status report
         New missing/unsatisfied dependencies:
            service jboss.naming.context.java.java:ds/ItilDS (missing)
      
      
      15:58:35,973 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.persistenceunit.\"ITIL.war#itil\" missing [ jboss.naming.context.java.java:ds/ItilDS ]"]}}}
      15:58:36,032 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) Stopped deployment ITIL.war in 53ms
      15:58:36,033 INFO  [org.jboss.as.controller] (MSC service thread 1-3) Service status report
         Newly corrected services:
            service jboss.naming.context.java.java:ds/ItilDS (no longer required)
      

       

      persistence.xml (in my app )

       

      <?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" version="1.0"
                xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
                <persistence-unit name="itil" transaction-type="RESOURCE_LOCAL">
                          <provider>org.hibernate.ejb.HibernatePersistence</provider>
                          <non-jta-data-source>java:ds/ItilDS</non-jta-data-source>
                          <properties>
                                    <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
                                    <property name="hibernate.show_sql" value="false"/> 
                          </properties>
                </persistence-unit>
      </persistence>
      

       

       

      itil-ds.xml (in C:\jboss-as-web-7.0.0.Final\standalone\deployments\itil-ds.xml)

       

      <?xml version="1.0" encoding="UTF-8"?>
      
      <!-- Base de datos del callcenter factory config -->
      <datasources>
         <local-tx-datasource>
      
      
            <!-- The jndi name of the DataSource, it is prefixed with java:/ -->
            <!-- Datasources are not available outside the virtual machine -->
            <jndi-name>ds/ItilDS</jndi-name>
      
            <connection-url>jdbc:mysql://localhost/itil</connection-url>
      
      
            <!-- The driver class -->
            <driver-class>com.mysql.jdbc.Driver</driver-class>
      
      
            <!-- The login and password -->
            <user-name>user</user-name>
            <password>password</password>
      
      
            <!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use -->
            <min-pool-size>5</min-pool-size>
      
      
            <!-- The maximum connections in a pool/sub-pool -->
            <max-pool-size>20</max-pool-size>
      
      
            <!-- The time before an unused connection is destroyed -->
            <!-- NOTE: This is the check period. It will be destroyed somewhere between 1x and 2x this timeout after last use -->
            <!-- TEMPORARY FIX! - Disable idle connection removal, HSQLDB has a problem with not reaping threads on closed connections -->
            <idle-timeout-minutes>10</idle-timeout-minutes>
      
      
            <!-- sql to call when connection is created
              <new-connection-sql>some arbitrary sql</new-connection-sql>
            -->
      
      
            <!-- sql to call on an existing pooled connection when it is obtained from pool 
               <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
            -->
      
      
            <!-- example of how to specify a class that determines a connection is valid before it is handed out from the pool
               <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyValidConnectionChecker</valid-connection-checker-class-name>
            -->
      
      
            <!-- Whether to check all statements are closed when the connection is returned to the pool,
                 this is a debugging feature that should be turned off in production -->
            <track-statements/>
      
      
            <!-- Use the getConnection(user, pw) for logins
              <application-managed-security/>
            -->
         </local-tx-datasource>
      </datasources>
      

       

      Anyone can help me?

       

      Thanks in advanced!

       

      Regards

        • 1. Re: Error to start application (persistence.xml problem)
          jesper.pedersen

          You took 0 mins to read the documentation - start here: https://docs.jboss.org/author/display/AS7/Documentation

          • 2. Re: Error to start application (persistence.xml problem)
            smarlow

            One of the issues is with the different datasource name syntax ("java:ds/ItilDS" in persistence.xml is not valid).  Try making them the same, something like "java:jboss/ds/ItilDS" would be fine.

            • 3. Re: Error to start application (persistence.xml problem)
              jesper.pedersen

              The configuration is 100% wrong, but correct - use either java:/ds/ItilDS or java:jboss/ds/ItilDS

              • 4. Re: Error to start application (persistence.xml problem)
                spiritfox26

                This change in JBoss AS 7? because in JBoss AS 4.2.3 works fine, i will try the new recommendations.

                 

                Regards

                • 5. Re: Error to start application (persistence.xml problem)
                  spiritfox26

                  Why the configuration is 100% wrong? I read the documentation and trying add a datasource from http://127.0.0.1:9990/console/ but now i have problem with mysql drivers sorry but i trying to migrate to JBoss AS 7 for a week but i can't do it.

                   

                  10:26:56,150 INFO  [org.jboss.as.controller] (Controller Boot Thread) Service status report

                     New missing/unsatisfied dependencies:

                        service jboss.jdbc-driver.com_mysql_jdbc_Driver (missing)

                  • 6. Re: Error to start application (persistence.xml problem)
                    gonne

                    Have you made and deployed a module for the mysql driver?

                     

                    Regards,

                    Gonne

                    • 7. Re: Error to start application (persistence.xml problem)
                      spiritfox26

                      Yes i followed this steps http://community.jboss.org/wiki/DataSourceConfigurationInAS7 but i continue obtaining this error. I thinking seriously to migrate to JBoss AS 6, because i can't lost time with the configuration.

                       

                      Thanks for your help.

                       

                      Regards

                      • 8. Re: Error to start application (persistence.xml problem)
                        gonne

                        It would be helpful if you provide your standalone.xml and the module.xml of your mysql module. What is the path of your mysql module?

                         

                        Regards,

                        Gonne

                        • 9. Re: Error to start application (persistence.xml problem)
                          spiritfox26
                          <?xml version="1.0" encoding="UTF-8"?>
                          <module xmlns="urn:jboss:module:1.0" name="com.mysql">
                            <resources>
                              <resource-root path="mysql-connector-java-5.1.13-bin.jar"/>
                            </resources>
                          
                             <dependencies>
                              <module name="javax.api"/>
                            </dependencies>
                          </module>
                          

                           

                           

                          Standalone.xml

                           

                          <?xml version='1.0' encoding='UTF-8'?>
                          <server name="NB-ASIVOPLAS" xmlns="urn:jboss:domain:1.0">
                              <extensions>
                                  <extension module="org.jboss.as.clustering.infinispan"/>
                                  <extension module="org.jboss.as.connector"/>
                                  <extension module="org.jboss.as.deployment-scanner"/>
                                  <extension module="org.jboss.as.ee"/>
                                  <extension module="org.jboss.as.ejb3"/>
                                  <extension module="org.jboss.as.jaxrs"/>
                                  <extension module="org.jboss.as.jmx"/>
                                  <extension module="org.jboss.as.jpa"/>
                                  <extension module="org.jboss.as.logging"/>
                                  <extension module="org.jboss.as.naming"/>
                                  <extension module="org.jboss.as.osgi"/>
                                  <extension module="org.jboss.as.remoting"/>
                                  <extension module="org.jboss.as.sar"/>
                                  <extension module="org.jboss.as.security"/>
                                  <extension module="org.jboss.as.threads"/>
                                  <extension module="org.jboss.as.transactions"/>
                                  <extension module="org.jboss.as.web"/>
                                  <extension module="org.jboss.as.weld"/>
                              </extensions>
                              <management>
                                  <security-realms>
                                      <security-realm name="PropertiesMgmtSecurityRealm">
                                          <authentication>
                                              <properties path="mgmt-users.properties" relative-to="jboss.server.config.dir"/>
                                          </authentication>
                                      </security-realm>
                                  </security-realms>
                                  <management-interfaces>
                                      <native-interface interface="management" port="9999"/>
                                      <http-interface interface="management" port="9990"/>
                                  </management-interfaces>
                              </management>
                              <profile>
                                  <subsystem xmlns="urn:jboss:domain:logging:1.0">
                                      <console-handler name="CONSOLE" autoflush="true">
                                          <level name="INFO"/>
                                          <formatter>
                                              <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
                                          </formatter>
                                      </console-handler>
                                      <periodic-rotating-file-handler name="FILE" autoflush="true">
                                          <level name="INFO"/>
                                          <formatter>
                                              <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
                                          </formatter>
                                          <file relative-to="jboss.server.log.dir" path="server.log"/>
                                          <suffix value=".yyyy-MM-dd"/>
                                      </periodic-rotating-file-handler>
                                      <logger category="com.arjuna">
                                          <level name="WARN"/>
                                      </logger>
                                      <logger category="org.apache.tomcat.util.modeler">
                                          <level name="WARN"/>
                                      </logger>
                                      <logger category="sun.rmi">
                                          <level name="WARN"/>
                                      </logger>
                                      <root-logger>
                                          <level name="INFO"/>
                                          <handlers>
                                              <handler name="CONSOLE"/>
                                              <handler name="FILE"/>
                                          </handlers>
                                      </root-logger>
                                  </subsystem>
                                  <subsystem xmlns="urn:jboss:domain:datasources:1.0">
                                   <datasources>
                                                           <datasource jndi-name="java:jboss/datasources/ItilDS" pool-name="ItilDS">
                                                                    <connection-url>jdbc:mysql://localhost:3306/itil</connection-url>
                                                                             <driver>com.mysql</driver>
                                                                    <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
                                                                    <pool>
                                                                            <min-pool-size>10</min-pool-size>
                                                                            <max-pool-size>100</max-pool-size>
                                                                            <prefill>true</prefill>
                                                                    </pool>
                                                                    <security>
                                                                            <user-name>admin</user-name>
                                                                            <password>test</password>
                                                                    </security>
                                                                    <statement>
                                                                            <prepared-statement-cache-size>32</prepared-statement-cache-size>
                                                                    </statement>
                                                                  </datasource>
                                                                  <drivers>
                                                                    <driver name="com.mysql" module="com.mysql">
                                                                            <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
                                                                    </driver>
                                                                  </drivers>
                                                        </datasources>
                                  </subsystem>
                                  <subsystem xmlns="urn:jboss:domain:deployment-scanner:1.0">
                                      <deployment-scanner name="default" path="deployments" scan-enabled="true" scan-interval="5000" relative-to="jboss.server.base.dir" deployment-timeout="60"/>
                                  </subsystem>
                                  <subsystem xmlns="urn:jboss:domain:ee:1.0">
                                      <global-modules>
                                          <module name="itil.librerias" slot="main"/>
                                      </global-modules>
                                  </subsystem>
                                  <subsystem xmlns="urn:jboss:domain:ejb3:1.0"/>
                                  <subsystem xmlns="urn:jboss:domain:infinispan:1.0" default-cache-container="hibernate">
                                      <cache-container name="hibernate" default-cache="local-query">
                                          <local-cache name="entity">
                                              <eviction strategy="LRU" max-entries="10000"/>
                                              <expiration max-idle="100000"/>
                                          </local-cache>
                                          <local-cache name="local-query">
                                              <eviction strategy="LRU" max-entries="10000"/>
                                              <expiration max-idle="100000"/>
                                          </local-cache>
                                          <local-cache name="timestamps">
                                              <eviction strategy="NONE"/>
                                          </local-cache>
                                      </cache-container>
                                  </subsystem>
                                  <subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/>
                                  <subsystem xmlns="urn:jboss:domain:jca:1.0">
                                      <archive-validation enabled="false"/>
                                      <bean-validation enabled="false"/>
                                      <default-workmanager>
                                          <short-running-threads blocking="true" allow-core-timeout="false">
                                              <core-threads count="10" per-cpu="20"/>
                                              <queue-length count="10" per-cpu="20"/>
                                              <max-threads count="10" per-cpu="20"/>
                                              <keepalive-time time="10" unit="SECONDS"/>
                                          </short-running-threads>
                                          <long-running-threads blocking="true" allow-core-timeout="false">
                                              <core-threads count="10" per-cpu="20"/>
                                              <queue-length count="10" per-cpu="20"/>
                                              <max-threads count="10" per-cpu="20"/>
                                              <keepalive-time time="10" unit="SECONDS"/>
                                          </long-running-threads>
                                      </default-workmanager>
                                  </subsystem>
                                  <subsystem xmlns="urn:jboss:domain:jmx:1.0">
                                      <jmx-connector server-binding="jmx-connector-server" registry-binding="jmx-connector-registry"/>
                                  </subsystem>
                                  <subsystem xmlns="urn:jboss:domain:jpa:1.0">
                                      <jpa default-datasource=""/>
                                  </subsystem>
                                  <subsystem xmlns="urn:jboss:domain:naming:1.0"/>
                                  <subsystem xmlns="urn:jboss:domain:osgi:1.0" activation="lazy">
                                      <configuration pid="org.apache.felix.webconsole.internal.servlet.OsgiManager">
                                          <property name="manager.root">
                                              jboss-osgi
                                          </property>
                                      </configuration>
                                      <properties>
                                          <property name="org.jboss.osgi.system.modules">
                                              org.apache.commons.logging,
                                                                                  org.apache.log4j,
                                                                                  org.jboss.as.osgi,
                                                                                  org.slf4j,
                                          </property>
                                          <property name="org.osgi.framework.system.packages.extra">
                                              org.apache.commons.logging;version=1.1.1,
                                                                                  org.apache.log4j;version=1.2,
                                                                                  org.jboss.as.osgi.service;version=7.0,
                                                                                  org.jboss.osgi.deployment.interceptor;version=1.0,
                                                                                  org.jboss.osgi.spi.capability;version=1.0,
                                                                                  org.jboss.osgi.spi.util;version=1.0,
                                                                                  org.jboss.osgi.testing;version=1.0,
                                                                                  org.jboss.osgi.vfs;version=1.0,
                                                                                  org.slf4j;version=1.5.10,
                                          </property>
                                          <property name="org.osgi.framework.startlevel.beginning">
                                              1
                                          </property>
                                      </properties>
                                      <modules>
                                          <module identifier="javaee.api"/>
                                          <module identifier="org.jboss.logging"/>
                                          <module identifier="org.apache.aries.util"/>
                                          <module identifier="org.jboss.osgi.webconsole"/>
                                          <module identifier="org.osgi.compendium"/>
                                                                  <module identifier="com.mysql"/>
                                          <module identifier="org.apache.felix.log" startlevel="1"/>
                                          <module identifier="org.jboss.osgi.logging" startlevel="1"/>
                                          <module identifier="org.apache.felix.configadmin" startlevel="1"/>
                                          <module identifier="org.jboss.as.osgi.configadmin" startlevel="1"/>
                                          <module identifier="org.apache.aries.jmx" startlevel="2"/>
                                          <module identifier="org.apache.felix.eventadmin" startlevel="2"/>
                                          <module identifier="org.apache.felix.metatype" startlevel="2"/>
                                          <module identifier="org.apache.felix.scr" startlevel="2"/>
                                          <module identifier="org.apache.felix.webconsole" startlevel="2"/>
                                          <module identifier="org.jboss.osgi.jmx" startlevel="2"/>
                                          <module identifier="org.jboss.osgi.http" startlevel="2"/>
                                          <module identifier="org.jboss.osgi.blueprint" startlevel="3"/>
                                          <module identifier="org.jboss.osgi.webapp" startlevel="3"/>
                                          <module identifier="org.jboss.osgi.xerces" startlevel="3"/>
                                      </modules>
                                  </subsystem>
                                  <subsystem xmlns="urn:jboss:domain:remoting:1.0"/>
                                  <subsystem xmlns="urn:jboss:domain:resource-adapters:1.0"/>
                                  <subsystem xmlns="urn:jboss:domain:sar:1.0"/>
                                  <subsystem xmlns="urn:jboss:domain:security:1.0">
                                      <security-domains>
                                          <security-domain name="other" cache-type="default">
                                              <authentication>
                                                  <login-module code="UsersRoles" flag="required"/>
                                              </authentication>
                                          </security-domain>
                                      </security-domains>
                                  </subsystem>
                                  <subsystem xmlns="urn:jboss:domain:threads:1.0"/>
                                  <subsystem xmlns="urn:jboss:domain:transactions:1.0">
                                      <core-environment>
                                          <process-id>
                                              <uuid/>
                                          </process-id>
                                      </core-environment>
                                      <recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/>
                                      <coordinator-environment default-timeout="300"/>
                                      <object-store/>
                                  </subsystem>
                                  <subsystem xmlns="urn:jboss:domain:web:1.0" default-virtual-server="default-host">
                                      <connector name="http" protocol="HTTP/1.1" socket-binding="http" scheme="http"/>
                                      <virtual-server name="default-host" enable-welcome-root="true">
                                          <alias name="localhost"/>
                                          <alias name="example.com"/>
                                      </virtual-server>
                                  </subsystem>
                                  <subsystem xmlns="urn:jboss:domain:weld:1.0"/>
                              </profile>
                              <interfaces>
                                  <interface name="management">
                                      <inet-address value="127.0.0.1"/>
                                  </interface>
                                  <interface name="public">
                                      <inet-address value="127.0.0.1"/>
                                  </interface>
                              </interfaces>
                              <socket-binding-group name="standard-sockets" default-interface="public">
                                  <socket-binding name="http" port="8080"/>
                                  <socket-binding name="https" port="8443"/>
                                  <socket-binding name="jmx-connector-registry" port="1090"/>
                                  <socket-binding name="jmx-connector-server" port="1091"/>
                                  <socket-binding name="jndi" port="1099"/>
                                  <socket-binding name="osgi-http" port="8090"/>
                                  <socket-binding name="remoting" port="4447"/>
                                  <socket-binding name="txn-recovery-environment" port="4712"/>
                                  <socket-binding name="txn-status-manager" port="4713"/>
                              </socket-binding-group>
                          </server>
                          

                           

                          The path is C:\jboss-as-web-7.0.0.Final\modules\com\mysql\main

                          Thanks for your help!

                          • 10. Re: Error to start application (persistence.xml problem)
                            spiritfox26

                            I could solve it! But i have some questions:

                             

                            What happen with my persistence.xml is needed?

                            When put @DataSourceDefinition? (what class? PersistenceManager?)

                             

                            In my web.xml i have:

                             

                             

                            <listener>
                                 <listener-class>uy.com.its.util.PersistenceAppListener</listener-class>
                            </listener>
                            

                             

                            PersistenceAppListener.java

                             

                            public class PersistenceAppListener implements ServletContextListener {
                            
                                      public void contextDestroyed(ServletContextEvent arg0) {
                                          PersistenceManager.getInstance().closeEntityManagerFactory();
                                      }
                            
                                      public void contextInitialized(ServletContextEvent arg0) {
                                                // TODO Auto-generated method stub
                                                PersistenceManager.getInstance().getEntityManagerFactory();
                                      }
                            
                            }
                            

                             

                             

                            PersistenceManager.java

                             

                            public class PersistenceManager {
                              
                                      public static final boolean DEBUG = true;
                              
                                      private static final PersistenceManager singleton = new PersistenceManager();
                              
                                      private EntityManagerFactory emf;
                            
                                      public static PersistenceManager getInstance() {
                                                return singleton;
                                      }
                            
                            
                                      public EntityManagerFactory getEntityManagerFactory() {
                                                if (emf == null)
                                                          createEntityManagerFactory();
                                                return emf;
                                      }
                            
                            
                                      public void closeEntityManagerFactory() {
                                                if (emf != null) {
                                                          emf.close();
                                                          emf = null;
                                                          if (DEBUG)
                                                                    System.out.println("Persistencia Finalizada "
                                                                                        + new java.util.Date());
                                                }
                                      }
                            
                            
                                      private void createEntityManagerFactory() {
                                                this.emf = Persistence.createEntityManagerFactory("itil", new HashMap());
                                                if (DEBUG)
                                                          System.out.println("Persistencia Inicializada "
                                                                              + new java.util.Date());
                                      }
                            }
                            
                            

                             

                            So I initialize the persistence. What changes i will make to new configuration?

                             

                            Thanks in advanced

                            • 11. Re: Error to start application (persistence.xml problem)
                              smarlow

                              I'm not following what you are trying to accomplish?  Is PersistenceManager your attempt to code around the problems that you are experiencing or is that how your application is already written?

                              • 12. Re: Error to start application (persistence.xml problem)
                                spiritfox26

                                Is how my application is already written.

                                 

                                Sorry but my english is very bad.

                                 

                                Regards

                                • 13. Re: Error to start application (persistence.xml problem)
                                  jedierikb

                                  FYI for future readers: this is specified here in item #5 at the bottom of the page.