Issue Details (XML | Word | Printable)

Key: CACTUS-246
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Petar Tahchiev
Reporter: Davy Toch
Votes: 4
Watchers: 5
Operations

If you were logged in you would be able to see more operations.
Cactus

Jakarta Cactus 1.7.2 won't work with Apache ANT 1.7.0.

Created: 17/Oct/06 11:09 PM   Updated: 24/Aug/08 02:20 PM
Return to search
Component/s: Ant Integration
Affects Version/s: 1.7.2
Fix Version/s: 1.8

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works build-246.patch 2006-12-22 12:17 AM Petar Tahchiev 1 kB
Text File Licensed for inclusion in ASF works cactuspatch.txt 2008-02-19 06:09 AM Ken 0.6 kB
Environment:
- Win XP
- Apache ANT 1.7.0Beta3
- JDK 1.5

Resolution Date: 24/Aug/08 02:20 PM


 Description  « Hide
Doing a quick test with Jakarta Cactus 1.7.2 on the latest beta release of Apache ANT 1.7.0 revealed the following
error message in Cactus:

java.lang.NoSuchMethodError: org.apache.cactus.integration.ant.CactusTask.addClasspathEntry(Ljava/lang/String;)V

Reason: in ant-junit.jar the signature of the method 'addClasspathEntry' of the class JUnitTask has been modified between ANT 1.6.5 and ANT 1.7.0:

ANT 1.6.5:

  protected void addClasspathEntry(String resource)

ANT 1.7.0:

  protected boolean addClasspathEntry(String resource)



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Petar Tahchiev added a comment - 22/Dec/06 12:17 AM
Davi hi,

Thank you for pointing this.

I also noticed this problem with one of the first BETA versions of Apache ANT 1.7, but I decided to wait till the official release of ANT 1.7. Here I am attaching a patch that solves the issue.

Petar Tahchiev made changes - 22/Dec/06 12:17 AM
Field Original Value New Value
Attachment build-246.patch [ 12347708 ]
Petar Tahchiev added a comment - 22/Dec/06 02:01 PM
Davy this behaviour seems like a classpath issue problem. It turns out that when I have something that had been built other version of ant (different than 1.7.0) and you try to build it with the new version of Ant it complains. The real solution is to just ensure you have cleaned everything with
ant clean
and then try building it with ant.
HTH

Davy Toch added a comment - 22/Dec/06 04:21 PM
No, I don't think I had a local classpath issue because I
did the following in DOS:

1. set CLASSPATH=
2. set ANT_HOME=
3. download and unzip fresh copy of Jakarta Cactus 13-1.7.2
4. download and unzip fresh copy of Apache ANT 1.6.5
5. download and unzip fresh copy of Apache ANT 1.7.0

6. go to the subfolder samples/ejb of Jakarta Cactus and type:

6.1 set ANT_HOME=...home of fresh Apache ANT 1.6.5 ...
6.2 %ANT_HOME%\bin\ant -version ---> 1.6.5 OK
6.3 %ANT_HOME%\bin\ant clean test

    ...\samples\ejb\build.xml:134: taskdef A class needed by
    class org.apache.cactus.integration.ant.CactusTask
    cannot be found: junit/framework/Test

    So junit not found.

6.4 copy junit-3.8.1.jar to %ANT_HOME%\lib
6.5 %ANT_HOME%\bin\ant clean test ---> OK

7. go to the subfolder samples/ejb of Jakarta Cactus and type:

7.1 set ANT_HOME=...home of fresh Apache ANT 1.7.0 ...
7.2 %ANT_HOME%\bin\ant -version ---> 1.7.0 OK
7.3 %ANT_HOME%\bin\ant clean test ---> NOK

    BUILD FAILED java.lang.NoSuchMethodError:
    org.apache.cactus.integration.ant.CactusTask.
      addClasspathEntry(Ljava/lang/String;)V

Remarks :
- I tried it with JDK 1.4 and JDK 1.5, but both show the
  same behaviour
- when using ANT 1.6.5, the jar junit 3.8.1 must be copied
  to %ANT_HOME%\lib, because otherwise the following error
  message appears :

    ...\samples\ejb\build.xml:134: taskdef A class needed by
    class org.apache.cactus.integration.ant.CactusTask
    cannot be found: junit/framework/Test

  With ANT 1.7.0, I didn't get this error message, but
  perhaps this is because this error message appears only
  after the following error message:

    BUILD FAILED java.lang.NoSuchMethodError:
    org.apache.cactus.integration.ant.CactusTask.
      addClasspathEntry(Ljava/lang/String;)V

Felipe Leme added a comment - 29/Dec/06 01:40 AM
Hi all,

I could reproduce the error following the previous instructions from Davy on Cactus 1.7.2.

When I tried on the SVN code, it worked fine if I hadn't defined any server. But once I tried to run the tests against Tomcat, I got the same issue, even applying the supplied path.

I think we have 2 options: upgrade Ant dependency to 1.7.0 or write some wrapping code that calls the right method (that would be an ugly hack).

Petar, could you check with the Ant guys what would be the 'official' recommendation (if any) for this issue?

-- Felipe

Jeffrey Bennett added a comment - 06/Apr/07 02:12 AM
Has there been any progress on this issue?

I suspect you'll need to support both Ant 1.6 and 1.7 simultaneously. Why not do something like?
Leave org.apache.cactus.integration.ant.CactusTask alone (link it against Ant 1.6)
Create org.apache.cactus.integration.ant.Ant17CactusTask (link it against Ant 1.7)
Create a series of parallel tasks <ant17cactus> <ant17cactifywar> etc.

When switching to Ant 1.7, consumers would need to change from <cactus> to <ant17cactus> etc.

OK, I admit, slightly hokey and clumsy, but it gets the job done.

I've been waiting for a resolution, but would be satisfied with a "We'll address this in version X" statement.

Jeffrey Bennett added a comment - 06/Apr/07 02:17 AM
An alternative (and cleaner) proposal:

Change CactusTask such that it holds an instance of Ant 1.7 and an Ant 1.6 task. Modify it such that rather than extending, it delegates (to 1.6 by default, but an optional argument "ant_version=1.7" can cause it to delegate otherwise).

Upgrading then consists of changing <cactus> to <cactus ant_version=1.7>

Davy Toch added a comment - 06/Apr/07 05:52 PM
Or even cleaner:

Change CactusTask such that it holds an instance of Ant 1.7 and an Ant 1.6 task. Modify it such that rather than extending, it delegates depending on the Java environment property ${ant.version}.

This way you shouldn't add the attribute "ant_version=1.7" to <cactus>.

Peter Doornbosch added a comment - 02/May/07 03:43 PM
For those not so familiar with the cactus sources:
Please note that the patch should be applied to the build.xml file in the integration/ant directory.

Michal Valach made changes - 14/Dec/07 02:28 PM
Comment [ Hi,
I have little problem applying this patch.
Can you pls help me and write step by step guide, how to apply it?
Thank you ]
Ken made changes - 19/Feb/08 06:02 AM
Attachment cactuspatch.txt [ 12375894 ]
Ken made changes - 19/Feb/08 06:08 AM
Attachment cactuspatch.txt [ 12375894 ]
Ken made changes - 19/Feb/08 06:09 AM
Attachment cactuspatch.txt [ 12375895 ]
Ken added a comment - 19/Feb/08 06:11 AM - edited
Attached a patch allowing Cactus to work with Ant nightly-20071115113719 (1.7.1-alpha).

Petar Tahchiev made changes - 24/Aug/08 02:19 PM
Assignee Petar Tahchiev [ paranoiabla ]
Petar Tahchiev added a comment - 24/Aug/08 02:20 PM
Cactus works with Ant 1.7.1 but cannot work with Ant 1.7.0.

Petar Tahchiev made changes - 24/Aug/08 02:20 PM
Resolution Fixed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 1.8 [ 12310167 ]
Petar Tahchiev made changes - 24/Aug/08 02:20 PM
Status Resolved [ 5 ] Closed [ 6 ]