-->
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.  [ 7 posts ] 
Author Message
 Post subject: ClassNotFound for <composite-id> class
PostPosted: Wed Feb 08, 2006 4:39 pm 
Newbie

Joined: Wed Feb 08, 2006 3:57 pm
Posts: 16
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.1.2
Eclipse 3.1
Hibernate tools 3.1.0b4

Mapping documents:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Feb 8, 2006 12:50:53 PM by Hibernate Tools 3.1.0.beta4 -->
<hibernate-mapping package="lipman.ncc.hibernate">
    <class name="Rconsist" table="RCONSIST" schema="LIPADMIN" catalog="LIP7">
        <composite-id name="id" class="RconsistId">
            <key-property name="reportid" type="double">
                <column name="REPORTID" precision="53" scale="0" />
            </key-property>
            <key-property name="dbname" type="string">
                <column name="DBNAME" length="6" />
            </key-property>
            <key-property name="lookupid" type="double">
                <column name="LOOKUPID" precision="53" scale="0" />
            </key-property>
        </composite-id>
        <property name="columnorder" type="java.lang.Double">
            <column name="COLUMNORDER" precision="53" scale="0" />
        </property>
        <property name="columnwidth" type="java.lang.Double">
            <column name="COLUMNWIDTH" precision="53" scale="0" />
        </property>
        <property name="sortedcolumn" type="java.lang.Double">
            <column name="SORTEDCOLUMN" precision="53" scale="0" />
        </property>
        <property name="value" type="string">
            <column name="VALUE" length="140" />
        </property>
    </class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:
This is the log of Eclipse:
Code:
ENTRY org.hibernate.eclipse 1 20000 2006-02-08 15:21:32.154
!MESSAGE INFO Worker-22 org.hibernate.cfg.Configuration - configuring from file: mssql-local-ncc.cfg.xml

!ENTRY org.hibernate.eclipse 1 20000 2006-02-08 15:21:32.154
!MESSAGE INFO Worker-22 org.hibernate.cfg.Configuration - Configured SessionFactory: null

!ENTRY org.hibernate.eclipse 1 20000 2006-02-08 15:21:32.170
!MESSAGE INFO Worker-22 org.hibernate.cfg.Configuration - Reading mappings from file: C:\work\eclipse\ncchib\lipman\ncc\hibernate\Applic1.hbm.xml

!ENTRY org.hibernate.eclipse 1 20000 2006-02-08 15:21:32.201
!MESSAGE INFO Worker-22 org.hibernate.cfg.HbmBinder - Mapping class: lipman.ncc.hibernate.Applic1 -> APPLIC1

!ENTRY org.hibernate.eclipse 1 20000 2006-02-08 15:21:32.217
!MESSAGE INFO Worker-22 org.hibernate.cfg.Configuration - Reading mappings from file: C:\work\eclipse\ncchib\lipman\ncc\hibernate\Blacklst.hbm.xml

!ENTRY org.hibernate.eclipse 1 20000 2006-02-08 15:21:32.232
!MESSAGE INFO Worker-22 org.hibernate.cfg.HbmBinder - Mapping class: lipman.ncc.hibernate.Blacklst -> BLACKLST

<...skipped...>

!ENTRY org.hibernate.eclipse 1 20000 2006-02-08 15:21:33.279
!MESSAGE INFO Worker-22 org.hibernate.cfg.Configuration - Reading mappings from file: C:\work\eclipse\ncchib\lipman\ncc\hibernate\Userlst.hbm.xml

!ENTRY org.hibernate.eclipse 1 20000 2006-02-08 15:21:33.295
!MESSAGE INFO Worker-22 org.hibernate.cfg.HbmBinder - Mapping class: lipman.ncc.hibernate.Userlst -> USERLST_

!ENTRY org.hibernate.eclipse 1 20000 2006-02-08 15:21:33.295
!MESSAGE INFO Worker-22 org.hibernate.cfg.Configuration - Reading mappings from file: C:\work\eclipse\ncchib\lipman\ncc\hibernate\Rconsist.hbm.xml

!ENTRY org.hibernate.eclipse 1 20000 2006-02-08 15:21:33.326
!MESSAGE INFO Worker-22 org.hibernate.cfg.HbmBinder - Mapping class: lipman.ncc.hibernate.Rconsist -> RCONSIST

!ENTRY org.hibernate.eclipse.console 4 4 2006-02-08 15:21:33.326
!MESSAGE Problems while creating sessionfactory
!STACK 0
org.hibernate.MappingException: component class not found: lipman.ncc.hibernate.RconsistId
   at org.hibernate.mapping.Component.getComponentClass(Component.java:105)
   at org.hibernate.tuple.PojoComponentTuplizer.buildGetter(PojoComponentTuplizer.java:140)
   at org.hibernate.tuple.AbstractComponentTuplizer.<init>(AbstractComponentTuplizer.java:79)
   at org.hibernate.tuple.PojoComponentTuplizer.<init>(PojoComponentTuplizer.java:33)
   at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:126)
   at org.hibernate.mapping.Component.getType(Component.java:160)
   at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
   at org.hibernate.mapping.RootClass.validate(RootClass.java:193)
   at org.hibernate.cfg.Configuration.validate(Configuration.java:984)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1169)
   at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:265)
   at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
   at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:68)
   at org.hibernate.console.ConsoleConfiguration.buildSessionFactory(ConsoleConfiguration.java:260)
   at org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(ConsoleConfigurationWorkbenchAdapter.java:24)
   at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:70)
   at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:192)
   at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)
Caused by: java.lang.ClassNotFoundException: lipman.ncc.hibernate.RconsistId
   at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:405)
   at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:350)
   at org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader.loadClass(AbstractClassLoader.java:78)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClassInternal(Unknown Source)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Unknown Source)
   at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108)
   at org.hibernate.mapping.Component.getComponentClass(Component.java:102)
   ... 17 more
!SUBENTRY 1 org.hibernate.eclipse.console 4 150 2006-02-08 15:21:33.326
!MESSAGE java.lang.ClassNotFoundException: lipman.ncc.hibernate.RconsistId
!STACK 0
java.lang.ClassNotFoundException: lipman.ncc.hibernate.RconsistId
   at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:405)
   at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:350)
   at org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader.loadClass(AbstractClassLoader.java:78)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClassInternal(Unknown Source)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Unknown Source)
   at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108)
   at org.hibernate.mapping.Component.getComponentClass(Component.java:102)
   at org.hibernate.tuple.PojoComponentTuplizer.buildGetter(PojoComponentTuplizer.java:140)
   at org.hibernate.tuple.AbstractComponentTuplizer.<init>(AbstractComponentTuplizer.java:79)
   at org.hibernate.tuple.PojoComponentTuplizer.<init>(PojoComponentTuplizer.java:33)
   at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:126)
   at org.hibernate.mapping.Component.getType(Component.java:160)
   at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
   at org.hibernate.mapping.RootClass.validate(RootClass.java:193)
   at org.hibernate.cfg.Configuration.validate(Configuration.java:984)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1169)
   at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:265)
   at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
   at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:68)
   at org.hibernate.console.ConsoleConfiguration.buildSessionFactory(ConsoleConfiguration.java:260)
   at org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(ConsoleConfigurationWorkbenchAdapter.java:24)
   at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:70)
   at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:192)
   at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)
!SUBENTRY 2 org.hibernate.eclipse.console 4 150 2006-02-08 15:21:33.326
!MESSAGE java.lang.ClassNotFoundException: lipman.ncc.hibernate.RconsistId
!STACK 0
java.lang.ClassNotFoundException: lipman.ncc.hibernate.RconsistId
   at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:405)
   at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:350)
   at org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader.loadClass(AbstractClassLoader.java:78)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClassInternal(Unknown Source)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Unknown Source)
   at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108)
   at org.hibernate.mapping.Component.getComponentClass(Component.java:102)
   at org.hibernate.tuple.PojoComponentTuplizer.buildGetter(PojoComponentTuplizer.java:140)
   at org.hibernate.tuple.AbstractComponentTuplizer.<init>(AbstractComponentTuplizer.java:79)
   at org.hibernate.tuple.PojoComponentTuplizer.<init>(PojoComponentTuplizer.java:33)
   at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:126)
   at org.hibernate.mapping.Component.getType(Component.java:160)
   at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
   at org.hibernate.mapping.RootClass.validate(RootClass.java:193)
   at org.hibernate.cfg.Configuration.validate(Configuration.java:984)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1169)
   at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:265)
   at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
   at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:68)
   at org.hibernate.console.ConsoleConfiguration.buildSessionFactory(ConsoleConfiguration.java:260)
   at org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(ConsoleConfigurationWorkbenchAdapter.java:24)
   at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:70)
   at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:192)
   at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)


Name and version of the database you are using: MSDE with Microsoft JDBC

The package lipman.ncc.hibernate.RconsistId exists, compiled and persists in the same place as the other classfiles.

This error occurs when I try to create Session from IDE.

Notes.
1. When I add ncchib project as classpath to console it causes a NullPointerException(no message)
2. When I export .class files to jar and add this jar to classpath the exception is
Code:
!ENTRY org.hibernate.eclipse 1 20000 2006-02-08 15:35:00.478
!MESSAGE INFO main org.hibernate.impl.SessionFactoryImpl - building session factory

!ENTRY org.eclipse.ui 4 4 2006-02-08 15:35:00.790
!MESSAGE Unhandled event loop exception

!ENTRY org.eclipse.ui 4 0 2006-02-08 15:35:00.790
!MESSAGE org.hibernate.type.StringType
!STACK 0
java.lang.ClassCastException: org.hibernate.type.StringType
   at org.hibernate.tuple.PropertyFactory.buildVersionProperty(PropertyFactory.java:83)
   at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:157)
   at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:412)
   at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:108)
   at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
   at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:215)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
   at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:265)
   at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
   at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:68)
   at org.hibernate.console.ConsoleConfiguration.buildSessionFactory(ConsoleConfiguration.java:260)
   at org.hibernate.eclipse.console.actions.BuildSessionFactoryAction.doRun(BuildSessionFactoryAction.java:38)
   at org.hibernate.eclipse.console.actions.ConsoleConfigurationBasedAction.run(ConsoleConfigurationBasedAction.java:46)
   at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:167)
   at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:538)
   at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
   at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400)
   at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
   at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3080)
   at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2713)
   at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699)
   at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
   at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367)
   at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
   at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
   at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334)
   at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
   at org.eclipse.core.launcher.Main.run(Main.java:973)
   at org.eclipse.core.launcher.Main.main(Main.java:948)


What's wrong?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 08, 2006 7:04 pm 
Regular
Regular

Joined: Sat Nov 06, 2004 5:20 pm
Posts: 54
Location: Collierville, TN
Quote:
1. When I add ncchib project as classpath to console it causes a NullPointerException(no message)

Add the directory location of your compiled .class files to the console - not the project.

Just in case: add the location of your db driver in the console too.

Hope this helps.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 09, 2006 10:52 am 
Newbie

Joined: Wed Feb 08, 2006 3:57 pm
Posts: 16
Yes, it helps to move forward.
But looks like I cannot add the directory from Eclipse, the only way is to close Eclipse and edit console.xml manually.
Am I right?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 6:35 pm 
Regular
Regular

Joined: Sat Nov 06, 2004 5:20 pm
Posts: 54
Location: Collierville, TN
Editing the console.xml manually sounds painful :-)...

If you're in the Hibernate Console view, you can create or edit an existing configuration. Either case, you'll get the "Create Hibernate Console Configuration" dialog box.

Near the bottom half click button labeled "Add Jar/Dir...". From here you can add what you need to the classpath.

Hope this helps.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 6:40 pm 
Newbie

Joined: Wed Feb 08, 2006 3:57 pm
Posts: 16
Yes, but what I see in the tree view is projects tree, not file one.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 6:50 pm 
Regular
Regular

Joined: Sat Nov 06, 2004 5:20 pm
Posts: 54
Location: Collierville, TN
Click the + sign next to the project you're referencing, then navigate to the directory you need and click OK.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 6:55 pm 
Newbie

Joined: Wed Feb 08, 2006 3:57 pm
Posts: 16
It doesn't work this way.
it only works when I change console.xml manually.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.