HappyEngineer
asked on
hibernate resource not found when run inside eclipse
I use Hibernate 3 in Eclipse with Hibernate Synchronizer. When I run code that uses hibernate from the command line (executed using ant) it also works fine. However, if I run that same app in eclipse it fails with the error message at the end of this question.
The problem is that when run from inside eclipse "Thread.currentThread().ge tContextCl assLoader( ).getResou rceAsStrea m( path )" returns null whereas it succeeds when run outside of eclipse.
What should I do to get this to run inside eclipse?
ERROR[2006-04-04 22:15:27,545] com.knowlist.search.IndexU pdaterQueu eManager.m ain(IndexU pdaterQueu eManager.j ava:39)(In dexUpdater QueueManag er.java39) :
java.lang.RuntimeException : org.hibernate.MappingExcep tion: Resource: /com/knowlist/list/hh/Cust omObjAffin ity.hbm not found
at com.knowlist.list.hh.Hiber nateInit.d oInit(Hibe rnateInit. java:66)
at com.knowlist.list.hh.Hiber nateInit.d oInit(Hibe rnateInit. java:25)
at com.knowlist.search.IndexU pdaterQueu eManager.m ain(IndexU pdaterQueu eManager.j ava:29)
Caused by: org.hibernate.MappingExcep tion: Resource: /com/knowlist/list/hh/Cust omObjAffin ity.hbm not found
at org.hibernate.cfg.Configur ation.addR esource(Co nfiguratio n.java:444 )
at org.hibernate.cfg.Configur ation.pars eMappingEl ement(Conf iguration. java:1313)
at org.hibernate.cfg.Configur ation.pars eSessionFa ctory(Conf iguration. java:1285)
at org.hibernate.cfg.Configur ation.doCo nfigure(Co nfiguratio n.java:126 7)
at org.hibernate.cfg.Configur ation.doCo nfigure(Co nfiguratio n.java:123 4)
at org.hibernate.cfg.Configur ation.conf igure(Conf iguration. java:1162)
at com.knowlist.list.hh.base. _BaseRootD AO.initial ize(_BaseR ootDAO.jav a:57)
at com.knowlist.list.hh.base. _BaseRootD AO.initial ize(_BaseR ootDAO.jav a:41)
at com.knowlist.list.hh.Hiber nateInit.d oInit(Hibe rnateInit. java:35)
... 2 more
The problem is that when run from inside eclipse "Thread.currentThread().ge
What should I do to get this to run inside eclipse?
ERROR[2006-04-04 22:15:27,545] com.knowlist.search.IndexU
java.lang.RuntimeException
at com.knowlist.list.hh.Hiber
at com.knowlist.list.hh.Hiber
at com.knowlist.search.IndexU
Caused by: org.hibernate.MappingExcep
at org.hibernate.cfg.Configur
at org.hibernate.cfg.Configur
at org.hibernate.cfg.Configur
at org.hibernate.cfg.Configur
at org.hibernate.cfg.Configur
at org.hibernate.cfg.Configur
at com.knowlist.list.hh.base.
at com.knowlist.list.hh.base.
at com.knowlist.list.hh.Hiber
... 2 more
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It's at:
J:\prog\workspace\KnowList \WebRoot\W EB-INF\cla sses
The ant target (which works):
<target name="indexUpdater">
<java classname="com.knowlist.se arch.Index UpdaterQue ueManager" >
<classpath>
<pathelement location="WebRoot/WEB-INF/ classes"/>
<fileset dir="WebRoot/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
</classpath>
</java>
</target>
J:\prog\workspace\KnowList
The ant target (which works):
<target name="indexUpdater">
<java classname="com.knowlist.se
<classpath>
<pathelement location="WebRoot/WEB-INF/
<fileset dir="WebRoot/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
</classpath>
</java>
</target>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I found that the problem went away when I removed the preceding slash from the beginning of the hbm. So, instead of "/com/knowlist/list/hh/Cus tomObjAffi nity.hbm" I use "com/knowlist/list/hh/Cust omObjAffin ity.hbm".
ASKER
I opened up the run configuration in eclipse for this app and set the classpath up to be just like that in the build file and it didn't make any difference.