BLOG ARTICLE JBoss AS 5.0 | 2 ARTICLE FOUND

  1. 2009/02/11 JBoss MBean Access
  2. 2008/12/05 JBoss 5.0GA Release

JBoss에서 원하는 MBean 에 접근하는 코드는 다음과 같습니다. 간단하게 JSP 파일을 만들어 실행해 보면 됩니다.

<%@ page language="java" contentType="text/html; charset=UTF-8"   pageEncoding="UTF-8" import="javax.naming.*, java.util.*,javax.management.*,org.jboss.jms.server.destination.*,org.jboss.jmx.adaptor.rmi.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!--meta http-equiv="refresh" content="5"-->
<link href="style.css" rel=stylesheet type="text/css">
<title>Insert title here</title>
</head>
 
<body leftmargin=15 topmargin=10>
<center><p>
<br>
 
<%
            Hashtable<String,String> env = new Hashtable<String,String>();
        String factory = "org.jboss.security.jndi.JndiLoginInitialContextFactory";
        env.put(Context.INITIAL_CONTEXT_FACTORY, factory);
        String url = "jnp://127.0.0.1:1099";
        env.put(Context.PROVIDER_URL, url);
        env.put(Context.SECURITY_CREDENTIALS, "admin");
        env.put(Context.SECURITY_PRINCIPAL, "admin");
        Context ctx = new InitialContext(env);
        RMIAdaptor server = (RMIAdaptor) ctx.lookup("jmx/invoker/RMIAdaptor");

        System.out.println(server);
        String targetName = "jboss.deployment:id=\"HRService\",type=Component";
        //String targetName = "jboss.messaging.destination:name=A,service=Queue";
        //String targetName = "jboss.jca:name='jboss-local-jdbc.rar',service=RARDeployment";
        ObjectName objName = ObjectName.getInstance(targetName);
        out.println(objName.getClass().getName());

    MBeanInfo  info = server.getMBeanInfo(objName);
        System.out.println("JNDIView Class: " + info.getClassName());

    MBeanOperationInfo[] opInfo = info.getOperations();
System.out.println("JNDIView Operations: ");
for(int o = 0; o < opInfo.length; o ++) {
    MBeanOperationInfo op = opInfo[o];

    String returnType = op.getReturnType();
    String opName     = op.getName();
    System.out.print(" + " + returnType + " " + opName + "(");

    MBeanParameterInfo[] params = op.getSignature();
    for(int p = 0; p < params.length; p++)  {
        MBeanParameterInfo paramInfo = params[p];

        String pname = paramInfo.getName();
        String type  = paramInfo.getType();

        if (pname.equals(type)) {
            System.out.print(type);
        } else {
            System.out.print(type + " " + objName);
        }

        if (p < params.length-1) {
            System.out.print(',');
        }
    }
    System.out.println(")");
}

// Invoke the list(boolean) op
//  String[] sig    = {"boolean"};
//   Object[] opArgs = {Boolean.TRUE};
 //   Object   result = server.invoke(objName, "list", opArgs, sig);

  //   System.out.println("JNDIView.list(true) output:\n"+result);

%>


크리에이티브 커먼즈 라이센스
Creative Commons License
2009/02/11 20:11 2009/02/11 20:11

JBoss Application Server 5.0 GA가 release 되었습니다. 3년이라는 긴 시간이 들었는데 간단하게 이유를 들자면 내부의 microkernel과 microcontainer 구조의 변경이 가장 컸으며, OSGi 지원 등의 다양한 기능이 포함되면서 나타나는 현상 해결을 위한 시간이었다고 보면 될 것 같습니다.

JBoss-Web의 성능 향상 뿐만 아니라 Cache, AOP등의 융합, 즉 service enabling으로 application server가 되었네요. 이러한 조립식 구조가 될 수 있다는 것은 microcontainer 기반위에 모두 흡수될 수 있는 각 프레임워크의 특성 때문입니다.

새로운 것중의 하나가 VDF(Virtual Deployment Framework)인데 이 부분은 저도 봐야겠습니다.

자세한 사항은 다음의 URL에서 확인할 수 있습니다.
http://sourceforge.net/project/shownotes.php?release_id=645033&group_id=22866

크리에이티브 커먼즈 라이센스
Creative Commons License
2008/12/05 15:08 2008/12/05 15:08