When I configure the Hibernate mbean service, I get a weird problem about missing dependency class.
I added the following to $server/conf/jboss-service.xml:
jboss.jca:service=RARDeployer
jboss.jca:name=DefaultDS, service=LocalTxCM
test/web/project/beans/Event.hbm.xml, test/web/project/beans/User.hbm.xml
java:/hibernate/HibernateFactory
java:PostgresDS
net.sf.hibernate.dialect.PostgreSQLDialect
net.sf.hibernate.transaction.JTATransactionFactory
net.sf.hibernate.transaction.JBossTransactionManagerLookup
UserTransaction
When I start up JBoss, it would complain about missing class file:
.....
Caused by: java.lang.reflect.UndeclaredThrowableException
at org.jboss.system.ServiceCreator.install(ServiceCreator.java:204)
at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:149)
at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:114)
... 36 more
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at net.sf.hibernate.jmx.HibernateService.(HibernateService.java:30)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:1212)
at org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:269)
at org.jboss.mx.server.MBeanServerImpl.createMBean(MBeanServerImpl.java:327)
at org.jboss.system.ServiceCreator.install(ServiceCreator.java:125)
... 38 more
I can only solve this problem by copying the files commons-logging.jar
and log4j.jar to $server/lib. This does not make sense, these two packages are used by almost all components in JBoss, and it didn't complain about it, until I configure the Hibernate mbean.
What's wrong with this?