Herbert-
I think you're doing two things wrong. First, when you call
getResource, you should probably start your path with a forward slash
'/' (indicating the root of the class path). Otherwise that part
looks fine. Second, in the <include> element in m1 I don't think full
paths work (I played around with it a lot a long time ago, it may have
changed). If you use a relative path, I'm 99% certain that will work
(relative to m1 that is).
HTH,
Stephen
On 11/1/06, Herbert Wu <[EMAIL PROTECTED]> wrote:
Hi, All,
I am stuck with a simple mapping files access issue and here are the details:
I have two mapping files m1.xml and m2.xml placed in foo.jar.
(1) The pkg path to them is com.foo.xml.castor.mapping;
(2) There is include entry in m1.xml
<?xml version="1.0" encoding="UTF-8"?>
<mapping>
<include href="com/foo/xml/castor/mapping/m2.xml"/>
....
</mapping>
Now, in the client code, foo.jar is included in the class path:
String mappingFile = "com/foo/xml/castor/mapping/m1.xml"
org.exolab.castor.mapping.Mapping mapping= new Mapping();
mapping.loadMapping(this.getClass().getResource(mappingFile));
However the mapping object can not be created with null pointer error.
What's the proper cfg steps to access mapping files in a jar file?
Note: I can run these castor mapping perfectly if the mapping files
are placed in a regular file folder.
Your help is greatly appreciated!
-Herbert
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email