Re: log4j/jetty5 issues

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Apr 21 2005 - 05:04:23 EDT

  • Next message: Holger Hoffstätte: "Re: memory usage"

    Erik,

    I have pretty old setup, so this information is probably not very helpful
    in your case, but here it goes...

    I use Eclipse 3.0 with JettyLauncher 1.0.14 and Spindle 3.1.11. It works
    with "fat" cayenne.jar file (and also with Cayenne Eclipse project checked
    out from CVS). Versions of Jetty that I tried are 4.2.21 and 5.1.3.

    The only problem that I had was related to Tapestry 3.0 shipping with
    commons-collections 2.1 while Cayenne requires 3.1. So I had to make sure
    that commons-collections 3.1 (standalone or the version bundled with
    cayenne) appear in the run classpath in Eclipse before the Spindle stuff.
    This was the only thing that didn't work... Log4J-based logging works ok.

    > Why o' why does logging have to
    > be the pain that eats up a develpers time?! *arg*

    I hear you ... Unfortunately it still does ... at times.. BTW, we are
    planning to eliminate Cayenne dependency on Log4J, but then we'll have to
    start using commons-logging (I guess) which is yet another can of worms...

    Andrus

    > Oh, and I'm using cayenne-nodeps.jar now as well. I've added more of
    > JAR's that ship with Jetty to my <java> classpath and Jetty now
    > launches successfully... still logging is not working exactly right,
    > but I'm at least functional now.
    >
    > Erik
    >
    > On Apr 20, 2005, at 12:24 PM, Erik Hatcher wrote:
    >
    >> I appreciate both Mike and Cris responding to my troubles. I've now
    >> upgraded *everything* to its latest-greatest versions. Launching
    >> Jetty (5.1.3) from Ant like this:
    >>
    >> <java classname="org.mortbay.jetty.Server" fork="true"
    >> maxmemory="128M">
    >> <classpath>
    >> <fileset id="jetty.jars" dir="${jetty.home}">
    >> <include name="lib/*.jar" />
    >> <include name="ext/*.jar" />
    >> </fileset>
    >> </classpath>
    >>
    >> <sysproperty key="jetty.home" value="${jetty.home}" />
    >>
    >> <arg value="${build.dir}/jetty-collex.xml" />
    >> </java>
    >>
    >>
    >> Still gives me the nasty stack trace. Why o' why does logging have to
    >> be the pain that eats up a develpers time?! *arg*
    >>
    >> I then built a .war rather than running off my development
    >> environment, copied that .war over to Jetty's webapps directory and
    >> then started it manually using the standard "java -jar start.jar" and
    >> it worked fine.
    >>
    >> So since others here are obviously experienced with Jetty, could you
    >> share how you are launching it? I'd prefer to have a way to launch
    >> from an exploded WAR format from Ant during development.
    >>
    >> Thanks,
    >> Erik
    >>
    >> On Apr 19, 2005, at 12:54 PM, Mike Kienenberger wrote:
    >>
    >>> I'm now using Jetty 5.1.3 and Cayenne 1.2 and log4j-1.2.8 as of last
    >>> week.
    >>> 1.2.6 is pretty old as I think I've been using 1.2.8 for a couple of
    >>> years
    >>> now.
    >>>
    >>> Also, you could just use cayenne-nodeps.jar (which is what I do) and
    >>> then
    >>> add in any jar dependencies separately.
    >>> I find this makes it a lot easier to maintain all of my jar
    >>> dependencies.
    >>>
    >>> -Mike
    >>>
    >>>
    >>> Erik Hatcher <eri..hatchersolutions.com> wrote:
    >>>> I'm asking here as Cayenne's JAR is what got me into this, though
    >>>> I'm aware that the solution is not directly Cayenne related.
    >>>>
    >>>> I've just added Cayenne to a new Tapestry application (just the JAR
    >>>> at
    >>>> this point, soon the Visit and so on). I'm using Tapestry 3.1
    >>>> (err...
    >>>> now 4.0). I'm using Jetty 5.1.2, launching from Ant in development.
    >>>> All worked fine until I added cayenne.jar (version 1.1.1).
    >>>>
    >>>> Once I added cayenne.jar to my app's WEB-INF/lib, I get the stack
    >>>> trace
    >>>> pasted below from Jetty's startup.
    >>>>
    >>>> My WEB-INF/lib has these JAR's:
    >>>>
    >>>> $ ls context/WEB-INF/lib
    >>>> bsf-2.3.0.jar
    >>>> hivemind-lib-1.1-alpha-4-snapshot.jar portlet-api-1.0.jar
    >>>> cayenne.jar jai_codec.jar
    >>>> tapestry-3.1-alpha-2-snapshot.jar
    >>>> cglib-full-2.0.2.jar jai_core.jar
    >>>> tapestry-contrib-3.1-alpha-2-snapshot.jar
    >>>> commons-codec-1.3.jar
    >>>> javassist-3.0-rc-1.jar
    >>>> tapestry-portlet-3.1-alpha-2-snapshot.jar
    >>>> commons-fileupload-1.0.jar log4j-1.2.6.jar
    >>>> hivemind-1.1-alpha-4-snapshot.jar ognl-2.6.7.jar
    >>>>
    >>>> A little Googling showed me that there are some issues with Jetty
    >>>> and Log4j, but I'm not quite sure what the remedy is. Any advice?
    >>>>
    >>>> Thanks!
    >>>>
    >>>> Erik
    >>>>
    >>>>
    >>>>
    >>>> start-jetty:
    >>>> [java] Apr 19, 2005 12:23:00 PM org.mortbay.http.HttpServer
    >>>> doStart
    >>>> [java] INFO: Version Jetty/5.1.2
    >>>> [java] Apr 19, 2005 12:23:00 PM org.mortbay.util.Container
    >>>> start
    >>>> [java] INFO: Started HttpContext[/,/]
    >>>> [java] Exception in thread "main"
    >>>> java.lang.ExceptionInInitializerError
    >>>> [java] at
    >>>> org.mortbay.jetty.servlet.ServletHandler.newServletHolder(ServletHand
    >>>> ler
    >>>> .java:270)
    >>>> [java] at
    >>>> org.mortbay.jetty.servlet.XMLConfiguration.initServlet(XMLConfigurati
    >>>> on.
    >>>> java:364)
    >>>> [java] at
    >>>> org.mortbay.jetty.servlet.XMLConfiguration.initWebXmlElement(XMLConfi
    >>>> gur
    >>>> ation.java:237)
    >>>> [java] at
    >>>> org.mortbay.jetty.servlet.XMLConfiguration.initialize(XMLConfiguratio
    >>>> n.j
    >>>> ava:205)
    >>>> [java] at
    >>>> org.mortbay.jetty.servlet.XMLConfiguration.configureDefaults(XMLConfi
    >>>> gur
    >>>> ation.java:155)
    >>>> [java] at
    >>>> org.mortbay.jetty.servlet.WebApplicationContext.configureDefaults(Web
    >>>> App
    >>>> licationContext.java:415)
    >>>> [java] at
    >>>> org.mortbay.jetty.servlet.WebApplicationContext.doStart(WebApplicatio
    >>>> nCo
    >>>> ntext.java:464)
    >>>> [java] at
    >>>> org.mortbay.util.Container.start(Container.java:72)
    >>>> [java] at
    >>>> org.mortbay.http.HttpServer.doStart(HttpServer.java:695)
    >>>> [java] at
    >>>> org.mortbay.util.Container.start(Container.java:72)
    >>>> [java] at org.mortbay.jetty.Server.main(Server.java:433)
    >>>> [java] Caused by:
    >>>> org.apache.commons.logging.LogConfigurationException:
    >>>> org.apache.commons.logging.LogConfigurationException: No suitable
    >>>> Log constructor [Ljava.lang.Class..dc4d5 for
    >>>> org.apache.commons.logging.impl.Log4JLogger
    >>>> [java] at
    >>>> org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactory
    >>>> Imp
    >>>> l.java:532)
    >>>> [java] at
    >>>> org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactory
    >>>> Imp
    >>>> l.java:272)
    >>>> [java] at
    >>>> org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactory
    >>>> Imp
    >>>> l.java:246)
    >>>> [java] at
    >>>> org.apache.commons.logging.LogFactory.getLog(LogFactory.java:395)
    >>>> [java] at
    >>>> org.mortbay.jetty.servlet.Holder.<clinit>(Holder.java:43)
    >>>> [java] ... 11 more
    >>>> [java] Caused by:
    >>>> org.apache.commons.logging.LogConfigurationException: No suitable
    >>>> Log constructor [Ljava.lang.Class..dc4d5 for
    >>>> org.apache.commons.logging.impl.Log4JLogger
    >>>> [java] at
    >>>> org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogF
    >>>> act
    >>>> oryImpl.java:432)
    >>>> [java] at
    >>>> org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactory
    >>>> Imp
    >>>> l.java:525)
    >>>> [java] ... 15 more
    >>>> [java] Caused by: java.lang.NoClassDefFoundError:
    >>>> org/apache/log4j/Logger
    >>>> [java] at java.lang.Class.getDeclaredConstructors0(Native
    >>>> Method)
    >>>> [java] at
    >>>> java.lang.Class.privateGetDeclaredConstructors(Class.java:1618)
    >>>> [java] at java.lang.Class.getConstructor0(Class.java:1930)
    >>>> [java] at java.lang.Class.getConstructor(Class.java:1027)
    >>>> [java] at
    >>>> org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogF
    >>>> act
    >>>> oryImpl.java:429)
    >>>> [java] ... 16 more
    >>>> [java] Java Result: 1



    This archive was generated by hypermail 2.0.0 : Thu Apr 21 2005 - 05:04:26 EDT