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 Sat, 29 Sep 2007 17:27:44 GMT
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.jar is
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?

Please help me on this problem


On 9/5/07, Ramu Sethu <sramhu@gmail.com> wrote:
>
> hi
>
> We are working in EJB and we use jboss-all-clent.jar. We have custom
> task which makes use jboss-all-cleint.jar
>
> When we run our custom task with the taskdef which has
> jboss-all-client.jar in classpath, what we get is No class found error
> . We avoided this by adding the jar in environment variable class
> path. But i don't know why ant doesn't take the class even though we
> added the jar in class path
>
> Also our junit task test cases uses the same jar. We don't get no
> class def when we run the junit task alone.
>
> Why custom task doesn't take  that from the classpath. Am i missing some
> thing ?
>
>
> I have added the trace below
>
> [MyTask] javax.naming.NoInitialContextException: Cannot instantiate
> class: org.jnp.interfaces.NamingContextFactory [
> Root exception is java.lang.ClassNotFoundException:
> org.jnp.interfaces.NamingContextFactory]
> [MyTask] at javax.naming.spi.NamingManager.getInitialContext(
> NamingManager.java:657)
> [MyTask] at javax.naming.InitialContext.getDefaultInitCtx(
> InitialContext.java:247)
> [MyTask] at javax.naming.InitialContext.init(InitialContext.java:223)
> [MyTask] at javax.naming.InitialContext.<init>(InitialContext.java:197)
> [MyTask] at
> com.cisco.dcbu.dcm.qatest.app.intialsetup.TelnetAccess.MyTask.execute(
> MyTask.java:119)
> [MyTask] at org.apache.tools.ant.UnknownElement.execute(
> UnknownElement.java:288)
> [MyTask] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [MyTask] at sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:39)
> [MyTask] at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:25)
> [MyTask] at java.lang.reflect.Method.invoke(Method.java:585)
> [MyTask] at org.apache.tools.ant.dispatch.DispatchUtils.execute(
> DispatchUtils.java:105)
> [MyTask] at org.apache.tools.ant.Task.perform(Task.java:348)
> [MyTask] at org.apache.tools.ant.Target.execute(Target.java:357)
> [MyTask] at org.apache.tools.ant.Target.performTasks(Target.java:385)
> [MyTask] at org.apache.tools.ant.Project.executeSortedTargets(Project.java
> :1329)
> [MyTask] at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
> [MyTask] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(
> DefaultExecutor.java:41)
> [MyTask] at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
> [MyTask] at org.apache.tools.ant.Main.runBuild(Main.java:698)
> [MyTask] at org.apache.tools.ant.Main.startAnt(Main.java:199)
> [MyTask] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
> [MyTask] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
> [MyTask] Caused by: java.lang.ClassNotFoundException:
> org.jnp.interfaces.NamingContextFactory
> [MyTask] at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
> [MyTask] at java.security.AccessController.doPrivileged(Native Method)
> [MyTask] at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> [MyTask] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> [MyTask] at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> [MyTask] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
> [MyTask] at java.lang.Class.forName0(Native Method)
> [MyTask] at java.lang.Class.forName(Class.java:242)
> [MyTask] at com.sun.naming.internal.VersionHelper12.loadClass(
> VersionHelper12.java:42)
> [MyTask] at javax.naming.spi.NamingManager.getInitialContext(
> NamingManager.java:654)
> [MyTask] ... 24 more
> [MyTask] javax.naming.NoInitialContextException: Cannot instantiate
> class: org.jnp.interfaces.NamingContextFactory [
> Root exception is java.lang.ClassNotFoundException:
> org.jnp.interfaces.NamingContextFactory]
>
> --
> 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
>



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