These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: ClassNotFoundException when building session factory.
PostPosted: Wed Apr 18, 2007 10:04 am 
Newbie

Joined: Mon Apr 16, 2007 12:43 pm
Posts: 2
I'm using hibernate3 and Jboss 4.2 and I get the following stack trace:

Code:
2007-04-18 14:57:07,100 INFO  [org.hibernate.impl.SessionFactoryImpl] building session factory
2007-04-18 14:57:07,100 DEBUG [org.hibernate.impl.SessionFactoryImpl] Session factory constructed with filter configurations : {}
2007-04-18 14:57:07,100 DEBUG [org.hibernate.impl.SessionFactoryImpl] instantiating session factory with properties: {java.vendor=Sun Microsystems Inc., catalina.base=C:\jboss-4.0.2\server\default, sun.management.compiler=HotSpot Client Compiler, catalina.useNaming=false, hibernate.transaction.flush_before_completion=true, os.name=Windows XP, sun.boot.class.path=C:\jboss-4.0.2\bin\\..\lib\endorsed\resolver.jar;C:\jboss-4.0.2\bin\\..\lib\endorsed\xalan.jar;C:\jboss-4.0.2\bin\\..\lib\endorsed\xercesImpl.jar;C:\jboss-4.0.2\bin\\..\lib\endorsed\xml-apis.jar;C:\java\jdk1.5.0_09\jre\lib\rt.jar;C:\java\jdk1.5.0_09\jre\lib\i18n.jar;C:\java\jdk1.5.0_09\jre\lib\sunrsasign.jar;C:\java\jdk1.5.0_09\jre\lib\jsse.jar;C:\java\jdk1.5.0_09\jre\lib\jce.jar;C:\java\jdk1.5.0_09\jre\lib\charsets.jar;C:\java\jdk1.5.0_09\jre\classes, hibernate.connection.agressive_release=true, sun.desktop=windows, java.vm.specification.vendor=Sun Microsystems Inc., java.runtime.version=1.5.0_09-b01, hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider, user.name=LONLWM, shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar, jboss.bind.address=0.0.0.0, tomcat.util.buf.StringCache.byte.enabled=true, jboss.home.dir=C:\jboss-4.0.2, user.language=en, java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, sun.boot.library.path=C:\java\jdk1.5.0_09\jre\bin, jboss.home.url=file:/C:/jboss-4.0.2/, java.version=1.5.0_09, user.timezone=Europe/London, jboss.server.home.dir=C:\jboss-4.0.2\server\default, sun.arch.data.model=32, java.endorsed.dirs=C:\jboss-4.0.2\bin\\..\lib\endorsed, jboss.server.home.url=file:/C:/jboss-4.0.2/server/default/, sun.cpu.isalist=pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86, sun.jnu.encoding=Cp1252, file.encoding.pkg=sun.io, package.access=sun.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper.,sun.beans., file.separator=\, java.specification.name=Java Platform API Specification, hibernate.cglib.use_reflection_optimizer=true, java.class.version=49.0, jboss.server.config.url=file:/C:/jboss-4.0.2/server/default/conf/, user.country=GB, java.home=C:\java\jdk1.5.0_09\jre, java.vm.info=mixed mode, jboss.lib.url=file:/C:/jboss-4.0.2/lib/, os.version=5.1, hibernate.connection.datasource=java:/MSSQLDS, hibernate.transaction.factory_class=org.hibernate.transaction.JTATransactionFactory, path.separator=;, java.vm.version=1.5.0_09-b01, user.variant=, java.protocol.handler.pkgs=org.jboss.net.protocol, java.awt.printerjob=sun.awt.windows.WPrinterJob, sun.io.unicode.encoding=UnicodeLittle, awt.toolkit=sun.awt.windows.WToolkit, package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper., jboss.server.temp.dir=C:\jboss-4.0.2\server\default\tmp, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces, user.home=C:\Documents and Settings\LONLWM, java.rmi.server.RMIClassLoaderSpi=org.jboss.system.JBossRMIClassLoader, java.specification.vendor=Sun Microsystems Inc., java.library.path=C:\java\jdk1.5.0_09\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\PHP\;C:\oracle\product\10.2.0\client_1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Intel\Wireless\Bin\;C:\Program Files\ATI Technologies\ATI.ACE\;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;C:\Program Files\Common Files\Adobe\AGL;C:\Sun\AppServer\bin, java.vendor.url=http://java.sun.com/, program.name=run.bat, java.vm.vendor=Sun Microsystems Inc., hibernate.dialect=org.hibernate.dialect.SQLServerDialect, common.loader=${catalina.home}/common/classes,${catalina.home}/common/i18n/*.jar,${catalina.home}/common/endorsed/*.jar,${catalina.home}/common/lib/*.jar, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, java.class.path=C:\java\jdk1.5.0_09\lib\tools.jar;C:\jboss-4.0.2\bin\\run.jar, hibernate.transaction.auto_close_session=true, jbossmx.loader.repository.class=org.jboss.mx.loading.UnifiedLoaderRepository3, java.vm.specification.name=Java Virtual Machine Specification, java.vm.specification.version=1.0, catalina.home=C:\jboss-4.0.2\server\default, sun.cpu.endian=little, sun.os.patch.level=Service Pack 2, jboss.server.lib.url=file:/C:/jboss-4.0.2/server/default/lib/, java.rmi.server.codebase=http://LONLWM-T60XP:8083/, java.io.tmpdir=C:\DOCUME~1\LONLWM\LOCALS~1\Temp\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, server.loader=${catalina.home}/server/classes,${catalina.home}/server/lib/*.jar, jboss.server.data.dir=C:\jboss-4.0.2\server\default\data, os.arch=x86, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.ext.dirs=C:\java\jdk1.5.0_09\jre\lib\ext, user.dir=C:\jboss-4.0.2\bin, line.separator=
, java.vm.name=Java HotSpot(TM) Client VM, jboss.server.base.dir=C:\jboss-4.0.2\server, jboss.server.base.url=file:/C:/jboss-4.0.2/server/, javax.management.builder.initial=org.jboss.mx.server.MBeanServerBuilderImpl, file.encoding=Cp1252, catalina.ext.dirs=C:\jboss-4.0.2\server\default\lib, hibernate.transaction.manager_lookup_class=org.hibernate.transaction.JBossTransactionManagerLookup, java.specification.version=1.5, jboss.server.name=default}
2007-04-18 14:57:07,428 ERROR [org.jboss.hibernate.jmx.Hibernate] Starting failed jboss.har:service=Hibernate
org.hibernate.MappingException: entity class not found: com.mycompany.mds.iHub.data.orm.OutcomeMediaResources
   at org.hibernate.mapping.PersistentClass.getMappedClass(PersistentClass.java:89)
   at org.hibernate.tuple.PropertyFactory.getGetter(PropertyFactory.java:160)
   at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:42)
   at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:107)
   at org.hibernate.persister.entity.BasicEntityPersister.<init>(BasicEntityPersister.java:400)
   at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:104)
   at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
   at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:209)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1055)
   at org.jboss.hibernate.jmx.Hibernate.buildSessionFactory(Hibernate.java:611)
   at org.jboss.hibernate.jmx.Hibernate.startService(Hibernate.java:578)
   at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:272)
   at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:222)
   at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
   at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
   at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
   at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
   at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)

.....

Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: com.mycompany.mds.iHub.data.orm.OutcomeMediaResources
   at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:198)
   at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:475)
   at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:377)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
   at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Class.java:164)
   at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108)
   at org.hibernate.mapping.PersistentClass.getMappedClass(PersistentClass.java:86)


My files are all in a har which appears to startup fine until the session factory building. All the mappings taking place ok like this:

Code:

2007-04-18 14:57:06,459 DEBUG [org.hibernate.cfg.HbmBinder] Second pass for collection: com.paconsulting.mds.iHub.data.orm.AdminUsers.configurationSettingses
2007-04-18 14:57:06,459 INFO  [org.hibernate.cfg.HbmBinder] Mapping collection: com.paconsulting.mds.iHub.data.orm.AdminUsers.configurationSettingses -> configurationSettings
2007-04-18 14:57:06,459 DEBUG [org.hibernate.cfg.HbmBinder] Mapped collection key: lastUpdatedBy, one-to-many: com.paconsulting.mds.iHub.data.orm.ConfigurationSettings
2007-04-18 14:57:06,475 DEBUG [org.hibernate.cfg.HbmBinder] Second pass for collection: com.paconsulting.mds.iHub.data.orm.AdminUsers.configurationSettingses_1
2007-04-18 14:57:06,475 INFO  [org.hibernate.cfg.HbmBinder] Mapping collection: com.paconsulting.mds.iHub.data.orm.AdminUsers.configurationSettingses_1 -> configurationSettings
2007-04-18 14:57:06,475 DEBUG [org.hibernate.cfg.HbmBinder] Mapped collection key: lastUpdatedBy, one-to-many: com.paconsulting.mds.iHub.data.orm.ConfigurationSettings


Any ideas? It's really bugging me now!

[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 18, 2007 10:15 am 
Regular
Regular

Joined: Mon Jun 12, 2006 5:33 am
Posts: 63
hi JerryJerryJerry,
where do you specify your session factory to access the .hbm.xml mapping files?
Another approach should be to use a 'normal' hibernate.cfg.xml file in the root of your classpath.
In that hibernate.cfg.xml you could specify your datasource, the dialect and the location of your .hbm.xml files. Hope this helps

chucky

Don't forget to rate if this helps
-----------------------------


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 18, 2007 10:30 am 
Newbie

Joined: Mon Apr 16, 2007 12:43 pm
Posts: 2
Thanks for the quick reply. In my har file there's an mbean declared. I don't want to use the hibernate.cfg.xml as I want jboss to provide the sessionfactory.

Code:
<server>
   <mbean code="org.jboss.hibernate.jmx.Hibernate" name="jboss.har:service=Hibernate">
      <depends>jboss:service=Naming</depends>
        <depends>jboss:service=TransactionManager</depends>
      <attribute name="SessionFactoryName">java:/hibernate/SessionFactory</attribute>
      <attribute name="DatasourceName">java:/MSSQLDS</attribute>
      <attribute name="Dialect">org.hibernate.dialect.SQLServerDialect</attribute>
   </mbean>
</server>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.