Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-7860

"Failed to register resource with name [type=Velocity,domain=Engines,name=default]" error message

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 4.1-milestone-2
    • 4.1-milestone-1
    • Old Core
    • None
    • Unknown
    • N/A
    • N/A

    Description

      from time to time the following error appears at startup in the console:

      2012-05-25 19:47:04,147 [Lucene Index Rebuilder] WARN  m.i.DefaultJMXBeanRegistration - Failed to register resource with name [type=Velocity,domain=Engines,name=default] ...
      

      The reason is because 2 threads execute at the same time (the main request thread and the Lucene Index Rebuilder thread) and they both call DefaultVelocityManager.getVelocityEngine() at the same time. This method in turn calls VelocityFactory.createVelocityEngine() which registers the new Velocity Engine against the JMX server, leading to an error because the second time it executes the JM MBean is already registered. In practice this means that we create 2 Velocity Engine when we should only create one.

      FTR here are the logs that allowed me to capture the issue;

      2012-05-25 19:47:03,690 [http://localhost:8080/xwiki/bin/view/Main/WebHome] INFO  m.i.DefaultJMXBeanRegistration - Registering MBean: [org.xwiki.velocity.internal.jmx.JMXVelocityEngine@763c3a45] with name [type=Velocity,domain=Engines,name=default] at [java.lang.RuntimeException
      	at org.xwiki.management.internal.DefaultJMXBeanRegistration.registerMBean(DefaultJMXBeanRegistration.java:55)
      	at org.xwiki.velocity.internal.DefaultVelocityFactory.createVelocityEngine(DefaultVelocityFactory.java:95)
      	at com.xpn.xwiki.render.DefaultVelocityManager.getVelocityEngine(DefaultVelocityManager.java:211)
      	at org.xwiki.display.internal.AbstractDocumentTitleDisplayer.evaluateTitle(AbstractDocumentTitleDisplayer.java:168)
      	at org.xwiki.display.internal.AbstractDocumentTitleDisplayer.display(AbstractDocumentTitleDisplayer.java:107)
      	at org.xwiki.display.internal.AbstractDocumentTitleDisplayer.display(AbstractDocumentTitleDisplayer.java:50)
      	at org.xwiki.display.internal.DefaultDocumentDisplayer.display(DefaultDocumentDisplayer.java:80)
      	at org.xwiki.display.internal.DefaultDocumentDisplayer.display(DefaultDocumentDisplayer.java:38)
      	at org.xwiki.sheet.internal.SheetDocumentDisplayer.display(SheetDocumentDisplayer.java:111)
      	at org.xwiki.sheet.internal.SheetDocumentDisplayer.display(SheetDocumentDisplayer.java:50)
      	at org.xwiki.display.internal.ConfiguredDocumentDisplayer.display(ConfiguredDocumentDisplayer.java:67)
      	at org.xwiki.display.internal.ConfiguredDocumentDisplayer.display(ConfiguredDocumentDisplayer.java:41)
      	at com.xpn.xwiki.doc.XWikiDocument.getRenderedTitle(XWikiDocument.java:1145)
      	at com.xpn.xwiki.plugin.lucene.AbstractDocumentData.<init>(AbstractDocumentData.java:109)
      	at com.xpn.xwiki.plugin.lucene.DocumentData.<init>(DocumentData.java:62)
      	at com.xpn.xwiki.plugin.lucene.IndexUpdater.queueDocument(IndexUpdater.java:324)
      	at com.xpn.xwiki.plugin.lucene.IndexUpdater.onEvent(IndexUpdater.java:395)
      	at org.xwiki.observation.internal.DefaultObservationManager.notify(DefaultObservationManager.java:261)
      	at org.xwiki.observation.internal.DefaultObservationManager.notify(DefaultObservationManager.java:226)
      	at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1413)
      	at com.xpn.xwiki.plugin.scheduler.SchedulerPlugin.updateSchedulerJobClass(SchedulerPlugin.java:698)
      	at com.xpn.xwiki.plugin.scheduler.SchedulerPlugin.init(SchedulerPlugin.java:128)
      	at com.xpn.xwiki.plugin.XWikiPluginManager.initPlugin(XWikiPluginManager.java:152)
      	at com.xpn.xwiki.plugin.XWikiPluginManager.addPlugin(XWikiPluginManager.java:88)
      	at com.xpn.xwiki.plugin.XWikiPluginManager.addPlugins(XWikiPluginManager.java:116)
      	at com.xpn.xwiki.XWiki.preparePlugins(XWiki.java:1123)
      	at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:793)
      	at com.xpn.xwiki.XWiki.<init>(XWiki.java:738)
      	at com.xpn.xwiki.XWiki.getMainXWiki(XWiki.java:399)
      	at com.xpn.xwiki.XWiki.getXWiki(XWiki.java:486)
      	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:136)
      	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:116)
      	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
      	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
      	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
      	at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:538)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1352)
      	at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:120)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323)
      	at org.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:144)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323)
      	at com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:66)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323)
      	at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:208)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323)
      	at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:111)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323)
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:476)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
      	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:517)
      	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225)
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:937)
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
      	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:871)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
      	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:247)
      	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
      	at org.eclipse.jetty.server.Server.handle(Server.java:346)
      	at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:589)
      	at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:1048)
      	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:601)
      	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:214)
      	at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:411)
      	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:535)
      	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:529)
      	at java.lang.Thread.run(Thread.java:680)
      ] 
      2012-05-25 19:47:04,052 [Lucene Index Rebuilder] INFO  m.i.DefaultJMXBeanRegistration - Registering MBean: [org.xwiki.velocity.internal.jmx.JMXVelocityEngine@6f7750ef] with name [type=Velocity,domain=Engines,name=default] at [java.lang.RuntimeException
      	at org.xwiki.management.internal.DefaultJMXBeanRegistration.registerMBean(DefaultJMXBeanRegistration.java:55)
      	at org.xwiki.velocity.internal.DefaultVelocityFactory.createVelocityEngine(DefaultVelocityFactory.java:95)
      	at com.xpn.xwiki.render.DefaultVelocityManager.getVelocityEngine(DefaultVelocityManager.java:211)
      	at org.xwiki.display.internal.AbstractDocumentTitleDisplayer.evaluateTitle(AbstractDocumentTitleDisplayer.java:168)
      	at org.xwiki.display.internal.AbstractDocumentTitleDisplayer.display(AbstractDocumentTitleDisplayer.java:107)
      	at org.xwiki.display.internal.AbstractDocumentTitleDisplayer.display(AbstractDocumentTitleDisplayer.java:50)
      	at org.xwiki.display.internal.DefaultDocumentDisplayer.display(DefaultDocumentDisplayer.java:80)
      	at org.xwiki.display.internal.DefaultDocumentDisplayer.display(DefaultDocumentDisplayer.java:38)
      	at org.xwiki.sheet.internal.SheetDocumentDisplayer.display(SheetDocumentDisplayer.java:111)
      	at org.xwiki.sheet.internal.SheetDocumentDisplayer.display(SheetDocumentDisplayer.java:50)
      	at org.xwiki.display.internal.ConfiguredDocumentDisplayer.display(ConfiguredDocumentDisplayer.java:67)
      	at org.xwiki.display.internal.ConfiguredDocumentDisplayer.display(ConfiguredDocumentDisplayer.java:41)
      	at com.xpn.xwiki.doc.XWikiDocument.getRenderedTitle(XWikiDocument.java:1145)
      	at com.xpn.xwiki.plugin.lucene.AbstractDocumentData.<init>(AbstractDocumentData.java:109)
      	at com.xpn.xwiki.plugin.lucene.DocumentData.<init>(DocumentData.java:62)
      	at com.xpn.xwiki.plugin.lucene.IndexUpdater.queueDocument(IndexUpdater.java:324)
      	at com.xpn.xwiki.plugin.lucene.IndexRebuilder.addTranslationOfDocument(IndexRebuilder.java:390)
      	at com.xpn.xwiki.plugin.lucene.IndexRebuilder.addTranslationOfDocument(IndexRebuilder.java:378)
      	at com.xpn.xwiki.plugin.lucene.IndexRebuilder.indexDocuments(IndexRebuilder.java:344)
      	at com.xpn.xwiki.plugin.lucene.IndexRebuilder.indexWiki(IndexRebuilder.java:310)
      	at com.xpn.xwiki.plugin.lucene.IndexRebuilder.rebuildIndex(IndexRebuilder.java:265)
      	at com.xpn.xwiki.plugin.lucene.IndexRebuilder.runInternal(IndexRebuilder.java:216)
      	at com.xpn.xwiki.util.AbstractXWikiRunnable.run(AbstractXWikiRunnable.java:110)
      	at java.lang.Thread.run(Thread.java:680)
      ] 
      2012-05-25 19:47:04,147 [Lucene Index Rebuilder] WARN  m.i.DefaultJMXBeanRegistration - Failed to register resource with name [type=Velocity,domain=Engines,name=default] 
      javax.management.InstanceAlreadyExistsException: org.xwiki:type=Velocity,domain=Engines,name=default
      	at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:453) ~[na:1.6.0_31]
      	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.internal_addObject(DefaultMBeanServerInterceptor.java:1484) ~[na:1.6.0_31]
      	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:963) ~[na:1.6.0_31]
      	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:917) ~[na:1.6.0_31]
      	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:312) ~[na:1.6.0_31]
      	at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:482) ~[na:1.6.0_31]
      	at org.xwiki.management.internal.DefaultJMXBeanRegistration.registerMBean(DefaultJMXBeanRegistration.java:62) ~[xwiki-commons-management-4.1-SNAPSHOT.jar:na]
      	at org.xwiki.velocity.internal.DefaultVelocityFactory.createVelocityEngine(DefaultVelocityFactory.java:95) [xwiki-commons-velocity-4.1-20120523.144758-63.jar:na]
      	at com.xpn.xwiki.render.DefaultVelocityManager.getVelocityEngine(DefaultVelocityManager.java:211) [xwiki-platform-legacy-oldcore-4.1-20120523.221259-159.jar:na]
      	at org.xwiki.display.internal.AbstractDocumentTitleDisplayer.evaluateTitle(AbstractDocumentTitleDisplayer.java:168) [xwiki-platform-display-api-4.1-20120523.212404-230.jar:na]
      	at org.xwiki.display.internal.AbstractDocumentTitleDisplayer.display(AbstractDocumentTitleDisplayer.java:107) [xwiki-platform-display-api-4.1-20120523.212404-230.jar:na]
      	at org.xwiki.display.internal.AbstractDocumentTitleDisplayer.display(AbstractDocumentTitleDisplayer.java:50) [xwiki-platform-display-api-4.1-20120523.212404-230.jar:na]
      	at org.xwiki.display.internal.DefaultDocumentDisplayer.display(DefaultDocumentDisplayer.java:80) [xwiki-platform-display-api-4.1-20120523.212404-230.jar:na]
      	at org.xwiki.display.internal.DefaultDocumentDisplayer.display(DefaultDocumentDisplayer.java:38) [xwiki-platform-display-api-4.1-20120523.212404-230.jar:na]
      	at org.xwiki.sheet.internal.SheetDocumentDisplayer.display(SheetDocumentDisplayer.java:111) [xwiki-platform-sheet-api-4.1-20120523.212414-230.jar:na]
      	at org.xwiki.sheet.internal.SheetDocumentDisplayer.display(SheetDocumentDisplayer.java:50) [xwiki-platform-sheet-api-4.1-20120523.212414-230.jar:na]
      	at org.xwiki.display.internal.ConfiguredDocumentDisplayer.display(ConfiguredDocumentDisplayer.java:67) [xwiki-platform-display-api-4.1-20120523.212404-230.jar:na]
      	at org.xwiki.display.internal.ConfiguredDocumentDisplayer.display(ConfiguredDocumentDisplayer.java:41) [xwiki-platform-display-api-4.1-20120523.212404-230.jar:na]
      	at com.xpn.xwiki.doc.XWikiDocument.getRenderedTitle(XWikiDocument.java:1145) [xwiki-platform-legacy-oldcore-4.1-20120523.221259-159.jar:na]
      	at com.xpn.xwiki.plugin.lucene.AbstractDocumentData.<init>(AbstractDocumentData.java:109) [xwiki-platform-search-lucene-4.1-20120523.214923-187.jar:na]
      	at com.xpn.xwiki.plugin.lucene.DocumentData.<init>(DocumentData.java:62) [xwiki-platform-search-lucene-4.1-20120523.214923-187.jar:na]
      	at com.xpn.xwiki.plugin.lucene.IndexUpdater.queueDocument(IndexUpdater.java:324) [xwiki-platform-search-lucene-4.1-20120523.214923-187.jar:na]
      	at com.xpn.xwiki.plugin.lucene.IndexRebuilder.addTranslationOfDocument(IndexRebuilder.java:390) [xwiki-platform-search-lucene-4.1-20120523.214923-187.jar:na]
      	at com.xpn.xwiki.plugin.lucene.IndexRebuilder.addTranslationOfDocument(IndexRebuilder.java:378) [xwiki-platform-search-lucene-4.1-20120523.214923-187.jar:na]
      	at com.xpn.xwiki.plugin.lucene.IndexRebuilder.indexDocuments(IndexRebuilder.java:344) [xwiki-platform-search-lucene-4.1-20120523.214923-187.jar:na]
      	at com.xpn.xwiki.plugin.lucene.IndexRebuilder.indexWiki(IndexRebuilder.java:310) [xwiki-platform-search-lucene-4.1-20120523.214923-187.jar:na]
      	at com.xpn.xwiki.plugin.lucene.IndexRebuilder.rebuildIndex(IndexRebuilder.java:265) [xwiki-platform-search-lucene-4.1-20120523.214923-187.jar:na]
      	at com.xpn.xwiki.plugin.lucene.IndexRebuilder.runInternal(IndexRebuilder.java:216) [xwiki-platform-search-lucene-4.1-20120523.214923-187.jar:na]
      	at com.xpn.xwiki.util.AbstractXWikiRunnable.run(AbstractXWikiRunnable.java:110) [xwiki-platform-legacy-oldcore-4.1-20120523.221259-159.jar:na]
      	at java.lang.Thread.run(Thread.java:680) [na:1.6.0_31]
      

      Attachments

        Activity

          People

            vmassol Vincent Massol
            vmassol Vincent Massol
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: