Cactus
  1. Cactus
  2. CACTUS-80

tools.jar not found from within Eclipse

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.5
    • Fix Version/s: None
    • Component/s: Ant Integration
    • Labels:
      None
    • Environment:
      Operating System: Other
      Platform: Other

      Description

      This is specifically concerning the cactus ant tasks run from within Eclipse.
      This Bug was raised by request after a detailed discussion in Cactus Users.

      As I understand it Eclipse isn't playing by the rules and is running Ant from
      within a JRE JVM instance rather than a JVM anchored to the SDK, with access to
      tools.jar. This is exasperated by some code within Cactus
      (AbstractJavaContainer according to Google) that makes various assumptions
      regarding the location of the file. Result is that tools.jar cannot be found.

      For your analysis I include comparative output from my buildfile launched from
      the commandine and from Eclipse. Clearly my build is still not working but as
      far as I can tell that is another issue I will have to reasearch.

      Eclipse:

      [cactus] -----------------------------------------------------------------
      [cactus] Running tests against Tomcat 4.1.29
      [cactus] -----------------------------------------------------------------
      [cactus] Deleting 4 files from C:\DOCUME~1\SIMONG~1.TRO\LOCALS~1
      \Temp\cactus\tomcat4x
      [cactus] Deleted 2 directories from C:\DOCUME~1\SIMONG~1.TRO\LOCALS~1
      \Temp\cactus\tomcat4x
      [cactus] Couldn't find tools.jar (needed for JSP compilation)
      You must either set location or path on <pathelement>
      at org.apache.tools.ant.types.Path.list(Path.java:309)
      at org.apache.tools.ant.types.Path.list(Path.java:320)
      at org.apache.tools.ant.types.Path.addExisting(Path.java:260)
      at org.apache.tools.ant.types.Path.concatSystemClasspath(Path.java:551)
      at org.apache.tools.ant.types.CommandlineJava.size
      (CommandlineJava.java:346)
      at org.apache.tools.ant.types.CommandlineJava.getCommandline
      (CommandlineJava.java:248)
      at org.apache.tools.ant.types.CommandlineJava.describeCommand
      (CommandlineJava.java:311)
      at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:138)
      at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108)
      at
      org.apache.cactus.integration.ant.container.tomcat.AbstractCatalinaContainer.inv
      okeBootstrap(AbstractCatalinaContainer.java:214)
      at
      org.apache.cactus.integration.ant.container.tomcat.Tomcat4xContainer.startUp
      (Tomcat4xContainer.java:98)
      at org.apache.cactus.integration.ant.container.ContainerRunner$1.run
      (ContainerRunner.java:179)
      at java.lang.Thread.run(Thread.java:536)
      [cactus] BUILD FAILED: file:H:/Finance/Finance
      Projects/Development/Finance Reporting App/tomcatProject/build.xml:139: Failed
      to start the container after more than [60000] ms. Trying to connect to the
      http://localhost:8080/reportingapp/ServletRedirector?Cactus_Service=RUN_TEST
      test URL yielded a [-1] error code. Please run in debug mode for more details
      about the error.

      Command Line:

      [cactus] -----------------------------------------------------------------
      [cactus] Running tests against Tomcat 4.1.29
      [cactus] -----------------------------------------------------------------
      [cactus] Deleting 5 files from C:\DOCUME~1\SIMONG~1.TRO\LOCALS~1\Temp\cactus\
      tomcat4x
      [cactus] Deleted 8 directories from C:\DOCUME~1\SIMONG~1.TRO\LOCALS~1\Temp\ca
      ctus\tomcat4x

      BUILD FAILED
      file:H:/Finance/Finance%20Projects/Development/Finance%20Reporting%20App/tomcatP
      roject/build.xml:140: Failed to start the container after more than [60000] ms.
      Trying to connect to the [http://localhost:8080/reportingapp/ServletRedirector?C
      actus_Service=RUN_TEST] test URL yielded a [-1] error code. Please run in debug
      mode for more details about the error.

        Activity

        Hide
        Vincent Massol added a comment -

        For the record, the code to be fixed is the following:

        protected final File getToolsJar() throws FileNotFoundException
        {
        String javaHome = System.getProperty("java.home");
        File toolsJar = new File(javaHome, "../lib/tools.jar");
        if (!toolsJar.isFile())

        { throw new FileNotFoundException(toolsJar.getAbsolutePath()); }

        return toolsJar;
        }

        Show
        Vincent Massol added a comment - For the record, the code to be fixed is the following: protected final File getToolsJar() throws FileNotFoundException { String javaHome = System.getProperty("java.home"); File toolsJar = new File(javaHome, "../lib/tools.jar"); if (!toolsJar.isFile()) { throw new FileNotFoundException(toolsJar.getAbsolutePath()); } return toolsJar; }
        Hide
        Felipe Leme added a comment -

        Just for the record too: another possible fix would be setting eclipse to use a JDK, instead of JRE. In fact, if that works, we should mark this bug as invalid, as that is a requirement for many eclipse tasks (like JSP compiling and J2EE deploying).

        Show
        Felipe Leme added a comment - Just for the record too: another possible fix would be setting eclipse to use a JDK, instead of JRE. In fact, if that works, we should mark this bug as invalid, as that is a requirement for many eclipse tasks (like JSP compiling and J2EE deploying).

          People

          • Assignee:
            Unassigned
            Reporter:
            Simon Gibbs
          • Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development