You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Michelle Lin <mc...@yahoo.com> on 2008/11/22 09:58:17 UTC
classpath problem with custom task
Hi experts,
I'm having strange classpath problem with custom task.
The ANT version I use is:
Apache Ant version 1.7.0 compiled on December 13 2006
and the JAVA version is 1.6
I have a java class XYZ.java that calls JMX client APIs to get mbean server and then get the mbean and invoke the operation on the mbean.
To invoke this class, I need two jars: x1.jar and wljmxclient.jar.
I defined following <path>:
<path id="task.class.path">
<pathelement location="..../x1.jar"/>
<pathelement location="...../wljmxclient.jar"/>
</path>
<property name="tasks.class.path" refid="tasks.class.path"/>
Using this <path> definition and invoking XYZ class directly works fine:
<target name="testme">
<input message="...." addproperty="host"/>
...
<java classname="....XYZ", fork="true">
<classpath refid="tasks.class.path"/>
<arg value="..."/>
...
</java>
</target>
I have following message:
-------
-------------
[java] Connecting to: service:jmx:t3://<host>:<port>/jndi/weblogic.management.mbeanservers.runtime
BUILD SUCCESSFUL
------------------
Then I write a custom task XYZTask.java that gathers and validates user inputs, and calls XYZ class to do the same thing. This XYZTask.java is also in x1.jar. And I have following definition:
<taskdef name="myTask" classname="...XYZTask">
<classpath>
<pathelement path="${tasks.class.path}"/>
</classpath>
</taskdef>
<target name="testme">
<input message="...." addproperty="host"/>
...
<myTask host="${host}" .../>
</target>
And I'm seeing following error:
-------------------------------
[myTask] Connecting to: service:jmx:t3://<host>:<port>/jndi/weblogic.management.mbeanservers.runtime
[myTask] java.net.MalformedURLException: Unsupported protocol: t3
[myTask] at javax.management.remote.JMXConnectorFactory.newJMXConnector(JMXConnectorFactory.java:327)
...
-----------------------
This seems to me the "wljmxclient.jar" is not in the classpath when XYZ class is invoked.
Anything wrong with what I'm doing?
Thank you in advance for any suggestions/tips...
- michelle
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org