You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by "Murphy, Eric" <er...@pfc.cfs.nrcan.gc.ca> on 2005/02/28 21:21:39 UTC

ClassCastException

XmlBeans -

I have deployed two Tomcat java applications. They each have their own
copies of the identical xbean.jar in the applications WEB-INF lib directory.
This is to isolate the applications from the users Tomcat environment by not
putting the xbean.jar into the Tomcat/common/lib.

One application, the controller, talks to the other, a worker, and passes an
XmlObject to the worker in the request. The controller creates the object by
reading in an Xml stream:

XmlObject xmlObject = XmlObject.Factory.parse(inputStream);

Upon discovering where the xmlObject should go, the master forwards it to
the appropriate slave application (only one slave is implemented at the
current time) for processing. When the slave retrieves the XmlObject from
the request, using its own copy of xbeans.jar:

XmlObject xmlObj  = (XmlObject)request.getAttribute(XML_REQUEST_DOC);

a ClassCastException occurs. If a xbeans.jar is accessed from
tomcat/common/lib there is no problem. What is the explanation of this?

Eric Murphy
Software Developer (NFIS)

erimurph@pfc.forestry.ca
tel/tél: 250-363-6038
fax / télécopieur 250-363-6004

Natural Resources Canada
Pacific Forestry Centre
506 West Burnside Road
Victoria BC V8Z 1M5

Ressources naturelles Canada
Centre de foresterie du Pacifique
506 rue Burnside ouest
Victoria, Colombie-Britanique V8Z 1M5

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


Re: ClassCastException

Posted by Jorg Heymans <jh...@domek.be>.
"Two rodents are not better than one"

http://www.artima.com/legacy/design/dynaext/messages/35.html

bottom line: casting involves not only the object type, but also the 
classloader.

HTH
Jorg


Murphy, Eric wrote:
> XmlBeans -
> 
> I have deployed two Tomcat java applications. They each have their own
> copies of the identical xbean.jar in the applications WEB-INF lib directory.
> This is to isolate the applications from the users Tomcat environment by not
> putting the xbean.jar into the Tomcat/common/lib.
> 
> One application, the controller, talks to the other, a worker, and passes an
> XmlObject to the worker in the request. The controller creates the object by
> reading in an Xml stream:
> 
> XmlObject xmlObject = XmlObject.Factory.parse(inputStream);
> 
> Upon discovering where the xmlObject should go, the master forwards it to
> the appropriate slave application (only one slave is implemented at the
> current time) for processing. When the slave retrieves the XmlObject from
> the request, using its own copy of xbeans.jar:
> 
> XmlObject xmlObj  = (XmlObject)request.getAttribute(XML_REQUEST_DOC);
> 
> a ClassCastException occurs. If a xbeans.jar is accessed from
> tomcat/common/lib there is no problem. What is the explanation of this?
> 
> Eric Murphy
> Software Developer (NFIS)
> 
> erimurph@pfc.forestry.ca
> tel/tél: 250-363-6038
> fax / télécopieur 250-363-6004
> 
> Natural Resources Canada
> Pacific Forestry Centre
> 506 West Burnside Road
> Victoria BC V8Z 1M5
> 
> Ressources naturelles Canada
> Centre de foresterie du Pacifique
> 506 rue Burnside ouest
> Victoria, Colombie-Britanique V8Z 1M5


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org