0

I am trying to use logback access with jetty following this However I am getting this exception when starting the server:

Config error at | logback.xml | java.lang.ClassNotFoundException: ch.qos.logback.access.jetty.RequestLogImpl

Here is the code from jetty.xml causing the problem :

<Ref id="RequestLogHandler">
 <Set name="requestLog">
    <New id="requestLogImpl" class="ch.qos.logback.access.jetty.RequestLogImpl">
       <Set name="resource">as/classpath/resource/myaccess.xml</Set>
    </New>   
  </Set>
</Ref>

and here is the pom.xml

<dependencies>      
<dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.0.1</version>
        <scope>provided</scope>
    </dependency>
  <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-access</artifactId>
        <version>1.0.13</version>
      </dependency>
      <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-core</artifactId>
        <version>1.0.13</version>
      </dependency>
  </dependencies>
 <build>
<finalName>oslc4j-jira-sample</finalName>
    <plugins>


    <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>


        <configuration>
            <webAppConfig>
              <contextPath>/OSLC4JJira</contextPath>
            </webAppConfig>
              <!-- Jetty config adds logging -->
            <jettyConfig>${project.build.directory}/classes/jetty.xml</jettyConfig>

            <!-- enable hot deploy -->
            <reload>automatic</reload>
            <scanIntervalSeconds>5</scanIntervalSeconds>
            <scanTargets>
                <scanTarget>WebContent</scanTarget>
            </scanTargets>
                   <systemProperties>

                <systemProperty>
                    <name>config.dir</name>
                    <value>${basedir}/src/test/resources</value>
                </systemProperty>

                <systemProperty>
                    <name>jetty.logs</name>
                    <value>${basedir}/target</value>
                </systemProperty>
                <systemProperty>
                    <name>jetty.port</name>
                    <value>8080</value>
                </systemProperty>

            </systemProperties>
            <webResources>
        <resource>
          <directory>${build.sourceDirectory}</directory>
          <targetPath>sources</targetPath>
        </resource>
       </webResources>
<dependencies>
   <dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    <version>1.0.13</version>
      </dependency>
</dependencies>
    </configuration>
    </plugin>
</plugins>

mosaad
  • 2,276
  • 5
  • 27
  • 49
  • Can you include your .pom file – Goibniu Oct 14 '13 at 10:52
  • I'm no expert in maven, but you have two dependencies entries, is that valid xml? What happens if you pull that logback-classic entry up to the first node? Also if I remember correctly, don't you need SLF4J to use logback? – Goibniu Oct 14 '13 at 11:52
  • i tried putting all the dependencies in the same place and tried using it with slf4j as well, still getting the same error – mosaad Oct 14 '13 at 11:55
  • Ok, post your updated POM (With all the dependencies together), and with a dependency of SLF4J included. Then do a mvn:clean or whatever, and refresh. If you are still having issues, use the -X option in maven to get a more detailed explanation (it might point to other missing dependencies) – Goibniu Oct 14 '13 at 11:58

2 Answers2

0

You normaly have to do that :"After downloading the logback distribution, place the files logback-core-VERSION.jar and logback-access-VERSION.jar under $JETTY_HOME/lib directory, where $JETTY_HOME is the folder where you have installed Jetty. Versions of logback-access 0.9.31 and later target Jetty versions 7.x and 8.x. Logback-access versions 0.9.30 and earlier target Jetty version 6.x." but you're using the jetty maven plugin so:

Did you add the dependency in the jetty plugin?:

<project>
  ...
  <build>
    ...
    <plugins>
      ...
      <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>8.0.4.v20111024</version><!-- or whatever version you specified -->
        <configuration>
          ...
        </configuration>
        ...
          <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.0.13</version>
          </dependency>
        ...
      </plugin>
      ...
    </plugins>
    ...
  </build>
  ...
</project>
0

As user2878524 said this is a bug link here

mosaad
  • 2,276
  • 5
  • 27
  • 49