2 oallen159753 oAllen159753 于 2015.07.24 12:09 提问

logback access模块和jetty集成,启动jetty报错!!!

官方资料:http://logback.qos.ch/access.html

配置文件:







class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>


class="org.eclipse.jetty.server.handler.DefaultHandler"/>

<!-- add a RequestLogHandler -->

class="org.eclipse.jetty.server.handler.RequestLogHandler"/>




<Ref id="RequestLogHandler">
  <Set name="requestLog">
    <New id="requestLogImpl" class="ch.qos.logback.access.jetty.RequestLogImpl">
        <Set name="fileName">C:\jetty\resources\logback-access.xml</Set>
    </New>
  </Set>
</Ref>



<Call id="MBeanServer" class="java.lang.management.ManagementFactory" name="getPlatformMBeanServer"/>
<Get id="Container" name="container">
  <Call name="addEventListener">
    <Arg>
      <New class="org.mortbay.management.MBeanContainer">
        <Arg><Ref id="MBeanServer"/></Arg>
        <Set name="managementPort">8082</Set>
        <Call name="start" />
      </New>
    </Arg>
  </Call>
</Get>

** logback-access.xml文件**

<configuration>

<!-- always a good activate OnConsoleStatusListener -->



%h %l %u %user %date "%r" %s %b


启动jetty

C:\jetty>java -jar start.jar
2015-07-24 12:03:57.286:WARN:oejx.XmlConfiguration:Config error at |? C:\jetty\resources\logback-access.xml w>|? java.lang.ClassNotFoundException: ch.qos.logback.access.jetty.Reque
stLogImpl
2015-07-24 12:03:57.286:WARN:oejx.XmlConfiguration:Config error at |? C:\jetty\resources\
logback-access.xml|? java.lang.ClassNotFoundException:
ch.qos.logback.access.jetty.RequestLogImpl
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.jetty.start.Main.invokeMain(Main.java:473)
at org.eclipse.jetty.start.Main.start(Main.java:615)
at org.eclipse.jetty.start.Main.main(Main.java:96)
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.access.jetty.Request
LogImpl
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.eclipse.jetty.util.Loader.loadClass(Loader.java:100)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.nodeClas
s(XmlConfiguration.java:366)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.newObj(X
mlConfiguration.java:767)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.itemValu
e(XmlConfiguration.java:1141)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.value(Xm
lConfiguration.java:1044)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.set(XmlC
onfiguration.java:434)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configur
e(XmlConfiguration.java:396)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.refObj(X
mlConfiguration.java:847)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configur
e(XmlConfiguration.java:408)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configur
e(XmlConfiguration.java:355)
at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.jav
a:296)
at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:12
62)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:119
7)
... 7 more

Usage: java -jar start.jar [options] [properties] [configs]
java -jar start.jar --help # for more information

3个回答

CSDNXIAOD
CSDNXIAOD   2015.07.24 12:12

Jetty在Spring工程中启动报错
paoding与jetty下报错
jetty的启动
----------------------biu~biu~biu~~~在下问答机器人小D,这是我依靠自己的聪明才智给出的答案,如果不正确,你来咬我啊!

tangshengshan870823
tangshengshan870823   2015.07.24 12:48

在项目lib中导入 Reque
stLogImpl jar包

oAllen159753
oAllen159753 我已经把logback-core-1.1.3.jar和logback-access-1.1.3.jar拷贝到jetty的lib下
2 年多之前 回复
tangshengshan870823
tangshengshan870823   2015.07.24 12:48

在项目lib中导入 Reque
stLogImpl jar包

Csdn user default icon
上传中...
上传图片
插入图片