You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by David Rush <da...@rushtone.com> on 2011/01/12 16:21:44 UTC

SplitClassLoader cast error

I use ant from the command line for building my apps and running my tests.

I'm trying to get testing working for a servlet that forwards to a .jsp 
page (using HttpUnit with ServletUnit), but I keep hitting a wall:

     [junit] Error testing ViewAllProjectsServlet, exception is 
com.meterware.httpunit.HttpInternalErrorException: Error on HTTP 
request: 500 java.lang.ClassCastException: 
org.apache.tools.ant.util.SplitClassLoader cannot be cast to 
java.net.URLClassLoader [http://localhost/viewallprojects.jsp]
     [junit]     at 
AccTestViewAllProjectsServlet2.test1(AccTestViewAllProjectsServlet2.java:76)

When deployed, the servlet+jsp is working correctly, but I'm trying to 
build some tests before I start making some substantial updates to the 
code (which was originally written with no corresponding tests).

Can anybody give me a clue on the ClassCastException?

David

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


Re: SplitClassLoader cast error

Posted by Antoine Levy Lambert <an...@gmx.de>.
Hello David,

I am not sure whether SplitClassLoader extends URLClassLoader.

In my IDE I see this class hierarchy

SplitClassLoader ---> AntClassLoader --> ClassLoader --> Object

So maybe the source code of your unit test is doing something wrong.

Regards,

Antoine

On 1/12/11 10:21 AM, David Rush wrote:
> I use ant from the command line for building my apps and running my 
> tests.
>
> I'm trying to get testing working for a servlet that forwards to a 
> .jsp page (using HttpUnit with ServletUnit), but I keep hitting a wall:
>
>     [junit] Error testing ViewAllProjectsServlet, exception is 
> com.meterware.httpunit.HttpInternalErrorException: Error on HTTP 
> request: 500 java.lang.ClassCastException: 
> org.apache.tools.ant.util.SplitClassLoader cannot be cast to 
> java.net.URLClassLoader [http://localhost/viewallprojects.jsp]
>     [junit]     at 
> AccTestViewAllProjectsServlet2.test1(AccTestViewAllProjectsServlet2.java:76)
>
> When deployed, the servlet+jsp is working correctly, but I'm trying to 
> build some tests before I start making some substantial updates to the 
> code (which was originally written with no corresponding tests).
>
> Can anybody give me a clue on the ClassCastException?
>
> David
>


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