Announcement Announcement Module
Collapse
No announcement yet.
[Solved] Log4J error at init DispatcherServlet in Jetty Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Solved] Log4J error at init DispatcherServlet in Jetty

    I'm attempting to start spring from Jetty, however I get the following error:

    java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.mortbay.start.Main.invokeMain(Main.java:150)
    at org.mortbay.start.Main.start(Main.java:473)
    at org.mortbay.start.Main.main(Main.java:93)
    Caused by: java.lang.ExceptionInInitializerError
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)

    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(Unknown Source)

    at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(Unknown Sou
    rce)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.lang.Class.newInstance0(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    at org.mortbay.jetty.servlet.Holder.newInstance(Holde r.java:199)
    at org.mortbay.jetty.servlet.ServletHolder.start(Serv letHolder.java:237)

    at org.mortbay.jetty.servlet.ServletHandler.initializ eServlets(ServletHa
    ndler.java:403)
    at org.mortbay.jetty.servlet.WebApplicationHandler.in itializeServlets(We
    bApplicationHandler.java:288)
    at org.mortbay.jetty.servlet.WebApplicationContext.st art(WebApplicationC
    ontext.java:445)
    at org.mortbay.http.HttpServer.start(HttpServer.java: 678)
    at org.mortbay.jetty.Server.main(Server.java:411)
    ... 7 more
    Caused by: org.apache.commons.logging.LogConfigurationExcepti on: The chosen LogF
    actory implementation does not extend LogFactory. Please check your configuratio
    n. (Caused by java.lang.ClassCastException)

    at org.apache.commons.logging.LogFactory$2.run(LogFac tory.java:574)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.commons.logging.LogFactory.newFactory(L ogFactory.java:517)

    at org.apache.commons.logging.LogFactory.getFactory(L ogFactory.java:254)

    at org.apache.commons.logging.LogFactory.getLog(LogFa ctory.java:370)
    at org.springframework.web.servlet.DispatcherServlet. <clinit>(Dispatcher
    Servlet.java:174)
    ... 20 more
    Caused by: java.lang.ClassCastException
    at org.apache.commons.logging.LogFactory$2.run(LogFac tory.java:531)
    ... 25 more

    I use the following web.xml

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <web-app xmlns="http&#58;//java.sun.com/xml/ns/j2ee"
    	 xmlns&#58;xsi="http&#58;//www.w3.org/2001/XMLSchema-instance"
    	 xsi&#58;schemaLocation="http&#58;//java.sun.com/xml/ns/j2ee http&#58;//java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    	 version="2.4">
             
        <!-- The spring servlet for MVC -->
        <servlet>
            <servlet-name>spring</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>
        <!-- map HTML to spring, all HTML will eventually be mapped to a velocity template -->
        <servlet-mapping>
            <servlet-name>spring</servlet-name>
            <url-pattern>*.html</url-pattern>
        </servlet-mapping>    
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
        <welcome-file-list>
    	<welcome-file>
                index.html
            </welcome-file>
        </welcome-file-list>
    </web-app>
    Anyone know why this happens? And what I can do to resove it. The idea is to use Jetty as a servlet container, spring as MVC and Velocity for the view.

    Thanks in advance,
    Vincent

  • #2
    Its solved, I downloaded a different version of Jetty and now it work.

    Comment

    Working...
    X