Jun 11th, 2008, 07:44 AM
Spring + EJB3 + JBoss + Hibernate
I'm actually working on a huge middleware deployed on JBoss4.0.4, with massive usage of EJB3s and Hibernate and I'm trying to show some architectural improvements that POJO programming can bring to the whole architecture, from testing to real usage scenario...
I really can't port the whole middleware to spring, so what i'm actually doing is an hybrid application (but it's ok for my few months thesis application)...
i kept only an EJB3 facade for remoting, trying to inject inside EJB3s spring pojos, doing the pure business services, but i'm facing big compatibility problems with jboss hibernate, which APIs are different in comparison with the ones used by Spring's LocalContainerEntityManagerFactoryBean (and spring/orm/jpa in general)... that's a ClassLoader problems, due to the fact that the EJB3 parts of the middleware still using "JBoss Hibernate" load ejb3-persistence.jar basically before Spring... and so, Spring's side, i get a NoSuchMethodError on javax.persistence.spi.PersistenceProvider (a different method signature)... I had this problem using JBoss-Spring-Deployer, because it's an MBean, getting loaded by the ejb3-deployer and thus using ejb3-persistence-jar)
replacing jboss persistence libraries with new and "standard" ones make the middleware and jboss get mad...
then I decided to bootstrap the whole spring side of the framework from an isolated WAR (yep, bad, but this way I can override jboss hibernate apis) ...
some of you have encountered the same problem?
i'm just asking some best practices in this use case, because i'm a bit disappointed about these architectural patches... and i know that porting the whole middleware to tomcat+spring+hibernate would be a lot better and cleaner, but i really can't (too much efforts for the kind of thesis I'm working on..) and JBoss AS actually is super-legacy
Thanks in advance and congratulations for the wonderful community!
Jun 11th, 2008, 08:25 AM
Maybe it helps to tweak JBoss' classloading to ensure that your hibernate jars will be used.