java - Jboss 7.1.1 correct hibernate dependencies -


i'm reviewing pom.xml of old project i'm trying run on jboss 7.1.1. pom contains lot of dependencies artifacts like:

  • hibernate-core
  • hibernate-validator
  • hibernate-jpa-2.0-api
  • hibernate-entitymanager
  • ...

as jboss 7.1.1 has module org.hibernate i've managed remove these dependencies except of hibernate-core creating \meta-inf\jboss-deployment-structure.xml following content:

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">     <deployment>         <dependencies>             <module name="org.hibernate"/>         </dependencies>     </deployment> </jboss-deployment-structure> 

so in order able compile war file need have dependency

<dependency>         <groupid>org.hibernate</groupid>         <artifactid>hibernate-core</artifactid>         <version>${hibernate.version}</version> </dependency> 

but can't understand why can't set provided scope. if included in org.hibernate module, why can't so? if set provided, i'm getting following error:

initial sessionfactory creation failed.java.lang.noclassdeffounderror: org/hibernate/cfg/configuration 

i want set provided scope exclude war file

instead of jboss-deployment-structure.xml if using maven in project better provide hibernate , supported module manifest entry. can achieve following code in pom.xml

<plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-war-plugin</artifactid> <configuration> <archive> <manifestentries> <dependencies> org.infinispan,org.hibernate </dependencies> </manifestentries> </archive> </configuration> </plugin> 

then add other required dependencies scope provided can loaded @ run time out bundling in war, use following example.

<dependency>         <groupid>org.hibernate</groupid>         <artifactid>hibernate-core</artifactid>         <version>4.0.1.final</version>         <scope>provided</scope>     </dependency>      <dependency>         <groupid>org.hibernate</groupid>         <artifactid>hibernate-validator</artifactid>         <version>4.2.0.final</version>         <scope>provided</scope>     </dependency>    <dependency>         <groupid>org.hibernate.common</groupid>         <artifactid>hibernate-commons-annotations</artifactid>         <version>4.0.1.final</version>         <classifier>tests</classifier>         <scope>provided</scope>     </dependency>     <dependency>         <groupid>org.hibernate.javax.persistence</groupid>         <artifactid>hibernate-jpa-2.0-api</artifactid>         <version>1.0.1.final</version>      </dependency>      <dependency>         <groupid>org.hibernate</groupid>         <artifactid>hibernate-c3p0</artifactid>         <version>4.0.1.final</version>     </dependency>     <dependency>         <groupid>org.hibernate</groupid>         <artifactid>hibernate-entitymanager</artifactid>         <version>4.0.1.final</version>         <scope>provided</scope>     </dependency>     <dependency>         <groupid>javax.validation</groupid>         <artifactid>validation-api</artifactid>         <version>1.0.0.ga</version>         <scope>provided</scope>     </dependency> 

Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -