Hi Paul,
I just created
http://jira.codehaus.org/browse/CASTOR-2895
for the purpose of tracking this. Feel free to add your comments over at
the Jira issue as well as reply here.
Regards
Werner
On 12.04.2010 13:35, Paul French wrote:
Hello Werner,
Will do, but my job at the moment is a nightmare and times a premium. Leave
it with me and I will sort it.
Thanks
Paul
-----Original Message-----
From: Werner Guttmann [mailto:[email protected]]
Sent: 08 April 2010 07:51
Cc: [email protected]; Paul French
Subject: Re: [castor-user] Setting Class Loader for the
marshaller/unmarshaller
Paul,
why don't you check out sources from SVN, and add the following method
to XMLContext
/**
* Sets a custom {...@link ClassLoader} to be used for loading classes.
* @param classLoader A custom {...@link ClassLoader}.
*/
public void setClassLoader(ClassLoader classLoader) {
this._internalContext.setClassLoader(classLoader);
}
and check whether this solves your problem ? Of course the folks over at
Spring (OXM) will need to expose this setter as well, but that#s to be
dealt with at a later time.
Regards
Werner
PS Please do not forget to create a Jira issue to track this work.
On 07.04.2010 14:56, Werner Guttmann wrote:
Please do so ... I can easily provide e.g. a Maven snapshot release of
1.3.2 with this new method part of the contract, to ease testing on your
side.
Kind regards
Werner
On 07.04.2010 14:50, Paul French wrote:
I totally agree with you. We do need a way to say what class loader to
use.
I was checking with you whether I had missed something. I'll raise a JIRA
along with the other JIRA I still need to do when I get a chance!!
Thanks
Paul
-----Original Message-----
From: Werner Guttmann [mailto:[email protected]]
Sent: 07 April 2010 13:37
To: [email protected]
Cc: Paul French
Subject: Re: [castor-user] Setting Class Loader for the
marshaller/unmarshaller
Hi Paul,
On 06.04.2010 15:24, Paul French wrote:
Our application has many third party libraries (including castor) which
get
installed in a specific location and are picked up by tomcat by
modifying
the common.loader property in catalina.properties. Hence our deployed
wars
are relatively small since they contain no jars in WEB-INF/lib
Understood.
We generate the descriptors + pojo + cdr files via the
SourceGeneratorMain
utility
org.exolab.castor.builder.SourceGeneratorMain -i XXXX.xsd -package
com.kirona.YYYY -dest src -nomarshall -f -types j2
-generateImportedSchemas
true
These all get compiled and packaged in the war in WEB-INF/classes along
with
the rest of the application.
Fine, and that's what it should be.
As a workaround I have done (by extending CasdtorMarshaller from Spring)
XMLContext context = super.createXMLContext(arg0,arg1);
context.getInternalContext().setClassLoader(AcceptQuote.class.getClassLoader
());
...where AcceptQuote.class is a pojo generated by Castor. This works
fine.
However context.getInternalContext() has been deprecated and I cannot
find
an alternative.
Hmm. There's definitely a setClassLoader() method on the Unmarshaller
class, but I am not sure that this is exposed in any way.
Thinking about this, one could (and should) introduce a setClassLoader()
method on XMLContext to allow customization of class loaders. What do
you think ?
Thanks
P
-----Original Message-----
From: Werner Guttmann [mailto:[email protected]]
Sent: 06 April 2010 08:43
To: [email protected]
Cc: Paul French
Subject: Re: [castor-user] Setting Class Loader for the
marshaller/unmarshaller
Hi Paul,
it's been 5 years plus that I have seen somebody reporting a problem
like this. Okay, let me ask you a few questions:
- What tool are you using to generate classes (and descriptors) ?
- Do you compile your descriptor classes ?
- Do you package the compiled descriptors and the generated .castor.cdr
files into your web application ?
And more importantly, are you ....
- deploying standard WAR files on Tomcat ?
- having all dependencies (incl. Castor) provided within WEB-INF/lib of
your web application ?
Regards
Werner
On 29.03.2010 14:56, Paul French wrote:
Hello All,
This seems to be a common problem but I can't seem to find the
solution.
We use castor to marshall and unmarshall using package descriptors/.cdr
files.
All is fine in eclipse. When deploying to tomcat due to where certain
libraries are placed we get classnotfound exceptions. Basically I
need to
tell the marshaller and unmarshaller what class loader to use. How
can I
do
this?
Thanks
Paul
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
__________ NOD32 5003 (20100406) Information __________
This message was checked by NOD32 antivirus system.
http://www.eset.com
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
__________ NOD32 5007 (20100407) Information __________
This message was checked by NOD32 antivirus system.
http://www.eset.com
---------------------------------------------------------------------
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
__________ NOD32 5009 (20100408) Information __________
This message was checked by NOD32 antivirus system.
http://www.eset.com
---------------------------------------------------------------------
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