-->
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.  [ 4 posts ] 
Author Message
 Post subject: org.hibernate.MappingException: Resource: xxx not found
PostPosted: Thu Jan 27, 2005 12:09 am 
Newbie

Joined: Wed Jan 26, 2005 10:17 pm
Posts: 8
Hi,

This is probalbly something silly.
I have succesfully reversed som tables from postgres.
However when I try to create a sessionFactory the console canot find the xml mapping files.
They are ( like the example ) in my project folder /src/com/wer
the config xml is there also.
In the configuration of the console, I selected these files where is say 'mapping files' but that doesn't help.

I did have a look at the existing posts, but could not find an answer.
Needless to say I am a newbie.

Could somebody help me out?

Thanks.

Hibernate version:
3

Mapping documents:
<?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 name="pgSessFact">
<property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/testing</property>
<property name="hibernate.cglib.use_reflection_optimizer">true</property>
<property name="hibernate.connection.password">postgres</property>
<property name="hibernate.connection.username">postgres</property>
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<mapping resource="com/rev/PgTsDict.hbm.xml"/>
<mapping resource="com/rev/PgTsCfg.hbm.xml"/>
<mapping resource="com/rev/PgTsParser.hbm.xml"/>
<mapping resource="com/rev/PgTsCfgmap.hbm.xml"/>
<mapping resource="com/rev/Table1.hbm.xml"/>
</session-factory>
</hibernate-configuration>

Full stack trace of any exception that occurs:
org.hibernate.MappingException: Resource: com/rev/PgTsDict.hbm.xml not found
at org.hibernate.cfg.Configuration.addResource(Configuration.java:439)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1369)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1341)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1323)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1290)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1252)
at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:151)
at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:128)
at org.hibernate.eclipse.console.actions.BuildSessionFactoryAction.doRun(BuildSessionFactoryAction.java:50)
at org.hibernate.eclipse.console.actions.ConsoleConfigurationBasedAction.run(ConsoleConfigurationBasedAction.java:47)
at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:167)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:555)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:505)
at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:419)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2803)

at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2448)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1569)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1540)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:285)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:102)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:220)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129)
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.basicRun(Main.java:185)
at org.eclipse.core.launcher.Main.run(Main.java:710)
at org.eclipse.core.launcher.Main.main(Main.java:694)


Name and version of the database you are using:
Postgres 8


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 27, 2005 4:36 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you should not add mappings that duplicates what is in hibernate.cfg.xml - that will result in duplicate mappings errors.

But your error I assume is caused by not having your hbm.xml files in the classpath of the console. You need to add that in the console otherwise it cannot find it.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Artifact Generation UnsupportedClassVersionError
PostPosted: Thu Jan 27, 2005 11:17 am 
Newbie

Joined: Wed Jan 26, 2005 10:17 pm
Posts: 8
Max, thank you for pointing me in the right direction.
- The classpath of the console conguration has to include the location of the compiled classes ( which also has the mapping files ), I had included the source directory...

Sorry to bother again you but I have now progressed to another problem.

Artifact Genaration
After generating the artifacts from the database,
when starting the sessionFactory it throws an UnsupportedClassVersionError for one of the classes created by the tool.

Configuration
JRE_LIB j2re1.4.2_06
eclipse -vm j2re1.4.2_06/bin/javaw.exe
platform XP - update2

hybernate version 3
Database Postgres 8

Stacktrace
java.lang.UnsupportedClassVersionError: com/rev/Table1 (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:100)
at org.hibernate.mapping.PersistentClass.getMappedClass(PersistentClass.java:144)
at org.hibernate.persister.AbstractEntityPersister.<init>(AbstractEntityPersister.java:175)
at org.hibernate.persister.BasicEntityPersister.<init>(BasicEntityPersister.java:352)
at org.hibernate.persister.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:95)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:44)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:196)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1031)
at org.hibernate.console.ConsoleConfiguration$1.execute(ConsoleConfiguration.java:221)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:76)
at org.hibernate.console.ConsoleConfiguration.initSessionFactory(ConsoleConfiguration.java:219)
at org.hibernate.eclipse.console.actions.BuildSessionFactoryAction.doRun(BuildSessionFactoryAction.java:51)
at org.hibernate.eclipse.console.actions.ConsoleConfigurationBasedAction.run(ConsoleConfigurationBasedAction.java:47)
at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:167)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:555)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:505)
at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:419)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2803)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2448)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1569)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1540)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:285)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:102)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:220)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129)
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.basicRun(Main.java:185)
at org.eclipse.core.launcher.Main.run(Main.java:710)
at org.eclipse.core.launcher.Main.main(Main.java:694)


Top
 Profile  
 
 Post subject: solved my onw problem
PostPosted: Thu Jan 27, 2005 12:34 pm 
Newbie

Joined: Wed Jan 26, 2005 10:17 pm
Posts: 8
Solved my UnsupportedClassVersionError by doing everything with java1.5

Run eclipse with java 1.5 ( eclipse.exe -vm JAVA1.5HOME )

THanks for the attention.


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