I've gone through several posts as well as the wiki and still haven't been able to make this work.
It always gets to the point in the service deployment where it is doing the hibernate configuration and mapping and then fails with NoClassDefFoundError on net.sf.hibernate.collection.List.
I checked and the class is definately in the hibernate2.jar. This seems incredibly strange to me since jboss is finding other classes in the jar before it fails on List.
Here is the stack trace .... details on my deployment follow the trace.
Code:
11:21:27,014 INFO [STDOUT] 11:21:27,014 INFO [HibernateServiceMBean] starting
service at JNDI name: java:/FolderPMFactory
11:21:27,014 INFO [STDOUT] 11:21:27,014 INFO [HibernateServiceMBean] service p
roperties: {hibernate.session_factory_name=java:/FolderPMFactory, hibernate.tran
saction.manager_lookup_class=net.sf.hibernate.transaction.JBossTransactionManage
rLookup, hibernate.dialect=hibernate.dialect net.sf.hibernate.dialect.TeradataDi
alect, hibernate.show_sql=true, hibernate.use_outer_join=false, hibernate.transa
ction.factory_class=net.sf.hibernate.transaction.JTATransactionFactory, hibernat
e.connection.datasource=java:/TeradataDS, jta.UserTransaction=UserTransaction}
11:21:27,084 INFO [STDOUT] 11:21:27,084 INFO [Environment] Hibernate 2.1 beta
5
11:21:27,104 INFO [STDOUT] 11:21:27,104 INFO [Environment] hibernate.propertie
s not found
11:21:27,114 INFO [STDOUT] 11:21:27,114 INFO [Environment] using CGLIB reflect
ion optimizer
11:21:27,124 INFO [STDOUT] 11:21:27,124 INFO [Configuration] Mapping resource:
mappings/Folder.hbm.xml
11:21:27,585 INFO [STDOUT] 11:21:27,585 INFO [Binder] Mapping class: com.terad
ata.tap.folder.domain.Folder -> IOS_FLDRS
11:21:27,875 WARN [ServiceController] Problem starting service jboss.jca:servic
e=HibernateFactory, name=HibernateFactory
java.lang.NoClassDefFoundError: net/sf/hibernate/collection/List
at net.sf.hibernate.type.TypeFactory.list(TypeFactory.java:186)
at net.sf.hibernate.mapping.List.getType(List.java:18)
at net.sf.hibernate.mapping.CollectionValue.getType(CollectionValue.java
:23)
at net.sf.hibernate.cfg.Binder.bindProperty(Binder.java:382)
at net.sf.hibernate.cfg.Binder.createProperty(Binder.java:968)
at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:949)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:312)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1146)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:243)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:
266)
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:289
)
at net.sf.hibernate.jmx.HibernateService.buildSessionFactory(HibernateSe
rvice.java:160)
at net.sf.hibernate.jmx.HibernateService.start(HibernateService.java:131
)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
nDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
ler.java:976)
at $Proxy12.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:394)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
nDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
at $Proxy4.start(Unknown Source)
at org.jboss.deployment.SARDeployer.start(SARDeployer.java:226)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:824)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:816)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:632)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:605)
at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
nDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
at $Proxy6.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymen
tScanner.java:302)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentS
canner.java:476)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
doScan(AbstractDeploymentScanner.java:201)
at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(A
bstractDeploymentScanner.java:274)
at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:1
92)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
nDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
ler.java:976)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:394)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
nDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
at $Proxy4.start(Unknown Source)
at org.jboss.deployment.SARDeployer.start(SARDeployer.java:226)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:824)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:632)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:605)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:589)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
nDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
at $Proxy5.deploy(Unknown Source)
at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:384)
at org.jboss.system.server.ServerImpl.start(ServerImpl.java:291)
at org.jboss.Main.boot(Main.java:150)
at org.jboss.Main$1.run(Main.java:388)
at java.lang.Thread.run(Thread.java:534)
My ideal deployment looks like the following. I thought the problem might have been caused by the sar being in the ear so I have also tried placing it outside of the ear. The same problem occured.
Code:
folder.ear
\META-INF
application.xml -- includes all of the necessary jars
\folder-ejb.jar -- session beans and persistent classes
\folder.sar
\mappings --- contains mapping files
\META-INF
jboss-service.xml
\lib
hibernate2.jar and other jars required by hibernate including jdbc driver
folder.ear\META-INF\application.xml
Code:
<application>
<display-name>folder</display-name>
<module><java>lib/hibernate2.jar</java></module>
<module><java>lib/TeradataDialect.jar</java></module>
<module><java>lib/dom4j.jar</java></module>
<module><java>lib/commons-collections.jar</java></module>
<module><java>lib/commons-logging.jar</java></module>
<module><java>lib/commons-lang.jar</java></module>
<module><java>lib/cglib-asm.jar</java></module>
<module><java>lib/terajdbc4.jar</java></module>
<module><ejb>folder-ejb.jar</ejb></module>
</application>
folder.ear\META-INF\jboss-app.xml
Code:
<jboss-app>
<loader-repository>com.teradata.crm.folder.loader:loader=folder-ejb.ear</loader-repository>
<module>
<service>folder-ejb.sar</service>
</module>
</jboss-app>
folder.ear\folder.sar\META-INF\jboss-service.xml
Code:
<server>
<classpath codebase="." archives="lib/cglib-asm.jar, lib/commons-beanutils.jar,
lib/commons-collections.jar, lib/commons-logging.jar, lib/commons-lang.jar,
lib/dom4j.jar, lib/TeradataDialect.jar, lib/terajdbc4.jar, lib/tdgssjava.jar,
lib/hibernate2.jar, folder-ejb.jar"/>
<mbean code="net.sf.hibernate.jmx.HibernateService" name="jboss.jca:service=HibernateFactory,name=HibernateFactory">
<depends>jboss.jca:service=RARDeployer</depends>
<depends>jboss.jca:service=LocalTxCM,name=TeradataDS</depends>
<!-- Make it deploy ONLY after DataSource had been started -->
<attribute name="MapResources">mappings/Folder.hbm.xml, mappings/FolderItem.hbm.xml</attribute>
<attribute name="JndiName">java:/FolderPMFactory</attribute>
<attribute name="Datasource">java:/TeradataDS</attribute>
<attribute name="Dialect">hibernate.dialect net.sf.hibernate.dialect.TeradataDialect</attribute>
<attribute name="UseOuterJoin">false</attribute>
<attribute name="ShowSql">true</attribute>
<attribute name="TransactionStrategy">net.sf.hibernate.transaction.JTATransactionFactory</attribute>
<attribute name="TransactionManagerLookupStrategy">net.sf.hibernate.transaction.JBossTransactionManagerLookup</attribute>
<attribute name="UserTransactionName">UserTransaction</attribute>
</mbean>
</server>
I'm about ready to pull all of my hair out because of this so any help would be greatly appreciated.
Thanks,
Marc