ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ramu Sethu" <sra...@yahoo.co.in>
Subject Re: No class Def Error
Date Wed, 03 Oct 2007 05:20:48 GMT
Thanks Steve for your reply....

I thought of avoiding asking this question... If it is a problem with java
apis, how come the lookup process in junit
test cases are working (JUNIT TASK)??

On 10/2/07, Steve Loughran <stevel@apache.org> wrote:
>
> Ramu Sethu wrote:
> > Hi all
> >
> > 'Tried my best to solve this problem on my own, but i couldn't solve it.
> so
> > asking the experts
> > I will summarize again my problem. We have a class path ref which refers
> to
> > jboss-all-client jar and other dependent jars. I am using this class
> path
> > ref in two places
> > In junit task and in my custom task definition
> > The process(lookup) what i do with the classes in jboss-all-client.jaris
> > same in both the places.
> > Junit task works perfectly as i expected.
> > But my custom task throws the below exception
> >
> > MyTask] javax.naming.NoInitialContextException: Cannot instantiate
> > class: org.jnp.interfaces.NamingContextFactory
> > Root exception is java.lang.ClassNotFoundException:
> > org.jnp.interfaces.NamingContextFactory
> >
> > (Full trace below)
> >
> > I solved this problem temporarily by adding the jboss-all-client.jar in
> > system classpath variable.
> >
> > Why do i face this problem? whats worng here? when it is working in
> junit
> > task why not in custom task?
> > Any thing i can do in the custom task do avoid this problem?
>
> that sounds like the perennial classloader hierarchy problem. The JNDI
> libs are looking for some class in the system classpath, not lower down.
> So when you call some JNDI method, it goes
> Class.forName("org.jnp.interfaces.NamingContextFactory"). For it, there
> is no class.
>
> I'm not sure there is an easy fix here. Its a weakness of a lot of the
> central java apis that have the 'factory' pattern: xml parsers,  URL
> handlers, java.util.logging, etc.
>
> Could your custom code run in a separate process, rather than just a
> custom task? your custom task would create a Java class instance and
> configure it to run the program; results can be passed back via some
> file (property files the easiest, XML files the most complex).
>
> -steve
> --
> Steve Loughran                  http://www.1060.org/blogxter/publish/5
> Author: Ant in Action           http://antbook.org/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>


-- 
Thank you
Ramu S

  If A is success in life, then A equals x plus y plus z. Work is x; y is
play; and z is keeping your mouth shut.
- Albert Einstein

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message