[
https://issues.apache.org/jira/browse/LOG4J2-492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13885167#comment-13885167
]
Remko Popma commented on LOG4J2-492:
------------------------------------
I reopened this yesterday afternoon as I still need to do work on this.
Herlani has identified that the context name also needs to be escaped when
creating an ObjectName to _unregister_ a context.
Herlani, you also propose to drop '\r' and '\n' characters from the ObjectName
values, I am not sure if that is the right thing to do. My original code
replaces '\r' and '\n' characters with "\\r" and "\\n" sequences, respectively.
My unit tests pass without throwing MalformedObjectException... Why is this
necessary? Is this causing an error or other issue? (Ideally one that I can
reproduce?)
Update: re-checked the spec and values with backslashes should be quoted, so
after turning a '\n' character into a "\\n" sequence, the value should be
quoted; I wasn't doing that correctly. Unless there is some other problem I
prefer that to dropping these characters...
> MalformedObjectNameException: Invalid escape sequence... under Jetty
> --------------------------------------------------------------------
>
> Key: LOG4J2-492
> URL: https://issues.apache.org/jira/browse/LOG4J2-492
> Project: Log4j 2
> Issue Type: Bug
> Components: JMX
> Affects Versions: 2.0-rc1
> Environment: jetty.version=8.1.14.v20131031
> Reporter: Shaddy Baddah
> Assignee: Remko Popma
> Priority: Minor
> Fix For: 2.0-rc1, 2.0
>
> Attachments: Server.java
>
>
> Although it is not stopping my webapp from running, I am encountering the
> following exception when running jetty (via Maven) for a webapp using a trunk
> build of log4j2.
> My debug line is also included:
> {noformat}
> loggerContext.getName()= WebAppClassLoader=1320771902@4eb9613e
> 2014-01-09 13:28:52,904 ERROR Could not register mbeans
> java.lang.IllegalStateException:
> javax.management.MalformedObjectNameException: Invalid escape sequence '\='
> in quoted value
> at
> org.apache.logging.log4j.core.jmx.LoggerContextAdmin.<init>(LoggerContextAdmin.java:81)
> at
> org.apache.logging.log4j.core.jmx.Server.registerContexts(Server.java:266)
> at
> org.apache.logging.log4j.core.jmx.Server.reregisterMBeansAfterReconfigure(Server.java:185)
> at
> org.apache.logging.log4j.core.jmx.Server.reregisterMBeansAfterReconfigure(Server.java:150)
> at
> org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:387)
> at
> org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:151)
> at
> org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:105)
> at
> org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:33)
> at org.apache.logging.log4j.LogManager.getContext(LogManager.java:222)
> at
> org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:103)
> at
> org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:63)
> at
> org.apache.logging.log4j.core.web.Log4jWebInitializerImpl.initializeNonJndi(Log4jWebInitializerImpl.java:136)
> at
> org.apache.logging.log4j.core.web.Log4jWebInitializerImpl.initialize(Log4jWebInitializerImpl.java:82)
> at
> org.apache.logging.log4j.core.web.Log4jServletContainerInitializer.onStartup(Log4jServletContainerInitializer.java:41)
> at
> org.eclipse.jetty.plus.annotation.ContainerInitializer.callStartup(ContainerInitializer.java:106)
> at
> org.eclipse.jetty.annotations.ServletContainerInitializerListener.doStart(ServletContainerInitializerListener.java:107)
> at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
> at
> org.eclipse.jetty.util.component.AggregateLifeCycle.doStart(AggregateLifeCycle.java:81)
> at
> org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:58)
> at
> org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:96)
> at
> org.eclipse.jetty.server.handler.ScopedHandler.doStart(ScopedHandler.java:115)
> at
> org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:763)
> at
> org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249)
> at
> org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1242)
> at
> org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717)
> at
> org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494)
> at
> org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:298)
> at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
> at
> org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229)
> at
> org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:172)
> at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
> at
> org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229)
> at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
> at
> org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
> at org.eclipse.jetty.server.Server.doStart(Server.java:282)
> at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:65)
> at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
> at
> org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:520)
> at
> org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:365)
> at
> org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:523)
> at
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
> at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
> at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
> at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
> at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
> at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
> at
> org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
> at
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
> at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
> at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
> at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:606)
> at
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
> at
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
> at
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
> at
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
> Caused by: javax.management.MalformedObjectNameException: Invalid escape
> sequence '\=' in quoted value
> at javax.management.ObjectName.construct(ObjectName.java:582)
> at javax.management.ObjectName.<init>(ObjectName.java:1382)
> at
> org.apache.logging.log4j.core.jmx.LoggerContextAdmin.<init>(LoggerContextAdmin.java:79)
> ... 60 more
> 2014-01-09 13:28:52.989:INFO:/wallboard:Initializing Spring root
> WebApplicationContext
> 2014-01-09 13:29:04.645:INFO:/wallboard:Log4jServletContextListener ensuring
> that Log4j starts up properly.
> 2014-01-09 13:29:04.651:INFO:/wallboard:Log4jServletFilter initialized.
> 2014-01-09 13:29:04.778:WARN:oejsh.RequestLogHandler:!RequestLog
> 2014-01-09 13:29:04.872:INFO:oejs.AbstractConnector:Started
> [email protected]:8080
> [INFO] Started Jetty Server
> [INFO] Starting scanner at interval of 10 seconds.
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]