Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] jetty-ant-task: ContextHandler not found

You have refid="jetty.dependencies" being used in your ant project file, but nothing seems to be declaring that id.
How are you setting the "jetty.dependencies" id?

You are missing the id on the <mvn:dependencies> declaration ...

          <mvn:dependencies id="jetty.dependencies"> <!-- This line changed -->
            <mvn:dependency groupId="org.eclipse.jetty" artifactId="jetty-slf4j-impl" version="11.0.8" scope="runtime" />
            <mvn:dependency groupId="org.eclipse.jetty" artifactId="jetty-server" version="11.0.8" scope="runtime"/>
            <mvn:dependency groupId="org.eclipse.jetty" artifactId="jetty-ant" version="11.0.8" scope="runtime" />
          </mvn:dependencies>

Joakim Erdfelt / joakim@xxxxxxxxxxx


On Wed, Mar 2, 2022 at 7:59 AM Andreas Mixich via jetty-users <jetty-users@xxxxxxxxxxx> wrote:
Hello Joakim,

thanks for taking the time, you wrote:

           <Set name="resourceBase">S:/Users/me/Code</Set>

use a URL syntax here, example: file://S:/Users/me/Code

Ok, corrected.

      [typedef] SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
      [typedef] SLF4J: Defaulting to no-operation (NOP) logger implementation
      [typedef] SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

Add any valid slf4j implementation jar.
The easiest would be to add the jetty-slf4j-impl to your dependencies.
We need to see the logging output to know what's going on.

Indeed, I never got the logging right. I thought I'd have done all, that's required like
adding it to the classpath and setting the system property `org.eclipse.jetty.LEVEL` to `DEBUG`.

This is the resolved dependency graph I get, on the last line we can see `org.eclipse.jetty:jetty-slf4j-impl:jar:11.0.8:runtime`.
(I also tried adding it on top of the graph, same error).

    [mvn:resolve]    org.eclipse.jetty:jetty-slf4j-impl:jar:11.0.8:runtime
    [mvn:resolve]       org.slf4j:slf4j-api:jar:2.0.0-alpha5:runtime

I am not sure, whether I added it the right way, however (see Ant build file further below).

    [mvn:resolve] Resolved Dependency Graph:
    [mvn:resolve]    org.eclipse.jetty:jetty-server:jar:11.0.8:runtime
    [mvn:resolve]       org.eclipse.jetty.toolchain:jetty-jakarta-servlet-api:jar:5.0.2:runtime
    [mvn:resolve]       org.eclipse.jetty:jetty-http:jar:11.0.8:runtime
    [mvn:resolve]          org.eclipse.jetty:jetty-util:jar:11.0.8:runtime
    [mvn:resolve]       org.eclipse.jetty:jetty-io:jar:11.0.8:runtime
    [mvn:resolve]       org.slf4j:slf4j-api:jar:2.0.0-alpha5:runtime
    [mvn:resolve]    org.eclipse.jetty:jetty-ant:jar:11.0.8:runtime
    [mvn:resolve]       org.apache.ant:ant:jar:1.10.12:runtime
    [mvn:resolve]       org.apache.ant:ant-launcher:jar:1.10.12:runtime
    [mvn:resolve]       org.eclipse.jetty:jetty-security:jar:11.0.8:runtime
    [mvn:resolve]       org.eclipse.jetty:jetty-plus:jar:11.0.8:runtime
    [mvn:resolve]          jakarta.transaction:jakarta.transaction-api:jar:2.0.0:runtime
    [mvn:resolve]          org.eclipse.jetty:jetty-jndi:jar:11.0.8:runtime
    [mvn:resolve]       org.eclipse.jetty:jetty-webapp:jar:11.0.8:runtime
    [mvn:resolve]          org.eclipse.jetty:jetty-servlet:jar:11.0.8:runtime
    [mvn:resolve]          org.eclipse.jetty:jetty-xml:jar:11.0.8:runtime
    [mvn:resolve]       org.eclipse.jetty:jetty-annotations:jar:11.0.8:runtime
    [mvn:resolve]          jakarta.annotation:jakarta.annotation-api:jar:2.0.0:runtime
    [mvn:resolve]          org.ow2.asm:asm:jar:9.2:runtime
    [mvn:resolve]          org.ow2.asm:asm-commons:jar:9.2:runtime
    [mvn:resolve]             org.ow2.asm:asm-tree:jar:9.2:runtime
    [mvn:resolve]             org.ow2.asm:asm-analysis:jar:9.2:runtime
    [mvn:resolve]    org.eclipse.jetty:jetty-slf4j-impl:jar:11.0.8:runtime

[...]
Can you share your ant build script with us? (perhaps there's a syntax issue)

    <project basedir="." name="ant-maven-test" default="test" xmlns:mvn="antlib:org.apache.maven.resolver.ant">

      <!-- Public targets -->

      <target name="test" depends="jetty-run" description="Test target."/>

      <target name="jetty-run" depends="jetty-depend" description="Starts a Jetty instance.">
        <jetty.run stopPort="9999" stopKey="9999">

          <systemProperties>
            <systemProperty name="org.eclipse.jetty.LEVEL" value="DEBUG" />
          </systemProperties>

          <webApp contextPath="/code" contextXml="code.xml" />

        </jetty.run>
      </target>

      <target name="jetty-stop" depends="jetty-depend" description="Stops the running Jetty instance.">
        <jetty.stop stopPort="9999" stopKey="9999" stopWait="5" />
      </target>

      <!-- Internal utility targets -->

      <target name="jetty-depend">
        <mvn:resolve failOnMissingAttachments="true">
          <mvn:dependencies>
            <mvn:dependency groupId="org.eclipse.jetty" artifactId="jetty-slf4j-impl" version="11.0.8" scope="runtime" />
            <mvn:dependency groupId="org.eclipse.jetty" artifactId="jetty-server" version="11.0.8" scope="runtime"/>
            <mvn:dependency groupId="org.eclipse.jetty" artifactId="jetty-ant" version="11.0.8" scope="runtime" />
          </mvn:dependencies>

          <mvn:path refid="jetty.dependencies" classpath="runtime" />
          <!--<mvn:properties prefix="deps" scopes="compile"/>-->
        </mvn:resolve>

        <!-- <echoproperties prefix="deps"/> -->

        <path id="jetty.classpath">
          <path refid="jetty.dependencies" />
        </path>

        <taskdef resource="tasks.properties" classpathref="jetty.classpath" loaderref="jetty.classpath.loader" />
        <typedef name="webApp" classname="org.eclipse.jetty.ant.AntWebAppContext" classpathref="jetty.classpath" loaderref="jetty.classpath.loader" />
        <typedef name="contextHandlers" classname="org.eclipse.jetty.ant.types.ContextHandlers" classpathref="jetty.classpath" loaderref="jetty.classpath.loader" />
      </target>
    </project>


--
Kind regards,
Andreas Mixich
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users

Back to the top