-->
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.  [ 9 posts ] 
Author Message
 Post subject: sessionfactory error: component class not found
PostPosted: Mon Oct 10, 2005 6:42 am 
Newbie

Joined: Tue Jul 12, 2005 9:04 am
Posts: 4
1. Hibernate Configurations panel in Hibernate Console for Eclipse 3.1 shows an error for classes which represent composite-id: org.hibernate.MappingException: component class not found: src.org.reveng.OrderstatusId
These classes are found in source and classes in classpath of the project. The jdk for project and ant are jdk1.5. All other mapping are ok and shown in hoibernate configurations panel.

2. HQL button on Hibernate configurations is disabled.

Any assistance would be greatly appreciated.
Hertzel

ERROR LOG FOR (1):
!SUBENTRY 2 org.hibernate.eclipse.console 4 150 2005-10-10 04:56:11.468
!MESSAGE component class not found: src.org.reveng.OrderstatusId
!STACK 0
org.hibernate.MappingException: component class not found: src.org.reveng.OrderstatusId
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:40)
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:957)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1121)
at org.hibernate.console.ConsoleConfiguration$2.execute(Unknown Source)
at org.hibernate.console.execution.DefaultExecutionContext.execute(Unknown Source)
at org.hibernate.console.ConsoleConfiguration.execute(Unknown Source)
at org.hibernate.console.ConsoleConfiguration.buildSessionFactory(Unknown Source)
at org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(Unknown Source)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(Unknown Source)
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: src.org.reveng.OrderstatusId
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:403)
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 2 org.hibernate.eclipse.console 4 150 2005-10-10 04:56:11.468
!MESSAGE src.org.reveng.OrderstatusId
!STACK 0
java.lang.ClassNotFoundException: src.org.reveng.OrderstatusId
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:403)
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:40)
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:957)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1121)
at org.hibernate.console.ConsoleConfiguration$2.execute(Unknown Source)
at org.hibernate.console.execution.DefaultExecutionContext.execute(Unknown Source)
at org.hibernate.console.ConsoleConfiguration.execute(Unknown Source)
at org.hibernate.console.ConsoleConfiguration.buildSessionFactory(Unknown Source)
at org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(Unknown Source)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(Unknown Source)
at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:192)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 10, 2005 1:39 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
is there a configuration file somewhere w/ src.org.reveng.OrderstatusId ? it appears your src directory has been pushed in there.


Top
 Profile  
 
 Post subject: sessionfactory error: component class not found
PostPosted: Mon Oct 10, 2005 2:10 pm 
Newbie

Joined: Tue Jul 12, 2005 9:04 am
Posts: 4
Thank you for your reply.
What you mean by a configuration file?
The package src.org.reveng has been created by reverse engineering tool of hibernate-tools exactly as instructed by hibernate documentation.
The tool created the classes and mapping files on this package. Hobernate configuration shows: configuration, <Sessionfactory error: component class not found: src.org.reveng.OrderStatusId, Database in its tree. All the classes have been created and compiled successfully and are in classpath (Including classes representing composite-Ids). Just the "composite-Id" classes "not found by hibernate configuration".
Hertzel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 10, 2005 2:46 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
H is looking for a class called src.org.reveng.OrderStatusId . usually, we name classes org.reveng.OrderStatusId, which would go in a directory called src .


Top
 Profile  
 
 Post subject: sessionfactory error: component class not found
PostPosted: Mon Oct 10, 2005 3:52 pm 
Newbie

Joined: Tue Jul 12, 2005 9:04 am
Posts: 4
It's just a "ugly" package name i have got i reverse engineering process.!Alll the classes and mappings have been created and compiled successfully. following is the source code for java and mappings:
Please your assistance again.
Thanks in advance
Hertzel

OrderstatusId.java
package src.org.reveng;
import java.util.*;
/**
* OrderstatusId generated by hbm2java
*/
public class OrderstatusId implements java.io.Serializable {
// Fields
private Integer orderid;
private Integer linenum;
// Constructors
/** default constructor */
public OrderstatusId() {
}
// Property accessors
public Integer getOrderid() {
return this.orderid;
}
public void setOrderid(Integer orderid) {
this.orderid = orderid;
}
public Integer getLinenum() {
return this.linenum;
}
public void setLinenum(Integer linenum) {
this.linenum = linenum;
}
public boolean equals(Object other) {
if ( (this == other ) ) return true;
if ( (other == null ) ) return false;
if ( !(other instanceof OrderstatusId) ) return false;
OrderstatusId castOther = ( OrderstatusId ) other;
return ( (this.getOrderid()==castOther.getOrderid()) || ( this.getOrderid()!=null && castOther.getOrderid()!=null && this.getOrderid().equals(castOther.getOrderid()) ) )
&& ( (this.getLinenum()==castOther.getLinenum()) || ( this.getLinenum()!=null && castOther.getLinenum()!=null && this.getLinenum().equals(castOther.getLinenum()) ) );
}
public int hashCode() {
int result = 17;
result = 37 * result + ( getOrderid() == null ? 0 : this.getOrderid().hashCode() );
result = 37 * result + ( getLinenum() == null ? 0 : this.getLinenum().hashCode() );
return result;
}
}

Orderstatus.java
package src.org.reveng;
import java.util.*;
/**
* Orderstatus generated by hbm2java
*/
public class Orderstatus implements java.io.Serializable {
// Fields
private OrderstatusId id;
private Date timestamp;
private String status;
// Constructors
/** default constructor */
public Orderstatus() {
}
/** constructor with id */
public Orderstatus(OrderstatusId id) {
this.id = id;
}
// Property accessors
public OrderstatusId getId() {
return this.id;
}
public void setId(OrderstatusId id) {
this.id = id;
}
public Date getTimestamp() {
return this.timestamp;
}
public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
}
public String getStatus() {
return this.status;
}
public void setStatus(String status) {
this.status = status;
}
Orderstatus.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<!--
Auto-generated mapping file from
the hibernate.org cfg2hbm engine
-->
<class name="src.org.reveng.Orderstatus" table="orderstatus" catalog="mypetstore">
<composite-id name="id" class="src.org.reveng.OrderstatusId">
<key-property name="orderid" type="integer">
<column name="orderid" />
</key-property>
<key-property name="linenum" type="integer">
<column name="linenum" />
</key-property>
</composite-id>
<property name="timestamp" type="date">
<column name="timestamp" length="10" not-null="true" />
</property>
<property name="status" type="string">
<column name="status" length="2" not-null="true" />
</property>
</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 10, 2005 4:02 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
well, it looks like it's there. but at the end of the day, it just isn't in the classpath .


Top
 Profile  
 
 Post subject: sessionfactory error: component class not found
PostPosted: Mon Oct 10, 2005 4:17 pm 
Newbie

Joined: Tue Jul 12, 2005 9:04 am
Posts: 4
But as i said before all (persistent) classes are shown in configuration and the classpath contains the classes dir in the project (in eclipse).
I have not found any option to configure the hibernate classpath beside the regular eclipse classpath.
Any suggestions?
Thanks
Hertzel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 04, 2006 10:43 am 
Beginner
Beginner

Joined: Thu Dec 11, 2003 12:02 pm
Posts: 23
I have the same problem with the plug-in. It seems if you reverse engineer without a package name ... then everything works fine. If you add a package name you get:

Sessionfactory error: component class not found: XXXId

Has anyone found a solution for this yet?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 04, 2006 11:53 am 
Beginner
Beginner

Joined: Thu Dec 11, 2003 12:02 pm
Posts: 23
The problem was it couldn't find the class because i had a problem with my build path. The problem with the build path prevented compilation -- hence
no .class files, only .java files. Hence hibernate could not find the '.class' along the classpath.


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