Использование JSP со Embedded Jetty 7 в Eclipse IDE, получение исключения LogConfigurationException - PullRequest
2 голосов
/ 29 октября 2010

Я включил все банки, которые требуются приложению, я пытаюсь использовать Jetty Embedded

У меня есть простой класс Java с методом main, который имеет следующую настройку, сервлеты все еще работают правильно, просто не могут заставить работать JSP. Все необходимые банки включены, начались с базовых файлов Jetty, затем добавлены все из папки jsp.

Server server = new Server(8080);

WebAppContext context = new WebAppContext();
context.setDescriptor("WebRoot/WEB-INF/web.xml");
context.setResourceBase("WebRoot/");
context.setContextPath("/");
context.setParentLoaderPriority(true);

server.setHandler(context);

server.start();
server.join();

Ошибка:

2010-10-29 09:53:14.031:INFO::jetty-7.2.0.v20101020
2010-10-29 09:53:14.577:WARN::FAILED jsp: java.lang.ExceptionInInitializerError
2010-10-29 09:53:14.577:WARN::FAILED WebAppContext@1c0e45a@1c0e45a/,file:/D:/eclipseworkspaces/eone/dash/JettyEmbededWeb/WebRoot/: java.lang.ExceptionInInitializerError
2010-10-29 09:53:14.577:WARN::Error starting handlers
java.lang.ExceptionInInitializerError
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.Class.newInstance0(Class.java:355)
    at java.lang.Class.newInstance(Class.java:308)
    at org.eclipse.jetty.servlet.ServletContextHandler$Context.createServlet(ServletContextHandler.java:602)
    at org.eclipse.jetty.servlet.ServletHolder.newInstance(ServletHolder.java:741)
    at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:421)
    at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:259)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
    at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:762)
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:244)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1132)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:577)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:491)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:93)
    at org.eclipse.jetty.server.Server.doStart(Server.java:243)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
    at com.example.handlers.WebappCtxtHandlerNonWar.main(WebappCtxtHandlerNonWar.java:32)
Caused by: 
com.sun.org.apache.commons.logging.LogConfigurationException: com.sun.org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException) (Caused by com.sun.org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException))
    at com.sun.org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
    at com.sun.org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
    at com.sun.org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
    at com.sun.org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
    at org.apache.jasper.servlet.JspServlet.<clinit>(JspServlet.java:116)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.Class.newInstance0(Class.java:355)
    at java.lang.Class.newInstance(Class.java:308)
    at org.eclipse.jetty.servlet.ServletContextHandler$Context.createServlet(ServletContextHandler.java:602)
    at org.eclipse.jetty.servlet.ServletHolder.newInstance(ServletHolder.java:741)
    at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:421)
    at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:259)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
    at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:762)
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:244)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1132)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:577)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:491)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:93)
    at org.eclipse.jetty.server.Server.doStart(Server.java:243)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
    at com.example.handlers.WebappCtxtHandlerNonWar.main(WebappCtxtHandlerNonWar.java:32)
Caused by: 
com.sun.org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException)
    at com.sun.org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:397)
    at com.sun.org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
    at com.sun.org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
    at com.sun.org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
    at com.sun.org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
    at org.apache.jasper.servlet.JspServlet.<clinit>(JspServlet.java:116)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.Class.newInstance0(Class.java:355)
    at java.lang.Class.newInstance(Class.java:308)
    at org.eclipse.jetty.servlet.ServletContextHandler$Context.createServlet(ServletContextHandler.java:602)
    at org.eclipse.jetty.servlet.ServletHolder.newInstance(ServletHolder.java:741)
    at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:421)
    at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:259)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
    at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:762)
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:244)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1132)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:577)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:491)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:93)
    at org.eclipse.jetty.server.Server.doStart(Server.java:243)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
    at com.example.handlers.WebappCtxtHandlerNonWar.main(WebappCtxtHandlerNonWar.java:32)
Caused by: 
java.lang.NullPointerException
    at com.sun.org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:374)
    at com.sun.org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
    at com.sun.org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
    at com.sun.org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
    at com.sun.org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
    at org.apache.jasper.servlet.JspServlet.<clinit>(JspServlet.java:116)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.Class.newInstance0(Class.java:355)
    at java.lang.Class.newInstance(Class.java:308)
    at org.eclipse.jetty.servlet.ServletContextHandler$Context.createServlet(ServletContextHandler.java:602)
    at org.eclipse.jetty.servlet.ServletHolder.newInstance(ServletHolder.java:741)
    at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:421)
    at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:259)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
    at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:762)
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:244)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1132)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:577)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:491)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:93)
    at org.eclipse.jetty.server.Server.doStart(Server.java:243)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
    at com.example.handlers.WebappCtxtHandlerNonWar.main(WebappCtxtHandlerNonWar.java:32)
2010-10-29 09:53:14.592:INFO::Started SelectChannelConnector@0.0.0.0:8080

Ответы [ 2 ]

2 голосов
/ 08 сентября 2013

Я предпочитаю использовать артефакт jetty-jsp вместе с агрегированным сервером Jetty-all-server, поскольку оба доступны из одного выпуска Jetty:

    <dependency>
        <groupId>org.eclipse.jetty.aggregate</groupId>
        <artifactId>jetty-all-server</artifactId>
        <version>${jetty.version}</version>
    </dependency>
    <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-jsp</artifactId>
        <version>${jetty.version}</version>
    </dependency>

Я тестировал Jetty версии 7.6.12.v20130726, обе зависимости доступны в центральном репозитории Maven.

0 голосов
/ 28 ноября 2010

Вероятно, это будет отсутствующий класс.

Я получил по сути тот же фрагмент кода для работы под сборкой maven с

    <dependency>
        <groupId>org.eclipse.jetty.aggregate</groupId>
        <artifactId>jetty-all</artifactId>
        <version>7.2.0.v20101020</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jsp-2.1-glassfish</artifactId>
        <version>2.1.v20100127</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>

и log4j.

...