You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Suman N <Su...@curamsoftware.com> on 2010/02/05 11:59:09 UTC

Reference not found.

Hi,

I am using Ant 1.8RC1.
I have a test.xml file, which is used to execute the same set of tests for 3 different application server environments. (ie in SUN, IBM and SAP). We call 3 different commands to run the tests in its corresponding environment.
Example:
 ant suntest
 ant ibmtest
 ant saptest

We set the application server specific path (sun.ejb.classpath, ibm.ejb.classpath, sap. ejb.classpath) in suntest, ibmtest and saptest targets.
These targets will call its corresponding targets (suntest.without.clean, ibmtest.without.clean, ibmtest.without.clean).
All these three targets will further call incontainertest, where we set the classpath by referencing the path defined in suntest, ibmtest and saptest targets.

The truncated test.xml file is given below.

  <target name="suntest"
          description="Runs in-container tests against SUN.">
    <path id=" sun.ejb.classpath">
      <pathelement location="${WLS_HOME}/lib/weblogic.jar"/>
    </path>
    <antcall target="suntest.without.clean" inheritRefs="true" inheritAll="true"/>
  </target>

  <target name="ibmtest"
          description="Runs in-container tests against IBM.">

     <path id="ibm.ejb.classpath">
       <pathelement location="${profile.directory}/properties"/>
       <pathelement path="${sysenv.WAS_HOME}/runtimes/com.ibm.ws.admin.client_7.0.0.jar"/>
       <pathelement path="${sysenv.WAS_HOME}/plugins/com.ibm.ws.runtime.jar"/>
       <pathelement path="${sysenv.WAS_HOME}/plugins/com.ibm.ws.emf.jar"/>
    </path>
    <path id="zos.ejb.classpath">
      <pathelement path="${sysenv.WAS_HOME}/lib/bootstrap.jar"/>
      <pathelement path="${sysenv.WAS_HOME}/lib/bootstrapws390.jar"/>
      <pathelement path="${sysenv.WAS_HOME}/lib/wasupgradews390.jar"/>
      <pathelement path="${sysenv.WAS_HOME}/plugins/com.ibm.ws.runtime.ws390_6.1.0.jar"/>
    </path>
    <antcall target="ibmtest.without.clean" inheritRefs="true" inheritAll="true"/>

  </target>

  <target name="saptest"
          description="Runs in-container tests against NetWeaver SAP.">
    <path id="sap.ejb.classpath">
      <pathelement location="${sysenv.NAS_HOME}/j2ee/j2eeclient/sap.com~tc~je~clientlib~impl.jar"/>
      <pathelement location="${sysenv.NAS_HOME}/j2ee/j2eeclient/sap.com~tc~exception~impl.jar"/>
      <pathelement location="${sysenv.NAS_HOME}/j2ee/j2eeclient/sap.com~tc~logging~java~impl.jar"/>
      <pathelement location="${sysenv.NAS_HOME}/j2ee/cluster/bin/interfaces/container_api/sap.com~tc~je~container_api~impl.jar"/>    </path>

    <antcall target="saptest.without.clean" inheritRefs="true" inheritAll="true"/>

  </target>

  <target name=" suntest.without.clean">
    <property name="as.vendor" value="BEA"/>
    <antcall target=" incontainertest" inheritRefs="true" inheritAll="true">
      <param name="as.vendor" value="BEA"/>
      <param name="as.vendor.is.bea" value="true"/>
      <param name="curam.server.port" value="${curam.server.port}" />
    </antcall>
  </target>

  <target name=" ibmtest.without.clean ">
    <!-- 36877: Must set inheritall to true here, or the test failure override
         does not get propagated and clover fails before producing a report. -->
    <antcall target=" incontainertest" inheritRefs="true" inheritAll="true">
      <param name="as.vendor" value="IBM"/>
      <param name="as.vendor.is.ibm" value="true"/>
    </antcall>
  </target>

  <target name="saptest.without.clean">
    <antcall target=" incontainertest" inheritRefs="true" inheritAll="true">
      <param name="as.vendor" value="SAP"/>
      <param name="as.vendor.is.sap" value="true"/>
    </antcall>
  </target>

  <target name="incontainertest" unless="disable.incontainertest">
    <antcall target="was.replace.encoding" inheritRefs="true" inheritAll="true"/>
    <junit fork="${java.fork}"
           haltonfailure="no"
           dir="${jde.root}"
           errorproperty="junit.error"
           forkmode="once"
           showoutput="true"
           reloading="false"
           tempdir="${dir.bld}"
           failureproperty="junit.failure">
      <jvmarg value="-Xmx${java.maxmemory}"/>
      <jvmarg value="-Dcom.ibm.CORBA.loginUserid=beantester"/>
      <jvmarg value="-Dcom.ibm.CORBA.loginPassword=password"/>
      <jvmarg value="-Dcom.ibm.CORBA.loginSource=properties"/>
      <jvmarg value="-Dcom.ibm.CORBA.ConfigURL=file:${sas.client.props}.temp"/>
      <jvmarg value="-Dcom.ibm.SSL.ConfigURL=file:${ssl.client.props}"/>
      <sysproperty key="curam.environment.tnameserv.port" value="${curam.environment.tnameserv.port}"/>
      <sysproperty key="curam.sdejtest.datasets.location" value="${dir.mod.testdatasets}"/>
      <sysproperty key="curam.sdejtest.vendor"            value="${as.vendor}"/>
      <sysproperty key="curam.disable.dynamic.properties" value="true"/>
      <sysproperty key="curam.server.port"                value="${curam.server.port}" />
      <sysproperty key="java.library.path"                value="${zos.java.library.path}" />

      <classpath>
        <path refid="junit.common.classpath"/>
        <path refid="sun.ejb.classpath"/>
       <path refid="ibm.ejb.classpath"/>
        <path refid="zos.ejb.classpath"/>
        <path refid="nas.ejb.classpath"/>
        <pathelement path="${jar.wsdl4j}"/>
        <!-- stubs of the beans -->
        <pathelement path="${dir.test.lib}/stubs.jar"/>
      </classpath>
      <formatter type="plain" usefile="false"/>
      <formatter type="xml"/>
      <batchtest todir="${dir.junit.results}">
        <fileset dir="${dir.cls.unittests}"
                 includes="curam/util/test/suite/EJBTestSuite.class"/>
      </batchtest>
    </junit>
  </target>


We do set inheritRefs to true so that the called ant target will have references of all the path defined in the calling target, but still we get the following error when we run any test.

Reference ibm.ejb.classpath not found.

I do know that the followin warning is thrown in ANT 1.7


Warning: Reference ibm.ejb.classpath has not been set at runtime, but was found during build file parsing, attempting to resolve. Future versions of Ant may support  referencing ids defined in non-executed targets.

If I define these path ids just under the project level, this works, but my requirement is to define these path id's differently for different Application servers and hence, I cannot define them in a non-executed target.
Is there any way in ANT 1.8RC1, where we can set these path id's differently for different environments and then not get this error when setting the references to classpath.

Can use any conditional while setting the classpath?

Cheers,
Suman.N


The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorized. If you are not the intended recipient, any disclosure,
copying, distribution or any action taken or omitted to be taken in reliance
on it, is prohibited and may be unlawful. If you are not the intended
addressee please contact the sender and dispose of this e-mail. Thank you.