[
https://issues.jboss.org/browse/JBAS-9446?page=com.atlassian.jira.plugin....
]
Leonid Kosmylev updated JBAS-9446:
----------------------------------
Fix Version/s: (was: 6.1.0)
Affects Version/s: 6.1.0
Environment: JBoss AS 6.1.0.Final (was: JBoss AS 6.0.0.Final)
Workaround Description: (was: 1) Open the
JBOSS_HOME/server/<servername>/deployers/jboss-logging.deployer/META-INF/logmanager-jboss-beans.xml
in a text editor
2) Comment out (or remove) the following section from the xml:
{code:xml}
<bean name="JBossLogManagerClassLoaderContextSelector"
class="org.jboss.logmanager.ClassLoaderLogContextSelector"/>
<bean name="JBossLogManagerContextSelectorService"
class="org.jboss.logmanager.LogContextSelectorService" mode="On
Demand">
<property name="selector">
<inject bean="JBossLogManagerClassLoaderContextSelector"/>
</property>
</bean>
{code}
3) Now add the following section in that place:
{code:xml}
<!-- Workaround for JBoss Logging bug
http://community.jboss.org/message/587287#587287
-->
<bean name="JBossLogManagerContextSelectorService"
class="org.jboss.logmanager.ClassLoaderLogContextSelector"/>
<bean name="OnDemandJBossLogManagerContextSelectorService"
class="org.jboss.logmanager.LogContextSelectorService" mode="On
Demand">
<property name="selector">
<inject
bean="JBossLogManagerClassLoaderContextSelectorService"/>
</property>
</bean>
{code}
)
Workaround: (was: [Workaround Exists])
Description:
I have cloned JBAS-9407 (
https://issues.jboss.org/browse/JBAS-9407) because the fix does
not work.
Yes, the "java.lang.RuntimeException: Error configuring property:" is fixed.
But the functionality still does not work. The logging goes to server.log anyway. Reason:
the proposed workaround was used as a fix. The workaround is not complete.
That mode="On Demand" must be removed so that the configuration looks like
{code:xml}
<!-- Workaround for JBoss Logging bug
http://community.jboss.org/message/587287#587287
-->
<bean name="JBossLogManagerContextSelectorService"
class="org.jboss.logmanager.ClassLoaderLogContextSelector"/>
<bean name="OnDemandJBossLogManagerContextSelectorService"
class="org.jboss.logmanager.LogContextSelectorService">
<property name="selector">
<inject
bean="JBossLogManagerClassLoaderContextSelectorService"/>
</property>
</bean>
{code}
But this is not enough. There is also an NPE when the application is undeployed.
{code}
14:33:50,546 ERROR [org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer] Error
during undeploy: Logging:REGISTRATION:MyAppLogContext:Anonymous-5:
java.lang.NullPointerException
at
org.jboss.logging.metadata.GetClassLoaderBeanMetaData.setClassLoader(GetClassLoaderBeanMetaData.java:52)
at
org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.undeploy(BeanMetaDataDeployer.java:237)
at
org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.undeploy(BeanMetaDataDeployer.java:58)
{code}
Unfortunately there is no workaround.
was:
Many users have reported that trying to setup application specific logging context leads
to IllegalArgumentException in JBoss AS 6.0.0.Final (please see the referenced forum
thread for one such example). I tried a simple application (.war file with
jboss-logging.xml in WEB-INF) with the following jboss-logging.xml file:
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<!-- ===================================================================== -->
<!-- -->
<!-- Logging System Configuration -->
<!-- -->
<!-- ===================================================================== -->
<logging xmlns="urn:jboss:logging:6.0"
xmlns:b="urn:jboss:bean-deployer:2.0" context="first">
<!-- Define our logging context -->
<define-context name="first"/>
<!-- A time/date based rolling handler -->
<periodic-rotating-file-handler
file-name="${jboss.server.log.dir}/first-app.log"
name="FILE"
autoflush="true"
append="false"
suffix=".yyyy-MM-dd"> <!-- To roll over at the top of each hour,
use ".yyyy-MM-dd-HH" instead -->
<error-manager>
<only-once/>
</error-manager>
<formatter>
<!-- To revert back to simple stack traces without JAR versions, change
"%E" to "%e" below. -->
<!-- Uncomment this to get the class name in the log as well as the category
<pattern-formatter pattern="%d %-5p [%c] %C{1} (%t) %s%E%n"/>
-->
<!-- Uncomment this to log without the class name in the log -->
<pattern-formatter pattern="%d %-5p [%c] (%t) %s%E%n"/>
</formatter>
</periodic-rotating-file-handler>
<!-- =============================================== -->
<!-- Limit categories -->
<!-- =============================================== -->
<!-- Limit the org.jboss category to DEBUG -->
<logger category="org.jboss">
<level name="TRACE"/>
</logger>
<logger category="org.myapp">
<level name="TRACE"/>
</logger>
<!-- ======================= -->
<!-- Setup the Root category -->
<!-- ======================= -->
<root-logger>
<!-- Set the root logger priority via a system property, with a default value.
-->
<level name="${jboss.server.log.threshold:INFO}"/>
<handlers>
<handler-ref name="FILE"/>
</handlers>
</root-logger>
</logging>
{code}
There's nothing special about this jboss-logging.xml, except that it defines a
application specific logging context. During deployment of this application, the server
throws the following exception and the deployment fails:
{code}
17:39:35,465 ERROR [AbstractKernelController] Error installing to Configured:
name=Logging:REGISTRATION:first:Anonymous-0 state=Instantiated:
java.lang.RuntimeException: Error configuring property: selector for
Logging:REGISTRATION:first:Anonymous-0
at
org.jboss.kernel.plugins.dependency.ConfigureAction.dispatchSetProperty(ConfigureAction.java:112)
[jboss-kernel.jar:2.2.0.GA]
at
org.jboss.kernel.plugins.dependency.ConfigureAction.setAttributes(ConfigureAction.java:85)
[jboss-kernel.jar:2.2.0.GA]
at
org.jboss.kernel.plugins.dependency.ConfigureAction.installActionInternal(ConfigureAction.java:44)
[jboss-kernel.jar:2.2.0.GA]
at
org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
[jboss-kernel.jar:2.2.0.GA]
at
org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)
[jboss-kernel.jar:2.2.0.GA]
at
org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
[jboss-dependency.jar:2.2.0.GA]
at
org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
[jboss-dependency.jar:2.2.0.GA]
at
org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
[jboss-dependency.jar:2.2.0.GA]
at
org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379)
[jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044)
[jboss-dependency.jar:2.2.0.GA]
at
org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083)
[jboss-dependency.jar:2.2.0.GA]
at
org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322)
[jboss-dependency.jar:2.2.0.GA]
at
org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246)
[jboss-dependency.jar:2.2.0.GA]
at
org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139)
[jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:894)
[jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:641)
[jboss-dependency.jar:2.2.0.GA]
at
org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:182)
[:2.2.0.GA]
at
org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:58)
[:2.2.0.GA]
at
org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
[:2.2.0.GA]
at
org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:55)
[:2.2.0.GA]
at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179)
[:2.2.0.GA]
at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1832)
[:2.2.0.GA]
at
org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1550)
[:2.2.0.GA]
at
org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1571)
[:2.2.0.GA]
at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1491)
[:2.2.0.GA]
at
org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379)
[jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044)
[jboss-dependency.jar:2.2.0.GA]
at
org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083)
[jboss-dependency.jar:2.2.0.GA]
at
org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322)
[jboss-dependency.jar:2.2.0.GA]
at
org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246)
[jboss-dependency.jar:2.2.0.GA]
at
org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139)
[jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:939)
[jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:654)
[jboss-dependency.jar:2.2.0.GA]
at org.jboss.deployers.plugins.deployers.DeployersImpl.change(DeployersImpl.java:1983)
[:2.2.0.GA]
at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:1076)
[:2.2.0.GA]
at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:679)
[:2.2.0.GA]
at
org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.process(MainDeployerPlugin.java:106)
[:6.0.0.Final]
at
org.jboss.profileservice.dependency.ProfileControllerContext$DelegateDeployer.process(ProfileControllerContext.java:143)
[:0.2.2]
at
org.jboss.profileservice.dependency.ProfileDeployAction.deploy(ProfileDeployAction.java:151)
[:0.2.2]
at
org.jboss.profileservice.dependency.ProfileDeployAction.installActionInternal(ProfileDeployAction.java:94)
[:0.2.2]
at
org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
[jboss-kernel.jar:2.2.0.GA]
at
org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)
[jboss-kernel.jar:2.2.0.GA]
at
org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
[jboss-dependency.jar:2.2.0.GA]
at
org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
[jboss-dependency.jar:2.2.0.GA]
at
org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
[jboss-dependency.jar:2.2.0.GA]
at
org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379)
[jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044)
[jboss-dependency.jar:2.2.0.GA]
at
org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083)
[jboss-dependency.jar:2.2.0.GA]
at
org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322)
[jboss-dependency.jar:2.2.0.GA]
at
org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246)
[jboss-dependency.jar:2.2.0.GA]
at
org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139)
[jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:939)
[jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:654)
[jboss-dependency.jar:2.2.0.GA]
at
org.jboss.profileservice.dependency.ProfileActivationWrapper$BasicProfileActivation.start(ProfileActivationWrapper.java:190)
[:0.2.2]
at
org.jboss.profileservice.dependency.ProfileActivationWrapper.start(ProfileActivationWrapper.java:87)
[:0.2.2]
at
org.jboss.profileservice.dependency.ProfileActivationService.activateProfile(ProfileActivationService.java:215)
[:0.2.2]
at
org.jboss.profileservice.dependency.ProfileActivationService.activate(ProfileActivationService.java:159)
[:0.2.2]
at
org.jboss.profileservice.bootstrap.AbstractProfileServiceBootstrap.activate(AbstractProfileServiceBootstrap.java:112)
[:0.2.2]
at
org.jboss.profileservice.resolver.BasicResolverFactory$ProfileResolverFacade.deploy(BasicResolverFactory.java:87)
[:0.2.2]
at
org.jboss.profileservice.bootstrap.AbstractProfileServiceBootstrap.start(AbstractProfileServiceBootstrap.java:91)
[:0.2.2]
at
org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:132)
[:6.0.0.Final]
at
org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:56)
[:6.0.0.Final]
at
org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:827)
[jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
at
org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:417)
[jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
at java.lang.Thread.run(Thread.java:619) [:1.6.0_21]
Caused by: java.lang.IllegalArgumentException: Wrong arguments. setSelector for target
org.jboss.logging.metadata.ClassLoaderRegistrationHelper@111fce
expected=[org.jboss.logmanager.ClassLoaderLogContextSelector]
actual=[org.jboss.logmanager.LogContextSelectorService]
at
org.jboss.reflect.plugins.introspection.ReflectionUtils.handleErrors(ReflectionUtils.java:404)
[jboss-reflect.jar:2.2.0.GA]
at
org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:74)
[jboss-reflect.jar:2.2.0.GA]
at
org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:168)
[jboss-reflect.jar:2.2.0.GA]
at org.jboss.beans.info.plugins.DefaultPropertyInfo.set(DefaultPropertyInfo.java:143)
[jboss-reflect.jar:2.2.0.GA]
at org.jboss.beans.info.plugins.BeanInfoUtil.set(BeanInfoUtil.java:177)
[jboss-reflect.jar:2.2.0.GA]
at org.jboss.beans.info.plugins.AbstractBeanInfo.setProperty(AbstractBeanInfo.java:289)
[jboss-reflect.jar:2.2.0.GA]
at
org.jboss.kernel.plugins.dependency.PropertyDispatchWrapper.execute(PropertyDispatchWrapper.java:114)
[jboss-kernel.jar:2.2.0.GA]
at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)
[jboss-kernel.jar:2.2.0.GA]
at
org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:125)
[jboss-kernel.jar:2.2.0.GA]
at
org.jboss.kernel.plugins.dependency.ConfigureAction.dispatchSetProperty(ConfigureAction.java:107)
[jboss-kernel.jar:2.2.0.GA]
... 64 more
{code}
Looking at the JBoss Logging code, this appears to be a bug. The LoggingMetaDataHelper has
this piece of code:
{code}
if (! context.equals("system")) {
// if it's "system", then nothing special needs to be done.
// Otherwise create a bean representing the registration of the deployment
unit's classloader with a new log context.
final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(new
GetClassLoaderBeanMetaData(getAnonymousName(context, Kind.REGISTRATION),
ClassLoaderRegistrationHelper.class.getName()));
builder.addPropertyMetaData("logContext",
builder.createInject(getContextName(context)));
builder.addPropertyMetaData("selector",
builder.createInject("JBossLogManagerContextSelectorService"));
beanMetaDataList.add(builder.getBeanMetaData());
}
{code}
As can be seen, a BeanMetaData is being constructed and a bean named
"JBossLogManagerContextSelectorService" is being injected into a field of type
LogContextSelector. However, the xml which defines this
"JBossLogManagerContextSelectorService" sets up the
JBossLogManagerContextSelectorService to be of a different "type":
{code:xml}
<!--
~ These two beans define the per-classloader log context selector which allows
per-deployment logging. Since
~ enabling this feature may have a performance impact in certain cases, it's
started up lazily (on demand)
~ when a separate log context is defined in a user deployment.
-->
<bean name="JBossLogManagerClassLoaderContextSelector"
class="org.jboss.logmanager.ClassLoaderLogContextSelector"/>
<bean name="JBossLogManagerContextSelectorService"
class="org.jboss.logmanager.LogContextSelectorService" mode="On
Demand">
<property name="selector">
<inject bean="JBossLogManagerClassLoaderContextSelector"/>
</property>
</bean>
{code}
There are 2 ways to fix this, either fix the code to refer to the "selector"
field of JBossLogManagerContextSelectorService (I guess the right approach) or rename the
beans in the logmanager-jboss-beans.xml to make sure
JBossLogManagerContextSelectorService is of type LogContextSelector (I consider this a
workaround).
Forum Reference:
http://community.jboss.org/message/587287#587287,
http://community.jboss.org/message/584720#584720 (was:
http://community.jboss.org/message/587287#587287,
http://community.jboss.org/message/584720#584720)
Setting up of application specific logging context still does not
work
----------------------------------------------------------------------
Key: JBAS-9446
URL:
https://issues.jboss.org/browse/JBAS-9446
Project: Legacy JBoss Application Server 6
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Logging
Affects Versions: 6.1.0
Environment: JBoss AS 6.1.0.Final
Reporter: Leonid Kosmylev
Assignee: jaikiran pai
I have cloned JBAS-9407 (
https://issues.jboss.org/browse/JBAS-9407) because the fix does
not work.
Yes, the "java.lang.RuntimeException: Error configuring property:" is fixed.
But the functionality still does not work. The logging goes to server.log anyway. Reason:
the proposed workaround was used as a fix. The workaround is not complete.
That mode="On Demand" must be removed so that the configuration looks like
{code:xml}
<!-- Workaround for JBoss Logging bug
http://community.jboss.org/message/587287#587287
-->
<bean name="JBossLogManagerContextSelectorService"
class="org.jboss.logmanager.ClassLoaderLogContextSelector"/>
<bean name="OnDemandJBossLogManagerContextSelectorService"
class="org.jboss.logmanager.LogContextSelectorService">
<property name="selector">
<inject
bean="JBossLogManagerClassLoaderContextSelectorService"/>
</property>
</bean>
{code}
But this is not enough. There is also an NPE when the application is undeployed.
{code}
14:33:50,546 ERROR [org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer] Error
during undeploy: Logging:REGISTRATION:MyAppLogContext:Anonymous-5:
java.lang.NullPointerException
at
org.jboss.logging.metadata.GetClassLoaderBeanMetaData.setClassLoader(GetClassLoaderBeanMetaData.java:52)
at
org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.undeploy(BeanMetaDataDeployer.java:237)
at
org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.undeploy(BeanMetaDataDeployer.java:58)
{code}
Unfortunately there is no workaround.
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira