Using a netty library with beans deployment descriptor in multiple applications in JBoss EAP?

Solution Unverified - Updated -

Issue

  • We are using Netty framework in several web applications running on JBoss EAP. The problem that we encountered when we had a copy of netty.jar in each application.war/WEB-INF/lib was that the second application failed to deploy with the following error:

EAP 5

WARN [org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext\] (main) Unable to register deployment mbean org.jboss.netty.internal.LoggerConfigurator  
javax.management.InstanceAlreadyExistsException: jboss.deployment:id="org.jboss.netty.internal.LoggerConfigurator",type=Component already registered.  
 at org.jboss.mx.server.registry.BasicMBeanRegistry.add(BasicMBeanRegistry.java:756)  
 at org.jboss.mx.server.registry.BasicMBeanRegistry.registerMBean(BasicMBeanRegistry.java:233)  
....  
ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController\] (main) Error installing to Real: name=vfsfile:/opt/jboss/jboss-eap-5.0/jboss-as/server/all/deploy/nettyapp.war/ state=PreReal mode=Manual requiredState=Real  
org.jboss.deployers.spi.DeploymentException: Error deploying: org.jboss.netty.internal.LoggerConfigurator  
 at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)  
 at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:125)  
...

EAP 6

ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.unit."$APPLICATION_NAME.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."$APPLICATION_NAME.war".INSTALL: JBAS018733: Failed to process phase INSTALL of deployment "$APPLICATION_NAME.war"
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:127) [jboss-as-server-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_25]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_25]
        at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]
Caused by: org.jboss.msc.service.DuplicateServiceException: Service jboss.pojo."org.jboss.netty.internal.LoggerConfigurator".DESCRIBED is already registered
        at org.jboss.msc.service.ServiceRegistrationImpl.setInstance(ServiceRegistrationImpl.java:154) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
        at org.jboss.msc.service.ServiceControllerImpl.startInstallation(ServiceControllerImpl.java:227) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
        at org.jboss.msc.service.ServiceContainerImpl.install(ServiceContainerImpl.java:561) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
        at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:201) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
        at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2228) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
        at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:201) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
        at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2228) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
        at org.jboss.msc.service.ServiceBuilderImpl.install(ServiceBuilderImpl.java:307) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
        at org.jboss.as.pojo.ParsedKernelDeploymentProcessor.describeBean(ParsedKernelDeploymentProcessor.java:94)
        at org.jboss.as.pojo.ParsedKernelDeploymentProcessor.deploy(ParsedKernelDeploymentProcessor.java:76)
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:120) [jboss-as-server-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10]
        ... 5 more

EAP 7

ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.unit."$APPLICATION_NAME.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."$APPLICATION_NAME.war".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "$APPLICATION_NAME.war"
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:172)
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032)
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.jboss.msc.service.DuplicateServiceException: Service jboss.pojo."org.jboss.netty.internal.LoggerConfigurator".DESCRIBED is already registered
        at org.jboss.msc.service.ServiceRegistrationImpl.setInstance(ServiceRegistrationImpl.java:158)
        at org.jboss.msc.service.ServiceControllerImpl.startInstallation(ServiceControllerImpl.java:235)
        at org.jboss.msc.service.ServiceContainerImpl.install(ServiceContainerImpl.java:768)
        at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:223)
        at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2555)
        at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:223)
        at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2555)
        at org.jboss.msc.service.ServiceBuilderImpl.install(ServiceBuilderImpl.java:317)
        at org.jboss.as.pojo.ParsedKernelDeploymentProcessor.describeBean(ParsedKernelDeploymentProcessor.java:95)
        at org.jboss.as.pojo.ParsedKernelDeploymentProcessor.deploy(ParsedKernelDeploymentProcessor.java:77)
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:165)
        ... 5 more

  • Why EJB resource reference configuration with JNDI is throwing above ERROR ?

  • This happened because of jboss-beans.xml inside netty.jar, which defines one bean org.jboss.netty.internal.LoggerConfigurator. As a workaround, I removed netty.jar from the application, and moved it into lib directory of the JBoss profile - this works fine, netty library is available, and JBoss doesn't try to deploy that bean. However, our developers and architects don't like this solution, as it creates more dependencies of the application on the deployment environment, and all applications would be using the same Netty version - if we need to upgrade Netty because of one application's requirements later, we have to update and test all applications which are using it.

  • My question is: is it possible to "scope" somehow the deployed beans inside the application context, so we could use a copy of netty.jar inside each application? Classloading should not be a problem, the applications are using isolated classloaders (via jboss-web.xml class-loading - loader-repository configuration).

  • There is no netty jar file packaged in my deployment but I still see the same error message "DuplicateServiceException: Service jboss.pojo."org.jboss.netty.internal.LoggerConfigurator".DESCRIBED is already registered" is getting thrown when deploying my application.

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 5.x
    • 6.x
    • 7.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content