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
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.
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.
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