-->
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.  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Could not read mappings from resource Error
PostPosted: Mon Sep 04, 2006 7:47 am 
Beginner
Beginner

Joined: Mon Sep 04, 2006 7:18 am
Posts: 45
Hello all. I am using
Hibernate version: 3.1 with Eclipse 3.2
This is my package:

This is my project:
$project/src/no/detnye/moteguiden/hibernate.cfg.xml
$project/src/no/detnye/moteguiden/hibernate.properties

$project/src/no/detnye/moteguiden/hibernate/HibernateUtil.java
(The same from the tutorial)

$project/src/no/detnye/moteguiden/pojos/FargeData.java
$project/src/no/detnye/moteguiden/pojos/FargeData.hbm.xml

$project/bin/log4j.properties
$project/bin/hibernate.properties
These are the same as in my $project/src/no/detnye/moteguiden/ files, because I didn't know exactly where the configuration files should be

$project/bin/*.class (ALL java class files)

Mapping documents: FargeData.hbm.xml

Code:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
    <class
        name="no.detnye.moteguiden.model.FargeData"
        table="farge"
        lazy="false"
    >
        <cache usage="read-write" />

        <id name="id" column="id" type="java.lang.Integer">
            <generator class="increment" />
        </id>

        <property
            name="fargenavn"
            type="java.lang.String"
            update="true"
            insert="true"
            column="fargenavn"
            unique="true"
            not-null="true"
        />

        <set
            name="produktfarger"
            lazy="false"
            cascade="none"
            sort="unsorted"
        >

            <key column="fargeid">
            </key>

            <one-to-many
                  class="no.detnye.moteguiden.model.ProduktFargeData"
            />

        </set>
    </class>
</hibernate-mapping>


My Test class is as follows:
Code:
       Session session = HibernateUtil.getSessionFactory().getCurrentSession();
       assertNotNull(session);
        Criteria criteria = session.createCriteria(ForhandlerData.class);
      
      try {
         List forhandlerListe = criteria.list();
         
         for (int i = 0; i < forhandlerListe.size(); i++) {
            System.out.println("List contains: " + forhandlerListe.get(i));
         }
      } catch (Exception e) {
         e.printStackTrace();
      }

When I run this example I get the following exception:

Full stack trace of any exception that occurs:
13:15:44,668 ERROR XMLHelper:61 - Error parsing XML: XML InputStream(18) Element type "id" must be followed by either attribute specifications, ">" or "/>".
Could not initialize SessionFactory org.hibernate.MappingException: Could not read mappings from resource: no/detnye/moteguiden/pojos/ForhandlerData.hbm.xml SessionFactory is null


Name and version of the database you are using:
I am using MySQL


The generated SQL (show_sql=true):
13:15:43,943 INFO Environment:479 - Hibernate 3.1.3
13:15:43,975 INFO Environment:494 - loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=com.mysql.jdbc.Driver, hibernate.cglib.use_reflection_optimizer=true, hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider, hibernate.max_fetch_depth=1, hibernate.dialect=org.hibernate.dialect.MySQLMyISAMDialect, hibernate.jdbc.use_streams_for_binary=true, hibernate.format_sql=true, hibernate.query.substitutions=yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hibernate.connection.username=root, hibernate.cache.region_prefix=hibernate.test, hibernate.connection.url=jdbc:mysql:///moteguiden, hibernate.show_sql=true, hibernate.connection.password=****, hibernate.jdbc.batch_versioned_data=true, hibernate.connection.pool_size=1}
13:15:43,977 INFO Environment:524 - using java.io streams to persist binary types
13:15:43,978 INFO Environment:525 - using CGLIB reflection optimizer
13:15:43,982 INFO Environment:555 - using JDK 1.4 java.sql.Timestamp handling
13:15:44,132 INFO Configuration:1308 - configuring from resource: /hibernate.cfg.xml
13:15:44,132 INFO Configuration:1285 - Configuration resource: /hibernate.cfg.xml
13:15:44,357 DEBUG DTDEntityResolver:22 - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd]
13:15:44,360 DEBUG DTDEntityResolver:24 - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
13:15:44,361 DEBUG DTDEntityResolver:34 - located [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in classpath
13:15:44,429 DEBUG Configuration:1269 - show_sql=false
13:15:44,430 DEBUG Configuration:1269 - connection.datasource=java:comp/env/jdbc/moteguiden
13:15:44,432 DEBUG Configuration:1269 - dialect=org.hibernate.dialect.MySQLDialect
13:15:44,432 DEBUG Configuration:1269 - hibernate.connection.driver_class=org.gjt.mm.mysql.Driver
13:15:44,432 DEBUG Configuration:1269 - hibernate.connection.url=jdbc:mysql://localhost/moteguiden?user=root&password=
13:15:44,434 DEBUG Configuration:1269 - hibernate.connection.username=root
13:15:44,435 DEBUG Configuration:1269 - hibernate.connection.password=
13:15:44,435 DEBUG Configuration:1269 - hibernate.dialect=org.hibernate.dialect.MySQLDialect
13:15:44,436 DEBUG Configuration:1269 - hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
13:15:44,436 DEBUG Configuration:1269 - hibernate.generate_statistics=true
13:15:44,437 DEBUG Configuration:1269 - hibernate.cache.use_structured_entries=true
13:15:44,437 DEBUG Configuration:1464 - null<-org.dom4j.tree.DefaultAttribute@1506dc4 [Attribute: name resource value "no/detnye/moteguiden/pojos/FargeData.hbm.xml"]
13:15:44,438 INFO Configuration:469 - Reading mappings from resource: no/detnye/moteguiden/pojos/FargeData.hbm.xml
13:15:44,440 DEBUG DTDEntityResolver:22 - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
13:15:44,441 DEBUG DTDEntityResolver:24 - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
13:15:44,442 DEBUG DTDEntityResolver:34 - located [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath
13:15:44,593 INFO HbmBinder:309 - Mapping class: no.detnye.moteguiden.model.FargeData -> farge
13:15:44,603 DEBUG HbmBinder:1261 - Mapped property: id -> id
13:15:44,615 DEBUG HbmBinder:1261 - Mapped property: fargenavn -> fargenavn
13:15:44,620 DEBUG HbmBinder:1261 - Mapped property: produktfarger
13:15:44,621 DEBUG Configuration:1464 - null<-org.dom4j.tree.DefaultAttribute@b76fa [Attribute: name resource value "no/detnye/moteguiden/pojos/ForhandlerData.hbm.xml"]
13:15:44,623 INFO Configuration:469 - Reading mappings from resource: no/detnye/moteguiden/pojos/ForhandlerData.hbm.xml
13:15:44,624 DEBUG DTDEntityResolver:22 - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
13:15:44,625 DEBUG DTDEntityResolver:24 - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
13:15:44,626 DEBUG DTDEntityResolver:34 - located [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath


This is my Hibernate.cfg.xml file:
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>

        <!-- By default Moteguiden uses a JNDI DataSource and the MySQLDialect -->
        <property name="show_sql">false</property>
        <property name="connection.datasource">java:comp/env/jdbc/moteguiden</property>
        <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
       
        <property name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>
        <property name="hibernate.connection.url">
                        jdbc:mysql://localhost/moteguiden?user=root&amp;password=</property>
        <property name="hibernate.connection.username">root</property>
        <property name="hibernate.connection.password"></property>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
       

        <!-- Hibernate L2 Caching -->
        <property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
        <property name="hibernate.generate_statistics">true</property>
        <property name="hibernate.cache.use_structured_entries">true</property>

        <!-- Map Moteguiden pojo classes -->
        <mapping resource="no/detnye/moteguiden/pojos/FargeData.hbm.xml" />
        <mapping resource="no/detnye/moteguiden/pojos/ForhandlerData.hbm.xml" />
        <mapping resource="no/detnye/moteguiden/pojos/ForhandlerProduktData.hbm.xml" />
        <mapping resource="no/detnye/moteguiden/pojos/ForhandlerStedData.hbm.xml" />
        <mapping resource="no/detnye/moteguiden/pojos/KlestypeData.hbm.xml" />
        <mapping resource="no/detnye/moteguiden/pojos/MerkeData.hbm.xml" />
        <mapping resource="no/detnye/moteguiden/pojos/ProduktData.hbm.xml" />
        <mapping resource="no/detnye/moteguiden/pojos/ProduktFargeData.hbm.xml" />
        <mapping resource="no/detnye/moteguiden/pojos/ProduktKlestypeData.hbm.xml" />
        <mapping resource="no/detnye/moteguiden/pojos/PublikasjonData.hbm.xml" />
        <mapping resource="no/detnye/moteguiden/pojos/StedData.hbm.xml" />
    </session-factory>
</hibernate-configuration>


My hibernate.properties
Code:
hibernate.query.substitutions yes 'Y', no 'N'
## MySQL

hibernate.dialect org.hibernate.dialect.MySQLDialect
hibernate.dialect org.hibernate.dialect.MySQLInnoDBDialect
hibernate.dialect org.hibernate.dialect.MySQLMyISAMDialect
hibernate.connection.driver_class com.mysql.jdbc.Driver
hibernate.connection.url jdbc:mysql:///moteguiden
hibernate.connection.username root
hibernate.connection.password


#################################
### Hibernate Connection Pool ###
#################################

hibernate.connection.pool_size 1
hibernate.proxool.pool_alias pool1

## print all generated SQL to the console

hibernate.show_sql true


## format SQL in log and console

hibernate.format_sql true
hibernate.max_fetch_depth 1
hibernate.jdbc.batch_versioned_data true


## enable use of JDBC 2 scrollable ResultSets (specifying a Dialect will cause Hibernate to use a sensible default)

#hibernate.jdbc.use_scrollable_resultset true


## use streams when writing binary types to / from JDBC

hibernate.jdbc.use_streams_for_binary true
hibernate.cache.region_prefix hibernate.test
hibernate.cache.provider_class org.hibernate.cache.HashtableCacheProvider


If someone could please help me on how to set up hibernate correctly I would appreciate it and give alot of points :)
I can also see that I have chosen to output sql but the hibernate.properties file doesnt seem to be read. So maybe the problem is that hibernate.properties and hibernate.cfg.xml is not read! How can I set these to be read? In the tutorial it said I should have them in the classpath (I didnt know where to put them, so I put them in the package)
The exception says:
13:15:44,668 ERROR XMLHelper:61 - Error parsing XML: XML InputStream(18) Element type "id" must be followed by either attribute specifications, ">" or "/>".
But I have checked my FargeData.hbm.xml file and this is well formed.
So I am quite confused :(


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 04, 2006 4:39 pm 
Beginner
Beginner

Joined: Mon Sep 04, 2006 7:18 am
Posts: 45
Please guys and girls. I really need help with this one. I have published all information, and this should be straight clean and cut for you hibernate gurus out there.

I managed to remove the first warning about the id not correct, even though I really don't understand why I got that warning, but I still get the Exception.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 04, 2006 4:49 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
its a simple xml error.

the file you shows does not have an error so you must have told hibernate to parse something different.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 05, 2006 3:40 am 
Beginner
Beginner

Joined: Mon Sep 04, 2006 7:18 am
Posts: 45
max wrote:
its a simple xml error.

the file you shows does not have an error so you must have told hibernate to parse something different.


It doesnt seem like you have read my post, only looked at the last line of the exception.
As I told, I fixed the xml "error". Because I feel there is no error since I checked if it is well-formed and it came back true.

Here is the new output a few lines:

Code:
9:36:08,640 DEBUG DTDEntityResolver:24 - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
09:36:08,641 DEBUG DTDEntityResolver:34 - located [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath
09:36:08,816  INFO HbmBinder:309 - Mapping class: no.detnye.moteguiden.model.FargeData -> farge
Kunne ikke instansiere SessionFactory org.hibernate.MappingException: [b]Could not read mappings from resource: no/detnye/moteguiden/pojos/FargeData.hbm.xml
SessionFactory is null [/b] <-- What does this mean?


I have tried to change my package, I have tried to put everything in the
$project/bin file, because if hibernate.cfg.xml and hibernate.properties is not in the bin directory, it doesnt load. So I tried to put everything there, but it still says it cannot read mappings from my FargeData.hbm.xml


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 05, 2006 4:10 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
if you could show the full exception stack trace then it might explain itself much better.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 05, 2006 4:13 am 
Beginner
Beginner

Joined: Mon Sep 04, 2006 7:18 am
Posts: 45
max wrote:
if you could show the full exception stack trace then it might explain itself much better.


Sure...

Code:
.09:36:08,215  INFO Environment:479 - Hibernate 3.1.3
09:36:08,241  INFO Environment:494 - loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=com.mysql.jdbc.Driver , hibernate.cglib.use_reflection_optimizer=true, hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider, hibernate.max_fetch_depth=1 , hibernate.dialect=org.hibernate.dialect.MySQLMyISAMDialect , hibernate.jdbc.use_streams_for_binary=true , hibernate.format_sql=true , hibernate.query.substitutions=yes 'Y', no 'N' , hibernate.proxool.pool_alias=pool1 , hibernate.connection.username=root , hibernate.cache.region_prefix=hibernate.test , hibernate.connection.url=jdbc:mysql:///moteguiden , hibernate.show_sql=true , hibernate.connection.password=****, hibernate.jdbc.batch_versioned_data=true , hibernate.connection.pool_size=1 }
09:36:08,243  INFO Environment:524 - using java.io streams to persist binary types
09:36:08,243  INFO Environment:525 - using CGLIB reflection optimizer
09:36:08,247  INFO Environment:555 - using JDK 1.4 java.sql.Timestamp handling
09:36:08,330  INFO Configuration:1308 - configuring from resource: /hibernate.cfg.xml
09:36:08,330  INFO Configuration:1285 - Configuration resource: /hibernate.cfg.xml
09:36:08,555 DEBUG DTDEntityResolver:22 - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd]
09:36:08,558 DEBUG DTDEntityResolver:24 - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
09:36:08,559 DEBUG DTDEntityResolver:34 - located [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in classpath
09:36:08,607 DEBUG Configuration:1269 - show_sql=false
09:36:08,607 DEBUG Configuration:1269 - connection.datasource=java:comp/env/jdbc/moteguiden
09:36:08,608 DEBUG Configuration:1269 - dialect=org.hibernate.dialect.MySQLDialect
09:36:08,610 DEBUG Configuration:1269 - hibernate.connection.driver_class=org.gjt.mm.mysql.Driver
09:36:08,610 DEBUG Configuration:1269 - hibernate.connection.url=jdbc:mysql://localhost/moteguiden?user=root&password=
09:36:08,611 DEBUG Configuration:1269 - hibernate.connection.username=root
09:36:08,612 DEBUG Configuration:1269 - hibernate.connection.password=
09:36:08,619 DEBUG Configuration:1269 - hibernate.dialect=org.hibernate.dialect.MySQLDialect
09:36:08,619 DEBUG Configuration:1269 - hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
09:36:08,620 DEBUG Configuration:1269 - hibernate.generate_statistics=true
09:36:08,620 DEBUG Configuration:1269 - hibernate.cache.use_structured_entries=true
09:36:08,621 DEBUG Configuration:1464 - null<-org.dom4j.tree.DefaultAttribute@765a16 [Attribute: name resource value "no/detnye/moteguiden/pojos/FargeData.hbm.xml"]
09:36:08,622  INFO Configuration:469 - Reading mappings from resource: no/detnye/moteguiden/pojos/FargeData.hbm.xml
09:36:08,638 DEBUG DTDEntityResolver:22 - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
09:36:08,640 DEBUG DTDEntityResolver:24 - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
09:36:08,641 DEBUG DTDEntityResolver:34 - located [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath
09:36:08,816  INFO HbmBinder:309 - Mapping class: no.detnye.moteguiden.model.FargeData -> farge
Kunne ikke instansiere SessionFactory org.hibernate.MappingException: Could not read mappings from resource: no/detnye/moteguiden/pojos/FargeData.hbm.xml SessionFactory is null
E
Time: 0.84
There was 1 error:
1) testHibernate(no.detnye.moteguiden.HibernateTest)
java.lang.NullPointerException
   at no.detnye.moteguiden.HibernateTest.testHibernate(HibernateTest.java:27)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at no.detnye.moteguiden.HibernateTest.main(HibernateTest.java:18)

FAILURES!!!
Tests run: 1,  Failures: 0,  Errors: 1


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 05, 2006 4:22 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
that is not the full stack trace of that mapping exception

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 05, 2006 4:23 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
and this part:

Code:
Kunne ikke instansiere SessionFactory org.hibernate.MappingException: [b]Could not read mappings from resource: no/detnye/moteguiden/pojos/FargeData.hbm.xml
SessionFactory is null [/b] <-- What does this mean?


is a message from *your* code not hibernate's so you tell me ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 05, 2006 4:32 am 
Beginner
Beginner

Joined: Mon Sep 04, 2006 7:18 am
Posts: 45
max wrote:
and this part:

Code:
Kunne ikke instansiere SessionFactory org.hibernate.MappingException: [b]Could not read mappings from resource: no/detnye/moteguiden/pojos/FargeData.hbm.xml
SessionFactory is null [/b] <-- What does this mean?


is a message from *your* code not hibernate's so you tell me ;)


LOL. You are right :)
Ok. ok I will print the stack trace and post it here.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 05, 2006 4:34 am 
Beginner
Beginner

Joined: Mon Sep 04, 2006 7:18 am
Posts: 45
Full stack trace

Code:
org.hibernate.MappingException: Could not read mappings from resource: no/detnye/moteguiden/pojos/FargeData.hbm.xml
   at org.hibernate.cfg.Configuration.addResource(Configuration.java:485)
   at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1465)
   at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1433)
   at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1414)
   at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390)
   at org.hibernate.cfg.Configuration.configure(Configuration.java:1310)
   at org.hibernate.cfg.Configuration.configure(Configuration.java:1296)
   at no.detnye.moteguiden.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:13)
   at no.detnye.moteguiden.HibernateTest.testHibernate(HibernateTest.java:27)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:324)
   at junit.framework.TestCase.runTest(TestCase.java:154)
   at junit.framework.TestCase.runBare(TestCase.java:127)
   at junit.framework.TestResult$1.protect(TestResult.java:106)
   at junit.framework.TestResult.runProtected(TestResult.java:124)
   at junit.framework.TestResult.run(TestResult.java:109)
   at junit.framework.TestCase.run(TestCase.java:118)
   at junit.framework.TestSuite.runTest(TestSuite.java:208)
   at junit.framework.TestSuite.run(TestSuite.java:203)
   at junit.textui.TestRunner.doRun(TestRunner.java:116)
   at junit.textui.TestRunner.doRun(TestRunner.java:109)
   at junit.textui.TestRunner.run(TestRunner.java:72)
   at no.detnye.moteguiden.HibernateTest.main(HibernateTest.java:18)
Caused by: org.hibernate.MappingException: class no.detnye.moteguiden.model.FargeData not found while looking for property: id
   at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:80)
   at org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.java:276)
   at org.hibernate.cfg.HbmBinder.bindSimpleId(HbmBinder.java:410)
   at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:343)
   at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:282)
   at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:153)
   at org.hibernate.cfg.Configuration.add(Configuration.java:386)
   at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:427)
   at org.hibernate.cfg.Configuration.addResource(Configuration.java:482)
   ... 24 more
Caused by: java.lang.ClassNotFoundException: no.detnye.moteguiden.model.FargeData
   at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
   at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Class.java:141)
   at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108)
   at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:76)
   ... 32 more


Caused by: org.hibernate.MappingException: class no.detnye.moteguiden.model.FargeData not found while looking for property: id

Seems like what I thought. It cannot find FargeData.class, and this class is located in
$project/bin/no/detnye/moteguiden/model/FargeData.class

The reason why it is in bin is because I have put this as default output for eclipse.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 05, 2006 6:52 am 
Beginner
Beginner

Joined: Mon Sep 04, 2006 7:18 am
Posts: 45
I found a little error.
In my Fargedata.hbm.xml file I had the wrong package name.

I changed the value from no.detnye.moteguiden.model.FargeData
too

<hibernate-mapping>
<class
name="no.detnye.moteguiden.pojos.FargeData"
table="farge"
lazy="false"
>
<cache usage="read-write" />

<id name="id">
<generator class="increment" />
</id>

But still I get this following error:

Code:
.12:43:04,328  INFO Environment:479 - Hibernate 3.1.3
12:43:04,344  INFO Environment:494 - loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=com.mysql.jdbc.Driver , hibernate.cglib.use_reflection_optimizer=true, hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider, hibernate.max_fetch_depth=1 , hibernate.dialect=org.hibernate.dialect.MySQLMyISAMDialect , hibernate.jdbc.use_streams_for_binary=true , hibernate.format_sql=true , hibernate.query.substitutions=yes 'Y', no 'N' , hibernate.proxool.pool_alias=pool1 , hibernate.connection.username=root , hibernate.cache.region_prefix=hibernate.test , hibernate.connection.url=jdbc:mysql:///moteguiden , hibernate.show_sql=true , hibernate.connection.password=****, hibernate.jdbc.batch_versioned_data=true , hibernate.connection.pool_size=1 }
12:43:04,348  INFO Environment:524 - using java.io streams to persist binary types
12:43:04,349  INFO Environment:525 - using CGLIB reflection optimizer
12:43:04,358  INFO Environment:555 - using JDK 1.4 java.sql.Timestamp handling
12:43:04,545  INFO Configuration:1308 - configuring from resource: /hibernate.cfg.xml
12:43:04,546  INFO Configuration:1285 - Configuration resource: /hibernate.cfg.xml
12:43:04,950 DEBUG DTDEntityResolver:22 - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd]
12:43:04,952 DEBUG DTDEntityResolver:24 - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
12:43:04,953 DEBUG DTDEntityResolver:34 - located [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in classpath
12:43:05,005 DEBUG Configuration:1269 - show_sql=false
12:43:05,006 DEBUG Configuration:1269 - connection.datasource=java:comp/env/jdbc/moteguiden
12:43:05,006 DEBUG Configuration:1269 - dialect=org.hibernate.dialect.MySQLDialect
12:43:05,008 DEBUG Configuration:1269 - hibernate.connection.driver_class=org.gjt.mm.mysql.Driver
12:43:05,008 DEBUG Configuration:1269 - hibernate.connection.url=jdbc:mysql://localhost/moteguiden?user=root&password=
12:43:05,014 DEBUG Configuration:1269 - hibernate.connection.username=root
12:43:05,016 DEBUG Configuration:1269 - hibernate.connection.password=
12:43:05,016 DEBUG Configuration:1269 - hibernate.dialect=org.hibernate.dialect.MySQLDialect
12:43:05,017 DEBUG Configuration:1269 - hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
12:43:05,017 DEBUG Configuration:1269 - hibernate.generate_statistics=true
12:43:05,017 DEBUG Configuration:1269 - hibernate.cache.use_structured_entries=true
12:43:05,018 DEBUG Configuration:1464 - null<-org.dom4j.tree.DefaultAttribute@765a16 [Attribute: name resource value "no/detnye/moteguiden/pojos/FargeData.hbm.xml"]
12:43:05,019  INFO Configuration:469 - Reading mappings from resource: no/detnye/moteguiden/pojos/FargeData.hbm.xml
12:43:05,021 DEBUG DTDEntityResolver:22 - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
12:43:05,023 DEBUG DTDEntityResolver:24 - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
12:43:05,023 DEBUG DTDEntityResolver:34 - located [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath
12:43:05,168  INFO HbmBinder:309 - Mapping class: no.detnye.moteguiden.pojos.FargeData -> farge
12:43:05,183 DEBUG HbmBinder:1261 - Mapped property: id -> id
12:43:05,190 DEBUG HbmBinder:1261 - Mapped property: fargenavn -> fargenavn
12:43:05,197 DEBUG HbmBinder:1261 - Mapped property: produktfarger
12:43:05,198 DEBUG Configuration:1464 - null<-org.dom4j.tree.DefaultAttribute@110fe28 [Attribute: name resource value "no/detnye/moteguiden/pojos/ForhandlerData.hbm.xml"]
12:43:05,200  INFO Configuration:469 - Reading mappings from resource: no/detnye/moteguiden/pojos/ForhandlerData.hbm.xml
12:43:05,234 DEBUG DTDEntityResolver:22 - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
12:43:05,234 DEBUG DTDEntityResolver:24 - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
12:43:05,235 DEBUG DTDEntityResolver:34 - located [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath
12:43:05,305 ERROR XMLHelper:61 - Error parsing XML: XML InputStream(18) Element type "id" must be followed by either attribute specifications, ">" or "/>".
org.hibernate.MappingException: Could not read mappings from resource: no/detnye/moteguiden/pojos/ForhandlerData.hbm.xml
   at org.hibernate.cfg.Configuration.addResource(Configuration.java:485)
   at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1465)
   at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1433)
   at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1414)
   at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390)
   at org.hibernate.cfg.Configuration.configure(Configuration.java:1310)
   at org.hibernate.cfg.Configuration.configure(Configuration.java:1296)
   at no.detnye.moteguiden.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:13)
   at no.detnye.moteguiden.HibernateTest.testHibernate(HibernateTest.java:27)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:324)
   at junit.framework.TestCase.runTest(TestCase.java:154)
   at junit.framework.TestCase.runBare(TestCase.java:127)
   at junit.framework.TestResult$1.protect(TestResult.java:106)
   at junit.framework.TestResult.runProtected(TestResult.java:124)
   at junit.framework.TestResult.run(TestResult.java:109)
   at junit.framework.TestCase.run(TestCase.java:118)
   at junit.framework.TestSuite.runTest(TestSuite.java:208)
   at junit.framework.TestSuite.run(TestSuite.java:203)
   at junit.textui.TestRunner.doRun(TestRunner.java:116)
   at junit.textui.TestRunner.doRun(TestRunner.java:109)
   at junit.textui.TestRunner.run(TestRunner.java:72)
   at no.detnye.moteguiden.HibernateTest.main(HibernateTest.java:18)
Caused by: org.hibernate.MappingException: Could not parse mapping document in input stream
   at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:431)
   at org.hibernate.cfg.Configuration.addResource(Configuration.java:482)
   ... 24 more
Caused by: org.dom4j.DocumentException: Error on line 18 of document  : Element type "id" must be followed by either attribute specifications, ">" or "/>". Nested exception: Element type "id" must be followed by either attribute specifications, ">" or "/>".
   at org.dom4j.io.SAXReader.read(SAXReader.java:482)
   at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:422)
   ... 25 more
SessionFactory er null
E
Time: 1.352
There was 1 error:
1) testHibernate(no.detnye.moteguiden.HibernateTest)java.lang.NullPointerException
   at no.detnye.moteguiden.HibernateTest.testHibernate(HibernateTest.java:27)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at no.detnye.moteguiden.HibernateTest.main(HibernateTest.java:18)

FAILURES!!!
Tests run: 1,  Failures: 0,  Errors: 1


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 05, 2006 7:44 am 
Beginner
Beginner

Joined: Mon Sep 04, 2006 7:18 am
Posts: 45
I have no idea what I did, but it seems that hibernate has started reading the mapping files. Although I get a new exception I believe I will be able to fix that myself.

The only thing I did was to change the id generator class from increment to sequence.

I will post if I get more trouble underway.


Top
 Profile  
 
 Post subject: But I still have a problem with hibernate 3.2
PostPosted: Mon Sep 11, 2006 5:34 pm 
Newbie

Joined: Mon Aug 01, 2005 8:12 pm
Posts: 19
Location: CA
But I still have same problem with Rational Applicatin Developer, which is built on top eclipse.

Here is the Stack trace:[9/11/06 14:14:32:895 PDT] 7e97e317 SystemErr R log4j:WARN Please initialize the log4j system properly.
[9/11/06 14:14:33:645 PDT] 7e97e317 SystemErr R Initial SessionFactory creation failed.org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/ibm/portlet/hello/Test.hbm.xml
[9/11/06 14:14:33:645 PDT] 7e97e317 SystemErr R org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/ibm/portlet/hello/Test.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:523)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1511)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1479)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1458)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1432)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1352)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1338)
at com.ibm.portlet.hello.HibernateUtil.<clinit>(HibernateUtil.java:20)
at com.ibm.portlet.hello.HelloPortletPortlet.doView(HelloPortletPortlet.java:30)
at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:235)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:163)
at com.ibm.wps.pe.pc.std.cmpf.impl.PortletFilterChainImpl.render(PortletFilterChainImpl.java:144)
at com.ibm.wps.pe.pc.std.invoker.impl.PortletServlet.dispatch(PortletServlet.java:131)
at com.ibm.wps.pe.pc.std.invoker.impl.PortletServlet.doGet(PortletServlet.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at com.ibm.wps.pe.pc.std.cache.CacheablePortlet.service(CacheablePortlet.java:257)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1171)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:676)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:256)
at com.ibm.wps.pe.pc.std.invoker.impl.PortletInvokerImpl.invoke(PortletInvokerImpl.java:204)
at com.ibm.wps.pe.pc.std.invoker.impl.PortletInvokerImpl.invoke(PortletInvokerImpl.java:168)
at com.ibm.wps.pe.pc.std.invoker.impl.PortletInvokerImpl.render(PortletInvokerImpl.java:97)
at com.ibm.wps.pe.pc.std.PortletContainerImpl.renderPortlet(PortletContainerImpl.java:110)
at com.ibm.wps.pe.pc.PortletContainerImpl.doRenderPortlet(PortletContainerImpl.java:545)
at com.ibm.wps.pe.ext.render.AbstractRenderManager.performService(AbstractRenderManager.java:251)
at com.ibm.wps.pe.pc.PortletContainerImpl.renderPortlet(PortletContainerImpl.java:100)
at com.ibm.wps.engine.tags.PortletRenderTag.doStartTag(PortletRenderTag.java:155)
at org.apache.jsp._Control._jspService(Control.jsp :176)
at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:351)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:705)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:803)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.ServicingServletState.service(StrictLifecycleServlet.java:333)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1166)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:676)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:256)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.handleRequest(DispatcherServiceImpl.java:89)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.include(DispatcherServiceImpl.java:50)
at com.ibm.wps.services.dispatcher.Dispatcher.include(Dispatcher.java:44)
at com.ibm.wps.engine.templates.skins.Default.render(Default.java:74)
at com.ibm.wps.engine.templates.SkinTemplate.render(SkinTemplate.java:71)
at com.ibm.wps.composition.elements.Component.render(Component.java:785)
at com.ibm.wps.composition.elements.Control.render(Control.java:186)
at com.ibm.wps.composition.Composition.render(Composition.java:2884)
at com.ibm.wps.model.wrappers.LayoutModelWrapperFactoryImpl$LayoutModelWrapperImpl.render(LayoutModelWrapperFactoryImpl.java:204)
at com.ibm.wps.model.ModelUtil$WrappedCompositionModel.render(ModelUtil.java:832)
at org.apache.jsp._UnlayeredContainer_2D_V._jspService(UnlayeredContainer-V.jsp :11)
at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:351)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:705)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:803)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.ServicingServletState.service(StrictLifecycleServlet.java:333)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1166)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:676)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:256)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.handleRequest(DispatcherServiceImpl.java:89)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.include(DispatcherServiceImpl.java:50)
at com.ibm.wps.services.dispatcher.Dispatcher.include(Dispatcher.java:44)
at com.ibm.wps.engine.templates.skins.Default.render(Default.java:74)
at com.ibm.wps.engine.templates.SkinTemplate.render(SkinTemplate.java:71)
at com.ibm.wps.composition.elements.Component.render(Component.java:785)
at com.ibm.wps.composition.Composition.render(Composition.java:2884)
at com.ibm.wps.model.wrappers.LayoutModelWrapperFactoryImpl$LayoutModelWrapperImpl.render(LayoutModelWrapperFactoryImpl.java:204)
at com.ibm.wps.engine.tags2.PageRenderTag.doStartTag(PageRenderTag.java:396)
at org.apache.jsp._Home._jspService(Home.jsp :15)
at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:351)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:705)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:803)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.ServicingServletState.service(StrictLifecycleServlet.java:333)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1166)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:676)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:256)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.handleRequest(DispatcherServiceImpl.java:89)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.include(DispatcherServiceImpl.java:50)
at com.ibm.wps.services.dispatcher.Dispatcher.include(Dispatcher.java:44)
at com.ibm.wps.engine.templates.screens.Default.render(Default.java:91)
at com.ibm.wps.engine.templates.ScreenTemplate.render(ScreenTemplate.java:61)
at com.ibm.wps.engine.tags2.ScreenRenderTag.doStartTag(ScreenRenderTag.java:89)
at org.apache.jsp._Default._jspService(Default.jsp :771)
at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:351)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:705)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:803)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1166)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:676)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:256)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.handleRequest(DispatcherServiceImpl.java:89)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.include(DispatcherServiceImpl.java:50)
at com.ibm.wps.services.dispatcher.Dispatcher.include(Dispatcher.java:44)
at com.ibm.wps.engine.templates.themes.Default.render(Default.java:103)
at com.ibm.wps.engine.templates.ThemeTemplate.render(ThemeTemplate.java:67)
at com.ibm.wps.engine.phases.WPRenderPhase.processRendering(WPRenderPhase.java:324)
at com.ibm.wps.engine.phases.WPRenderPhase.execute(WPRenderPhase.java:136)
at com.ibm.wps.state.phases.AbstractRenderPhase.next(AbstractRenderPhase.java:106)
at com.ibm.wps.engine.phases.WPAbstractRenderPhase.next(WPAbstractRenderPhase.java:93)
at com.ibm.wps.engine.Servlet.callPortal(Servlet.java:717)
at com.ibm.wps.engine.Servlet.doGet(Servlet.java:566)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:76)
at com.ibm.wps.state.filter.StateCleanup.doFilter(StateCleanup.java:86)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
at com.ibm.wps.mappingurl.impl.URLAnalyzer.doFilter(URLAnalyzer.java:257)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1162)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:676)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:203)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:125)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:300)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:246)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:652)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:458)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:936)
Caused by: org.hibernate.MappingException: invalid mapping
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:463)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:520)
... 166 more
Caused by: org.xml.sax.SAXParseException: The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id|composite-id),discriminator?,natural-id?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*,resultset*,(query|sql-query)*)".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:460)
... 167 more


-------------------------------------------------------------------------------------
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

<hibernate-mapping package="com.ibm.portlet.hello">
<class
name="Test"
table="Test"
>
<meta attribute="sync-DAO">false</meta>

<property
name="FirstName"
column="first_name"
type="string"
not-null="false"
length="50"
/>
<property
name="LastName"
column="last_name"
type="string"
not-null="false"
length="50"
/>


</class>
</hibernate-mapping>

and here is the hbm.xml file generated by using hibernate synchronizer.


Top
 Profile  
 
 Post subject: primary ID
PostPosted: Thu Sep 14, 2006 8:30 pm 
Newbie

Joined: Mon Aug 01, 2005 8:12 pm
Posts: 19
Location: CA
I sorted out the problem.

Since I was not mentioning about the Id, it wasn't working.

Now what if I don't have ID what need to be done.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 15, 2006 2:11 am 
Beginner
Beginner

Joined: Mon Sep 04, 2006 7:18 am
Posts: 45
If you dont have id? I think it is always wise to have id. My problem was also in the id. I had increment, but I changed it to assigned. Also I had comments in between the attributes and that is wrong, also I was using the wrong package name. You tend to get blind when you look at the same code your self.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 16 posts ]  Go to page 1, 2  Next

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.