jueves, 15 de diciembre de 2016

Weblogic Jboss Migration issue 1: javax.naming.NameNotFoundException: env/jmx/runtime

Migración Weblogic - Jboss problema 1: obtener el Servidor MBeans

I my new job, we have to migrate original web applications deployed in a Weblogic 10.6.3 Application Server to Jboss EAP6 (Jboss AS7).

This post is about the first problem that i have found. The problem is how to instantate the MBeanServer object that containts all my beans.

The slice of code that instantate a the MBeanServer in weblogic is like that:

//Weblogic way
InitialContext ctx = new InitialContext();
this.mbs = ((MBeanServer)ctx.lookup("java:comp/env/jmx/runtime"));

If you deploy this code in a JBoss, the common error that appears in log is the next one:
javax.naming.NameNotFoundException: env/jmx/runtime

The way to solve this issue is change the context lookup for a FactoryManager 
to get the right MBeanServer.

//JBoss way
//another code
//another code

The good news is that this way works both in Jboss and Weblogic.

No hay comentarios:

Publicar un comentario