Hi all. I'm new to Castor; I've been reading the documentation on the
website, and also download the shop/shoptest example from the "articles"
page (URL of that example: http://www.drrockit.com/space/castorcodeexample)
I was having path problems, so I put all of the classes into a package,
com.rjkcomm, to try and alleviate that. My path:
./ <-- this ("./") is in the classpath
database.xml
shop-mapping.xml
com/
rjkcomm/
Shop.class
ShopTest.class
The problem:
when I try to run the ShopTest class via "java com.rjkcomm.ShopTest", I get
this exception:
org.exolab.castor.mapping.MappingException: Nested error:
org.exolab.castor.mapping.MappingException: Could not find the class
com.rjkcomm.Shop
So, how do I get the Shop class to load? It's in the appropriate path for
its package, and the path is in the classpath.
Pertinent Source Code:
ShopTest.java:
try {
JDO.loadConfiguration( "database.xml" );
} catch (MappingException e) {
System.out.println("Exception: "+e);
}
database.xml
[ has a mapping element pointing to relative path "shop-mapping.xml" ]
shop-mapping.xml:
<mapping>
<class name="com.rjkcomm.Shop" identity="id">
<!-- ... -->
</mapping>
Prior Messages:
I did search the list archives, and came up with this message:
http://castor.exolab.org/list-archive/msg19773.html
... which suggests using the "setClassLoader" method to fix problems like
this. Except that JDO.loadConfiguration() is a static method, and
JDO.setClassLoader() is not, and it's my understanding that you're supposed
to do a loadConfiguration() before you allocate an instance of JDO with the
appropriate database name in the constructor. So, I'm not sure how to use
setClassLoader in this situation.
If this has been addressed elsewhere, please point me to the reference.
Platform Details:
JDK 1.4.0_02
[ executing from the command line, no servlets or jsp ]
Castor 0.9.4.2
MySQL 3.23.49-8
on debian 3.0
Thanks for any assistance,
_________________________________
Robert Kent - (617) 413-3510
http://www.rjk-comm.com/
_________________________________
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
- [castor-dev] Re: Class loading / Mapping problem Robert Kent
- [castor-dev] Re: Class loading / Mapping problem Robert Kent
- Re: [castor-dev] Re: Class loading / Mapping problem Bruce Snyder
- Re: [castor-dev] Class loading / Mapping problem Bruce Snyder
