1 Reply Latest reply on Mar 4, 2009 7:14 AM by Jeremy Thurgood

    Log4JRepository Selector

    sachin mishra Newbie

      Hi
      I followed the details in http://wiki.jboss.org/wiki/Log4jRepositorySelector about implementing RepositorySelector so that i can have logging per web application.

      I tried the code, and it works only first time when i deploy my war file.

      If i redeploy my war file i get a exception thrown. Can someone please let me know what is the problem here.

      18:27:30,955 INFO [TomcatDeployer] undeploy, ctxPath=/WebQuestionnaire, warUrl=.../tmp/deploy/tmp1765WebQuestionnaire-exp.war/
      18:27:30,955 INFO [[/WebQuestionnaire]] Destroying Spring FrameworkServlet 'questionnaire'
      18:27:30,955 INFO [[/WebQuestionnaire]] Closing Spring root WebApplicationContext
      18:27:31,971 ERROR [STDERR] Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@162a121
      18:27:31,971 ERROR [STDERR] Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@1472dca
      18:27:31,971 ERROR [STDERR] Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@f35bd
      18:27:31,971 ERROR [STDERR] Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@911387
      18:27:32,033 ERROR [STDERR] Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@15ac942
      18:27:32,049 ERROR [STDERR] Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@1533ae9
      18:27:32,064 ERROR [STDERR] Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@140aa23
      18:27:32,064 ERROR [STDERR] Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@621f0c
      18:27:32,064 ERROR [STDERR] Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@1e47715
      18:27:32,111 ERROR [STDERR] Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@1357842
      18:27:32,111 ERROR [STDERR] Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@11f0759
      18:27:32,111 ERROR [STDERR] Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@1b90be
      18:27:32,111 ERROR [STDERR] Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@1bbc5b2
      18:27:32,111 ERROR [STDERR] Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@b04ff6
      18:27:32,127 ERROR [STDERR] Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@151aa16
      18:27:32,127 ERROR [STDERR] Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@75ace1
      18:27:32,127 ERROR [STDERR] Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@1a8fb80
      18:27:32,127 ERROR [STDERR] Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@117cddf
      18:27:32,142 ERROR [STDERR] Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@1cd288e
      18:27:32,142 ERROR [STDERR] Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@21a14e
      18:27:32,142 ERROR [STDERR] Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@1e51549
      18:27:32,174 ERROR [STDERR] Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@8d23f9
      18:27:32,174 ERROR [STDERR] Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@34c748
      18:27:32,174 ERROR [StandardContext] Error listenerStart
      18:27:32,174 ERROR [StandardContext] Context [/WebQuestionnaire] startup failed due to previous errors
      18:27:32,236 ERROR [STDERR] Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@3174f7
      18:27:32,236 ERROR [STDERR] Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@f61190
      18:27:32,236 WARN [ServiceController] Problem starting service jboss.web.deployment:war=WebQuestionnaire.war,id=1435544464
      org.jboss.deployment.DeploymentException: URL file:/C:/JbossAS/jboss-4.2.2.GA/server/default/tmp/deploy/tmp1766WebQuestionnaire-exp.war/ deployment failed
      at org.jboss.web.tomcat.service.TomcatDeployer.performDeployInternal(TomcatDeployer.java:379)
      at org.jboss.web.tomcat.service.TomcatDeployer.performDeploy(TomcatDeployer.java:104)
      at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:375)
      at org.jboss.web.WebModule.startModule(WebModule.java:83)
      at org.jboss.web.WebModule.startService(WebModule.java:61)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
      at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
      at $Proxy0.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:417)
      at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      at $Proxy193.start(Unknown Source)
      at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:466)
      at sun.reflect.GeneratedMethodAccessor253.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
      at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
      at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
      at org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:87)
      at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
      at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      at $Proxy194.start(Unknown Source)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
      at sun.reflect.GeneratedMethodAccessor28.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      at $Proxy9.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:610)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
      18:27:32,252 ERROR [MainDeployer] Could not start deployment: file:/C:/JbossAS/jboss-4.2.2.GA/server/default/deploy/WebQuestionnaire.war
      org.jboss.deployment.DeploymentException: URL file:/C:/JbossAS/jboss-4.2.2.GA/server/default/tmp/deploy/tmp1766WebQuestionnaire-exp.war/ deployment failed
      at org.jboss.web.tomcat.service.TomcatDeployer.performDeployInternal(TomcatDeployer.java:379)
      at org.jboss.web.tomcat.service.TomcatDeployer.performDeploy(TomcatDeployer.java:104)
      at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:375)
      at org.jboss.web.WebModule.startModule(WebModule.java:83)
      at org.jboss.web.WebModule.startService(WebModule.java:61)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
      at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
      at $Proxy0.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:417)
      at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      at $Proxy193.start(Unknown Source)
      at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:466)
      at sun.reflect.GeneratedMethodAccessor253.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
      at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
      at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
      at org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:87)
      at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
      at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      at $Proxy194.start(Unknown Source)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
      at sun.reflect.GeneratedMethodAccessor28.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      at $Proxy9.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:610)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)

        • 1. Re: Log4JRepository Selector
          Jeremy Thurgood Newbie

          I've spent the last two days grappling with what appears to be the same problem.

          It looks like you need to make sure your RepositorySelector needs to live outside your application. If it is part of your application, undeploying will break the Logger singleton by ripping out the RepositorySelector from under it (or something similar -- I don't fully grok the classloader dynamics).

          I solved this by putting my RepositorySelector and a ContextListener that invokes it in a jar in jboss/server//lib/ and then referencing this in my application's web.xml. The log4j.xml it reads still lives within the application, though.

          It's ugly, in that there's stuff that has to live outside the application, but it lets different applications use it and it's static enough code that it can be deployed once as part of the jboss setup.

          (btw, I almost gave up on posting this. The amount of information required to register for this forum and the assumptions the required fields make are more of a barrier than I would ordinarily be prepared to surmount.)