Here are a few quick tips when migrating Hibernate 3-based applications to JBoss AS7, covering the options available for JBoss AS 7.0.0.Final.

In previous versions of JBoss AS, a version of Hibernate was always present on the classpath. As a result, applications that used Hibernate directly have traditionally avoided to include it in the deployment in order to avoid classloading conflicts, or have taken additional steps to enforce classloader isolation.

The visibility rules have changed in AS7 due to the new modular classloading model, and so Hibernate libraries are made visible by default only to JPA deployments. The changes may affect existing Hibernate applications, so this is a short breakdown on the available options when running on JBoss AS7. Wherever this is subject to change in future versions, we also provide a succint description of the forthcoming enhancements.

Native Hibernate applications

As of the 7.0.0.Final version of JBoss AS, native (i.e. non-JPA) Hibernate applications can opt between:

  • packaging a Hibernate version of their choice inside the application;
  • adding the 'org.hibernate' module as a dependency to the application (adds Hibernate 4), e.g. by adding to the deployment a META-INF/MANIFEST.MF file that contains the following line:
    Dependencies: org.hibernate
  • creating a custom Hibernate 3 module, and adding it as a dependency to the application,e.g.
    Dependencies: my-custom-hibernate-module
    - noting that future versions of JBoss AS7 may already provide a skeleton Hibernate 3 module.

Application-created persistence units

JPA applications that create an EntityManagerFactory on their own, either using the PersistenceProvider SPI directly or through an intermediary mechanism such as Spring's LocalContainerEntityManagerFactoryBean have the same options as native Hibernate applications, noting that the 'org.hibernate' module may be added by default as a dependency as described here - so you may need to exclude it explicitly if you want to provide a version of your own. Therefore, under typical circumstances such applications can:

  • use the default setup (and use Hibernate 4)
  • package a Hibernate version of their choice and exclude the default 'org.hibernate' module by adding a WEB-INF/jboss-deployment-structure.xml or META-INF/jboss-deployment-structure.xml file (depending whether the deployment is a WAR or not) as follows:
    <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
           <module name="org.hibernate"/>
  • create a custom module and using it instead of the default 'org.hibernate';

Container-deployed persistence units

Generally speaking, standard Java EE-applications may ignore the provider implementation and rely on the standard features provided by the container - JBoss AS7 supporting standard JPA 1.0 and 2.0.

However, in future versions of JBoss AS7 it will be possible to use alternative persistence provider implementations - for more details please follow AS7-566.

30. Jul 2011, 20:20 CET | Link

Currently, excluding Hibernate 4 isn't working, at least when porting Seam 2 apps. I used

      <module name="org.hibernate" slot="main" />

but then a CCE occurrs when deploying:

20:07:23,921 ERROR [] (MSC service thread 1-3) MSC00001: Failed to start service jboss.persistenceunit."bbstats.war#MyPersistenceUnit": org.jboss.msc.service.StartException in service jboss.persistenceunit."bbstats.war#MyPersistenceUnit": Failed to start service
	at org.jboss.msc.service.ServiceControllerImpl$
	at org.jboss.msc.service.ServiceControllerImpl$
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [:1.7.0]
	at java.util.concurrent.ThreadPoolExecutor$ Source) [:1.7.0]
	at Source) [:1.7.0]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: MyPersistenceUnit] Unable to build EntityManagerFactory
	at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(
	at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(
	at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(
	at org.jboss.msc.service.ServiceControllerImpl$
	... 4 more
Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.service.jdbc.connections.spi.ConnectionProvider]
	at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(
	at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(
	at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(
	at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(
	at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(
	at org.hibernate.service.internal.BasicServiceRegistryImpl.configureService(
	at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(
	at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(
	at org.hibernate.cfg.SettingsFactory.buildSettings(
	at org.hibernate.cfg.Configuration.buildSettingsInternal(
	at org.hibernate.cfg.Configuration.buildSettings(
	at org.hibernate.cfg.Configuration.buildSessionFactory(
	at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(
	at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(
	... 9 more
Caused by: org.hibernate.HibernateException: Could not instantiate connection provider [org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider]
	at org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator.instantiateExplicitConnectionProvider(
	at org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator.initiateService(
	at org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator.initiateService(
	at org.hibernate.service.internal.BasicServiceRegistryImpl.initiateService(
	at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(
	... 22 more
Caused by: java.lang.ClassCastException: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider cannot be cast to org.hibernate.service.jdbc.connections.spi.ConnectionProvider
	at org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator.instantiateExplicitConnectionProvider(
	... 26 more

20:07:24,153 INFO  [] (DeploymentScanner-threads - 2) Deployment of "bbstats.war" was rolled back with failure message {"Failed services" => {"jboss.persistenceunit.\"bbstats.war#MyPersistenceUnit\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"bbstats.war#MyPersistenceUnit\": Failed to start service"}}
20:07:24,153 INFO  [] (DeploymentScanner-threads - 2) Service status report
  Services which failed to start:
      service jboss.persistenceunit."bbstats.war#MyPersistenceUnit": org.jboss.msc.service.StartException in service jboss.persistenceunit."bbstats.war#MyPersistenceUnit": Failed to start service

When removing the line

     <module name="org.hibernate" slot="main" />

everything deploys fine, but then me and others are stuck on another runtime exception, see TransactionManager lookup fails on AS7. No webapp on JBoss AS 7 yet...

Most people using Seam 2 porting to JBoss AS 7 will likely use Hibernate, so I consider my comment somewhat applicable. Feel free to shorten it as appropriate.

01. Jun 2014, 14:09 CET | Link

Desire System: Dr. David T. Reveals The Holy Grail Of Seduction Techniques That Uses Emotional Contagion To Turn A Woman On And Compels Her To Chase You And Want Sex With You This site includes a Desire System review and buyers guide that provides an insider's look at the program and answers frequently asked questions about Dr. David's unique and controversial seduction system. Learn everything you need to know about the program so you can decide if the Desire System is the right choice for you before you buy it.desire system

07. Jun 2014, 18:08 CET | Link

Start Potty Training In 3 Days: Carol Cline Reveals Her Simple To Implement And Highly Effective Potty Training Method For Getting Boys And Girls Out Of Diapers In 72 Hours Or Less.start potty training by carol cline

18. Jun 2014, 14:03 CET | Link

The world of bodybuilding is filled with marketers claiming to make the best workout supplements to build lean muscle, increase strength, and help with recovery. Most of this is just hype. But there is a simple formula for muscle growth and significant strength increases, while getting ripped at the same time.Efficient Gains

18. Jun 2014, 15:36 CET | Link

The foundation of our philosophy is that technology should enhance your enjoyment of your home, but should not heavily impact the look. To this end we work closely with architects, builders, interior designers and decorators to achieve a seamless installation that both meets your home entertainment needs but also keeps technology where it belongs; in the background.Innovative Sight and Sound

21. Jun 2014, 05:38 CET | Link

Learning styles are various approaches or ways of learning. They involve educating methods, particular to an individual that are presumed to allow that individual to learn best. Most children favor some particular method of interacting with processing information.Dermatoglyphics Multiple Intelligence Test

21. Jun 2014, 07:28 CET | Link

At this time, we are able to easily find fashionable and ready-made fir pit kits, which we are able to purchase, and in many cases carry around with us even when camping or enjoying the outdoors anywhere. Compra Con Un Click

22. Jun 2014, 13:58 CET | Link

The River Thames is an iconic part of London, meandering through the heart of the city and offering fantastic sightseeing from Tower Bridge to the London Eye and even the historic Houses of Parliament.London Eye river cruises

23. Jun 2014, 18:19 CET | Link

This is an exclusive fruit-based medication course, which helps you overcome from the problem from excessive weight and other related issues caused by fatty cells. An interesting fact in this case is that this type of course will not only help you to save your money involved in surgical procedure and complex diagnose, but also prevent you from the surgical process. Jay Strickland

23. Jun 2014, 19:10 CET | Link

The purpose of field service management software is to assist officers in service delivery to the people. Therefore, one should choose one that avails information that will lead to more growth of the business. Provide your customers with valuable data and most certainly, there will be increased customers to your

24. Jun 2014, 11:59 CET | Link

This social networking giant has altered, in very short order the way we handle all of interactions, including communications, promotions and general management of our lives. The promotion and sharing of all things we do, be it through our work, our personal project or just our shared scheduling is conducted through

24. Jun 2014, 13:04 CET | Link

The kingdom of Goa is the most important in India…It is civilized, having famous orchards and water. It is the coolest place in India and it is the most plentiful in foodstuffs. ‘The white people make a practice of going to the kingdom of Goa to enjoy the shade and the groves of trees and to savour the sweet betel.

11. Jul 2014, 09:46 CET | Link

Awesome and interesting article. mcse

12. Jul 2014, 08:08 CET | Link

Very well written article. It seems that the author has done a solid job, and needs good comments. DMIT India

08. Aug 2014, 11:54 CET | Link

Awesome and interesting article. American Diamond Jewellery

11. Aug 2014, 11:23 CET | Link

I did enjoy reading articles posted on this site. They are impressive and has a lot of useful information. How to become a videogame tester

13. Aug 2014, 11:27 CET | Link

I did enjoy reading articles posted on this site. They are impressive and has a lot of useful information. Automated Curtains

30. Aug 2014, 04:03 CET | Link

Life will always be confused, no one can really predict, the future, Coach Outlet Black Friday, Live in the world, Ralph Lauren UK, and so we were growing up, Sac Longchamp Pairs, in the confusion, Michael Kors Outlet Online, life of all things, the same is spent also confused, Beats By Dre Outlet, confused, Michael Kors Outlet, confused world, Ralph Polo Outlet, in this world, I am a leaf, Oakley Sunglaases Factory, accompanied by wind, North Face Outlet Online, leisurely, Super Bags Market, but spent 12 years in trouble, Canada Goose Outlet, me than to know their own future, Burberry Outlet, but do not know the survival dream, because I was so small, Polo Outlet Store, wind, Michael Kors Outlet, quietly floating, Coach Factory, I stood under a tree, Gucci Shoes Outlet, watching the falling leaves, MCM Outlet, know that fall, North Clearace Outlet, at the very bottom, I perhaps these leaves, Marc Jacobs On Sale, to know fall, Monster Beats Outlet, but still could not find a direction, Nike Jordan Shoes, in the confusion.

29. Sep 2014, 04:30 CET | Link
darwin smith

I like it! I like it a lot. You know exactly what you're talking about, exactly where other people are coming from on this issue. I'm glad that I had the fortune to stumble across your blog. grow taller 4 idiots reviews

29. Sep 2014, 10:59 CET | Link
home insurance rates by zip code

“ Take a chance, get a quote on home owner insurance by 5-digit zip code in few minutes. It is obvious that home ownership is dream for anyone. But searching and buying of such home place for your family could be important and responsible investment. It means that good loan can be obtained if your house and posessions are properly insured with affordable homeowners insurance policy. house insurance ”home insurance rates by zip code

13. Oct 2014, 09:39 CET | Link
mike walden | backlink12(AT)

You're so cool! I do not think I've truly read through anything like this before. So nice to find somebody with some unique thoughts on this subject matter. Really.. thanks for starting this up. best products for acne and dieta para quemar grasa abdominal

14. Oct 2014, 18:42 CET | Link
20. Oct 2014, 11:41 CET | Link

This is a great article thanks for sharing this informative information. HD mxf files conversion software mxf converter pdf conversion to Office pdf to word

27. Oct 2014, 22:25 CET | Link
Terry Brown | anna3(AT)

I've been seeking information on that subject for the past few a long time as well as located ones post being well crafted and possesses stable data. essay writer

02. Nov 2014, 07:22 CET | Link

You have done a great job. I will definitely dig it and personally recommend to my friends. I am confident they will be benefited from this site. ankle brace

05. Nov 2014, 09:36 CET | Link

A very awesome blog post. We are really grateful for your blog post. You will find a lot of approaches after visiting your post.automatic transmission replacement

14. Nov 2014, 16:34 CET | Link

Click HELP for text formatting instructions. Then edit this text and check the preview.

15. Nov 2014, 13:04 CET | Link
zxcvasd | asdf(AT)

Easily, the article is actually the best topic on this registry related issue. I fit in with your conclusions and will eagerly look forward to your next updates. Just saying thanks will not just be sufficient, for the fantasti c lucidity in your writing. I will instantly grab your rss feed to stay informed of any updates.

best amino acid
17. Nov 2014, 15:40 CET | Link
Pyzork Golf Drive Professor

Great information you got here. I’ve been reading about this topic for one week now for my papers in school and thank God I found it here in your blog.Pyzork Golf Drive Professor

18. Dec 2014, 14:59 CET | Link
payday loan companies uk

There is a lot of information here that can help any business get started with a successful social networking campaign!payday loan companies uk