ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wohlgemuth <berlinguyi...@gmail.com>
Subject Re: weird class problem the second - can't find org.jnp.interfaces.NamingContextFactory
Date Wed, 09 Aug 2006 16:21:48 GMT
ok I found an ugly solution but it works.

basicly in my taks I create an instance of the java task and give it
the reference to the classpath + plus the needed parameter.

	public void execute() throws BuildException {
		try {
			Java java = new Java();
			java.setProject(getProject());
			java.setFork(true);

			Iterator<Path> it = path.iterator();

			while (it.hasNext()) {
				java.setClasspath(it.next());
			}
			java.setClassname(getClass().getName());

			StringWriter writer = new StringWriter();
			PrintWriter print = new PrintWriter(writer);
			this.getProperties().list(print);
			java.createArg().setValue(writer.toString());
			java.createArg().setValue(this.getFactory());

			java.execute();
		} catch (Exception e) {
			throw new BuildException(e);
		}
	}

	public static void main(String[] args) throws Exception {
		Project pro = new Project();

		Properties p = new Properties();
		RegisterReport report = new RegisterReport();
		report.setProject(pro);
		report.setFactory(args[1]);

		p.load(new StringInputStream(args[0]));

		report.run(p);
	}


On 8/9/06, wohlgemuth <berlinguyinca@gmail.com> wrote:
> sofar I found out that the problem is located in the ant classpath, If
> I copy all my libs into the ant lib directory everything is working
> fine.
>
> It's just there need to be an easier way, cause I can't force the user
> of this software to always copy the nearly 50 libs into there ant
> directory.
>
> anybody has a clean solution for this problem?
>
> and the -lib flag doesnt work anymore....
>
> Apache Ant version 1.6.5 compiled on June 2 2005
> -lib not supported
> Configure the Ant runtime classpath using either the
> global Ant runtime classpath or the Ant runtime classpath
>  for this particular build
> Total time: 31 milliseconds
>
> /gert
>
>
> On 8/9/06, wohlgemuth <berlinguyinca@gmail.com> wrote:
> > hi I try to call an ejb from an ant task and get always:
> >
> >  [register] (util.RocksClusterFactoryImpl        50  ) create new
> > implementation of the cluster util
> >  [register] javax.naming.NoInitialContextException: Cannot instantiate
> > class: org.jnp.interfaces.NamingContextFactory [Root exception is
> > java.lang.ClassNotFoundException:
> > org.jnp.interfaces.NamingContextFactory]
> >  [register] at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
> >  [register] at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
> >  [register] at javax.naming.InitialContext.init(Unknown Source)
> >  [register] at javax.naming.InitialContext.<init>(Unknown Source)
> >  [register] at edu.ucdavis.genomics.metabolomics.binbase.cluster.ejb.delegate.ClusterReportConfigServiceUtil.lookupHome(ClusterReportConfigServiceUtil.java:20)
> >  [register] at edu.ucdavis.genomics.metabolomics.binbase.cluster.ejb.delegate.ClusterReportConfigServiceUtil.getHome(ClusterReportConfigServiceUtil.java:42)
> >  [register] at edu.ucdavis.genomics.metabolomics.binbase.cluster.util.RocksClusterImplementation.registerReport(RocksClusterImplementation.java:486)
> >  [register] at edu.ucdavis.genomics.metabolomics.binbase.cluster.ant.RegisterReport.execute(RegisterReport.java:29)
> >  [register] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
> >  [register] at org.apache.tools.ant.Task.perform(Task.java:364)
> >  [register] at org.apache.tools.ant.Target.execute(Target.java:341)
> >  [register] at org.apache.tools.ant.Target.performTasks(Target.java:369)
> >  [register] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
> >  [register] at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
> >  [register] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
> >  [register] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
> >  [register] at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
> >  [register] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
> >  [register] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
> >  [register] Caused by: java.lang.ClassNotFoundException:
> > org.jnp.interfaces.NamingContextFactory
> >  [register] at java.net.URLClassLoader$1.run(Unknown Source)
> >  [register] at java.security.AccessController.doPrivileged(Native Method)
> >  [register] at java.net.URLClassLoader.findClass(Unknown Source)
> >  [register] at java.lang.ClassLoader.loadClass(Unknown Source)
> >  [register] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
> >  [register] at java.lang.ClassLoader.loadClass(Unknown Source)
> >  [register] at java.lang.ClassLoader.loadClassInternal(Unknown Source)
> >  [register] at java.lang.Class.forName0(Native Method)
> >  [register] at java.lang.Class.forName(Unknown Source)
> >  [register] at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
> >  [register] ... 19 more
> >
> > I know that my classes are in the path ( cause if I call <java> with
> > this refid it works) so I think there is something weird with my class
> > loading in the task.
> >
> > when I get a refrence to the path element in my task, It tells me the
> > path is empty, so I think there is the problem. Somehow ant doenst
> > export my defined path to my task. I also looked how the java task is
> > implemented, but this didn't help me very much :(
> >
> > thx for your help,
> >
> > /gert
> >
> > --
> > --------------------------------------------------------------------
> > http://fiehnlab.ucdavis.edu/staff/wohlgemuth
> >
> > work:    wohlgemuth@ucdavis.edu
> > phone:   530 754 7113
> >
> > private: wohlgemuth@mindcrime-ilab.de
> > phone:    530 220 3728
> >
>
>
> --
> --------------------------------------------------------------------
> http://fiehnlab.ucdavis.edu/staff/wohlgemuth
>
> work:    wohlgemuth@ucdavis.edu
> phone:   530 754 7113
>
> private: wohlgemuth@mindcrime-ilab.de
> phone:    530 220 3728
>


-- 
--------------------------------------------------------------------
http://fiehnlab.ucdavis.edu/staff/wohlgemuth

work:    wohlgemuth@ucdavis.edu
phone:   530 754 7113

private: wohlgemuth@mindcrime-ilab.de
phone:    530 220 3728

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


Mime
View raw message