Hi. We're having some trouble using Hibernate2 (beta2) on JBoss 3.2RC4.
I've discussed the problem on the Hibernate discussion forum (sourceforge) and managed to find a work-around... sort-of :) Below is the initial post (the entire thread can be found at http://sourceforge.net/forum/forum.php?thread_id=841642&forum_id=128638): ==== From Hibernate2 forum: Hi. We're having some problem getting Hibernate2 (b4) to run on JBoss (3.2RC4). We use Hibernate from a Stateless Session EJB, and get the following stack-trace from JBoss when hibernate initializes: [...] 2003-04-01 22:33:40,078 INFO [net.sf.hibernate.cfg.Environment] Hibernate 2.0 beta 4 2003-04-01 22:33:40,086 INFO [net.sf.hibernate.cfg.Environment] loaded properties from resource hibernate.properties: {hibernate.dialect=net.sf.hibern ate.dialect.PostgreSQLDialect, hibernate.show_sql=true, hibernate.connection.datasource=java:/PostgresDS} 2003-04-01 22:33:40,095 INFO [net.sf.hibernate.cfg.Environment] JVM proxy support: true 2003-04-01 22:33:40,107 INFO [net.sf.hibernate.cfg.Configuration] Mapping resource: se/mobilecare/model/ItemModel.hbm.xml 2003-04-01 22:33:40,287 DEBUG [net.sf.hibernate.util.DTDEntityResolver] trying to locate http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in classpath under net/sf/hibernate/ 2003-04-01 22:33:40,289 DEBUG [net.sf.hibernate.util.DTDEntityResolver] found http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in classpath 2003-04-01 22:33:40,632 INFO [net.sf.hibernate.mapping.Collection] Mapping class: se.mobilecare.model.ItemModel -> item 2003-04-01 22:33:41,418 WARN [org.jboss.mx.loading.ClassLoadingTask] Duplicate class found: org.apache.bcel.generic.RETURN Current CS: (file:/home/azure/jboss-3.2.0RC4/server/default/tmp/deploy/server/default/deploy/mobilecare-app.ear/lib/ejb/cglib.jar/75.cglib.jar <no cert ificates>) Duplicate CS: (file:/home/azure/jboss-3.2.0RC4/server/default/lib/bcel.jar <no certificates>) 2003-04-01 22:33:41,419 DEBUG [org.jboss.mx.loading.ClassLoadingTask] Ignoring source of: org.apache.bcel.generic.RETURN from CodeSource: (file:/home/a zure/jboss-3.2.0RC4/server/default/lib/bcel.jar <no certificates>), due to order(0>=0), accepted CodeSource: (file:/home/azure/jboss-3.2.0RC4/server/de fault/tmp/deploy/server/default/deploy/mobilecare-app.ear/lib/ejb/cglib.jar/75.cglib.jar <no certificates>) 2003-04-01 22:33:41,439 ERROR [org.jboss.ejb.plugins.LogInterceptor] Unexpected Error: java.lang.NoClassDefFoundError: org/apache/bcel/generic/DCONST at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:140) at net.sf.cglib.CodeGenerator.class$(CodeGenerator.java:63) at net.sf.cglib.CodeGenerator.<init>(CodeGenerator.java:105) at net.sf.cglib.KeyFactoryGenerator.<init>(KeyFactoryGenerator.java:93) at net.sf.cglib.KeyFactory.create(KeyFactory.java:114) at net.sf.hibernate.impl.SessionFactoryImpl.<clinit>(SessionFactoryImpl.java:297) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:571) at se.mobilecare.services.ejb.ItemServiceBean.getSession(Unknown Source) at se.mobilecare.services.ejb.ItemServiceBean.findAllItems(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:629) at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186) at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72) at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84) at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:243) at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:104) at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:117) at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:198) at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122) at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:322) at org.jboss.ejb.Container.invoke(Container.java:678) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549) at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:101) at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:88) at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:77) at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:80) at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:109) at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:82) at $Proxy56.findAllItems(Unknown Source) at se.mobilecare.web.actions.item.List.doExecute(Unknown Source) at webwork.action.ActionSupport.execute(ActionSupport.java:114) at webwork.dispatcher.GenericDispatcher.executeAction(GenericDispatcher.java:113) at webwork.dispatcher.ServletDispatcher.service(ServletDispatcher.java:161) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360) at org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplicationHandler.java:326) at se.mobilecare.web.filters.DebugFilter.doFilter(Unknown Source) [...] Caused by: java.lang.NoClassDefFoundError: org/apache/bcel/generic/DCONST at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:140) at net.sf.cglib.CodeGenerator.class$(CodeGenerator.java:63) at net.sf.cglib.CodeGenerator.<init>(CodeGenerator.java:105) at net.sf.cglib.KeyFactoryGenerator.<init>(KeyFactoryGenerator.java:93) at net.sf.cglib.KeyFactory.create(KeyFactory.java:114) at net.sf.hibernate.impl.SessionFactoryImpl.<clinit>(SessionFactoryImpl.java:297) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:571) at se.mobilecare.services.ejb.ItemServiceBean.getSession(Unknown Source) at se.mobilecare.services.ejb.ItemServiceBean.findAllItems(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:629) at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186) at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72) at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84) at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:243) at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:104) at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:117) at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:198) ... 38 more [...] It seems like the bcel library in hibernate (cglib.jar) comflicts with bcel.jar (in JBOSS_HOME/server/default/lib) - but JBoss resolves the conflict and loads classes from cglib.jar (or so the log says...). The cglib.jar is refererenced in the ejb-jar META-INF/MANIFEST.MF. Is this a known issue with JBoss 3.2RC4 (in that case I'll take the problem to JBoss mailing list) or could this be a Hibernate related problem? === I managed to solve the problem by removing the JBOSS_HOME/server/default/lib/bcel.jar and replace it with cglib.jar from the Hibernate2 distribution. But - should the above really happen (and /what/ is happening)? Anyone else having problems running Hibernate2 with JBoss? //Anders -- |===================================| | Anders Engström | | [EMAIL PROTECTED] | | http://www.gnejs.net | |===================================| |Your mind is like an umbrella. | |It doesn't work unless you open it.| | /Frank Zappa | |===================================|
pgp00000.pgp
Description: PGP signature