0 Replies Latest reply on Aug 22, 2014 11:55 AM by honeypapa

    Jboss 7 issue

    honeypapa

      Hi,

       

      We are doing Upgradation from Jboss4 to Jboss7.

       

      We have used in our application hibernate3.x version.

      But while starting the application, hibernate 4 jars are loading which is coming from Jboss 7.


      I have observed that, if we remove the below content in standalone.xml file, it is not taking any version of the hibernate jars.( hibernate 3 (my application version) (or) hibernate 4(Jboss 7 default version)  and the .ear file has deployed successfully.

       

      <!--subsystem xmlns="urn:jboss:domain:jpa:1.1">

       

      <jpa default-datasource=""/>

       

      </subsystem →

       

      If I keep this, loading only hibernate 4 jars not my application jars.

       

      If I remove the above content the .ear file deployed successfully.  But while accessing the local url getting the below exception.

       

      Caused by: javax.naming.NameNotFoundException: EntityManagerFactories/xxx2 -- service jboss.naming.context.java.EntityManagerFactories.xxx2

      at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:97)

      at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:178)

      at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:113)

      at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:214)

      at javax.naming.InitialContext.lookup(Unknown Source) [rt.jar:1.7.0_67]

      at org.jboss.seam.persistence.ManagedPersistenceContext.getEntityManagerFactoryFromJndiOrValueBinding(ManagedPersistenceContext.java:241) [jboss-seam-2.1.2.jar:2.1.2]

      ... 129 more

       

      How to load hibernate 3 jars while starting the server?

       

      My  jboss-deployment-structure.xml  file

       

      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">

      <deployment>

        <dependencies>

         <module name="javax.faces.api" slot="1.2" export="true" />

         <module name="com.sun.jsf-impl" slot="1.2" export="true" />

         <module name="org.apache.commons.logging" export="true" />

         <module name="org.dom4j" export="true" />

         <module name="org.apache.commons.collections" export="true" />

        </dependencies>

      </deployment>

      <sub-deployment name="web-2.0.21.war">

        <exclusions>

         <module name="javax.faces.api" slot="main" />

         <module name="com.sun.jsf-impl" slot="main" />

        </exclusions>

        <dependencies>

         <module name="javax.faces.api" slot="1.2" />

         <module name="com.sun.jsf-impl" slot="1.2" />

        </dependencies>

      </sub-deployment>

      </jboss-deployment-structure>

       

      Persistence.xml file

       

      <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_1_0.xsd"

          version="1.0">

          <persistence-unit name="amanda2">

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

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

       

      DS</jta-data-source>

              <properties>

                  <property name="jboss.entity.manager.factory.jndi.name" value="java:/EntityManagerFactories/xxx

       

      "/>

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

              </properties>

          </persistence-unit>

      </persistence>

       

      Components.xml

       

        <core:init debug="false" jndi-pattern="amanda2/#{ejbName}/local" />

          <persistence:managed-persistence-context name="entityManager" auto-create="true"  persistence-unit-jndi-name="java:/EntityManagerFactories/xxx2"

       

      Please advise!