ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raja Nagendra Kumar <Nagendra.R...@tejasoft.com>
Subject Class cast exception with executor - class loading issue
Date Fri, 06 Nov 2009 11:51:51 GMT

Hi,

When using the custom executor with taskdef's loaded from project classpath,
I see class cast exception when trying to fetch the executor from project
and casting it to custom class.

java.lang.ClassCastException:
com.tejasoft.ant.utils.executor.TejaMobileExecutor cannot
 be cast to com.tejasoft.ant.utils.executor.TejaMobileExecutor

I read from forums that it is when casting is happening like this

Executor ex = getProject();
	return ((TejaMobileExecutor) ex).getDeviceBuilder();

The class in casting (TejaMobileExecutor) may be getting loaded from a
different classloader than the class which was created in  parents builds
Executor class

 public Executor getSubProjectExecutor()
    {
	return new TejaMobileExecutor();
	//return this;
    }

How to resolve such issue as getSubProjectExecutor() should use parent
builds class loader wher as casting to be done in subproject.

Regards,
Raja Nagendra Kumar,
C.T.O
www.tejasoft.com
-- 
View this message in context: http://old.nabble.com/Class-cast-exception-with-executor---class-loading-issue-tp26230483p26230483.html
Sent from the Ant - Users mailing list archive at Nabble.com.


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


Mime
View raw message