facebook

NullPointerException because of log4j while deploying

  1. MyEclipse Archived
  2.  > 
  3. Application Servers and Deployment
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #249220 Reply

    Seedless
    Member

    Hi folks,

    I’m facing strange Errors because of log4j when redeploying a webapp to various appservers (Tomcat, Jboss). The exception looks as follows:

    log4j:ERROR Error occured while converting date.
    java.lang.NullPointerException
        at java.lang.System.arraycopy(Native Method)
        at java.lang.AbstractStringBuilder.getChars(AbstractStringBuilder.java:331)
        at java.lang.StringBuffer.getChars(StringBuffer.java:202)
        at org.apache.log4j.helpers.AbsoluteTimeDateFormat.format(AbsoluteTimeDateFormat.java:108)
        at java.text.DateFormat.format(DateFormat.java:314)
        at org.apache.log4j.helpers.PatternParser$DatePatternConverter.convert(PatternParser.java:436)
        at org.apache.log4j.helpers.PatternConverter.format(PatternConverter.java:56)
        at org.apache.log4j.PatternLayout.format(PatternLayout.java:495)
        at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:292)
        at org.apache.log4j.WriterAppender.append(WriterAppender.java:150)
        at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:221)
        at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:57)
        at org.apache.log4j.Category.callAppenders(Category.java:194)
        at org.apache.log4j.Category.forcedLog(Category.java:379)
        at org.apache.log4j.Category.log(Category.java:844)
        at org.apache.commons.logging.impl.Log4JLogger.debug(Log4JLogger.java:110)
        at org.apache.catalina.session.ManagerBase.init(ManagerBase.java:724)
        at org.apache.catalina.session.StandardManager.start(StandardManager.java:618)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4115)
        at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1085)
        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1178)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:292)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1304)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1568)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1577)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1557)
        at java.lang.Thread.run(Thread.java:595)
    23.03.2006 19:49:43 org.apache.commons.modeler.Registry registerComponent
    SCHWERWIEGEND: Null component Catalina:type=JspMonitor,name=jsp,WebModule=//localhost/bitUpdater,J2EEApplication=none,J2EEServer=none
    23.03.2006 19:49:43 org.apache.catalina.startup.HostConfig checkResources
    WARNUNG: Error during context [/bitUpdater] restart
    java.lang.NullPointerException
        at org.apache.log4j.spi.LocationInfo.<init>(LocationInfo.java:95)
        at org.apache.log4j.spi.LoggingEvent.getLocationInformation(LoggingEvent.java:182)
        at org.apache.log4j.helpers.PatternParser$LocationPatternConverter.convert(PatternParser.java:475)
        at org.apache.log4j.helpers.PatternConverter.format(PatternConverter.java:56)
        at org.apache.log4j.PatternLayout.format(PatternLayout.java:495)
        at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:292)
        at org.apache.log4j.WriterAppender.append(WriterAppender.java:150)
        at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:221)
        at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:57)
        at org.apache.log4j.Category.callAppenders(Category.java:194)
        at org.apache.log4j.Category.forcedLog(Category.java:379)
        at org.apache.log4j.Category.log(Category.java:844)
        at org.apache.commons.logging.impl.Log4JLogger.debug(Log4JLogger.java:110)
        at org.apache.catalina.session.ManagerBase.init(ManagerBase.java:724)
        at org.apache.catalina.session.StandardManager.start(StandardManager.java:618)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4115)
        at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1085)
        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1178)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:292)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1304)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1568)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1577)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1557)
        at java.lang.Thread.run(Thread.java:595)
    log4j:ERROR Error occured while converting date.
    java.lang.NullPointerException
        at java.lang.System.arraycopy(Native Method)
        at java.lang.AbstractStringBuilder.getChars(AbstractStringBuilder.java:331)
        at java.lang.StringBuffer.getChars(StringBuffer.java:202)
        at org.apache.log4j.helpers.AbsoluteTimeDateFormat.format(AbsoluteTimeDateFormat.java:108)
        at java.text.DateFormat.format(DateFormat.java:314)
        at org.apache.log4j.helpers.PatternParser$DatePatternConverter.convert(PatternParser.java:436)
        at org.apache.log4j.helpers.PatternConverter.format(PatternConverter.java:56)
        at org.apache.log4j.PatternLayout.format(PatternLayout.java:495)
        at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:292)
        at org.apache.log4j.WriterAppender.append(WriterAppender.java:150)
        at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:221)
        at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:57)
        at org.apache.log4j.Category.callAppenders(Category.java:194)
        at org.apache.log4j.Category.forcedLog(Category.java:379)
        at org.apache.log4j.Category.log(Category.java:844)
        at org.apache.commons.logging.impl.Log4JLogger.debug(Log4JLogger.java:110)
        at org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:676)
        at org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:663)
        at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1283)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1568)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1577)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1577)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1557)
        at java.lang.Thread.run(Thread.java:595)
    23.03.2006 19:49:43 org.apache.catalina.core.ContainerBase backgroundProcess
    WARNUNG: Exception processing manager org.apache.catalina.session.StandardManager@18600d6 background process
    java.lang.NullPointerException
        at org.apache.log4j.spi.LocationInfo.<init>(LocationInfo.java:95)
        at org.apache.log4j.spi.LoggingEvent.getLocationInformation(LoggingEvent.java:182)
        at org.apache.log4j.helpers.PatternParser$LocationPatternConverter.convert(PatternParser.java:475)
        at org.apache.log4j.helpers.PatternConverter.format(PatternConverter.java:56)
        at org.apache.log4j.PatternLayout.format(PatternLayout.java:495)
        at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:292)
        at org.apache.log4j.WriterAppender.append(WriterAppender.java:150)
        at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:221)
        at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:57)
        at org.apache.log4j.Category.callAppenders(Category.java:194)
        at org.apache.log4j.Category.forcedLog(Category.java:379)
        at org.apache.log4j.Category.log(Category.java:844)
        at org.apache.commons.logging.impl.Log4JLogger.debug(Log4JLogger.java:110)
        at org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:676)
        at org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:663)
        at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1283)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1568)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1577)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1577)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1557)
        at java.lang.Thread.run(Thread.java:595)
    

    I’ve found out that when i remove the log4j.jar from the lib folder it seems to work (it was a hint from a forum i found via google). The Problem is, that I don’t have a clue how to exclude log4j to be deployed to the lib folder, because everytime i redeploy the webapp manually via the MyEclipse Deploy button it is copied to the lib folder again 🙁

    Is there a known workaround?

    Regards
    Ollie

    #249222 Reply

    Riyad Kalla
    Member

    Ollie,
    This is strange that this is causing your app to die, the most likely reason for this is because Log4j is probably already in the app server’s /lib dir and you are getting conflicts in which case you may not want to deploy it with your web app and use something like logging-commons instead and let it take care of it.

    There is currently not support for excluding files from a deployment unfortunately.

    #249229 Reply

    Seedless
    Member

    So… what would you suggest to do?

    Regards
    Ollie

    #249230 Reply

    Riyad Kalla
    Member

    My suggestion would to be try and use commons-logging in your code to abstract out the logging concern and let the app server use what it has (commons-logging will delegate out to what it finds, either log4j or JDK logging).

    OR, you can try and backup the version of Lo4j that is in your app server then replace it with the same copy you are using in your project.

    #313197 Reply

    robinbolt
    Member

    thanks for the useful information… i am new one here and trying to learn and understand the coding.. it was a great help 🙂

    #313357 Reply

    robinbolt
    Member

    @robinbolt wrote:

    thanks for the useful information… i am new one here and trying to learn and understand the coding.. it was a great help 🙂

    great one

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: NullPointerException because of log4j while deploying

You must be logged in to post in the forum log in