Hello,
I am having a problem trying to call MBean from a jsp file.
I am using tomcat5.5.9. The jsp worked once!!!! so I don't think anything is missing (like import, etc) but for some reason it does not work now.
I do hope you can help me.... I am completely desperate!
THanks
I am using an rmi example that comes in the directory: jmxremote-1_0_1-bin/exampl
es/Basic/r
mi.
Under this directory, the file Client.server is the one I want to modify in order to use a index.jsp file.
The index.jsp file connects to the Server without problem. (see log output)... but when I am trying to get an attribute I get a strange exception:
org.apache.jasper.JasperEx
ception: Unable to compile class for JSP
Generated servlet error:
Only a type can be imported. java.io resolves to a package
Log output:
=======
Create an RMI connector client and connect it to the RMI connector server
Get an MBeanServerConnection
=======
the jsp file is as follows:
==============
<html>
<head>
<title>Modificación
de Parámetros usando JMX RMI</title>
</head>
<body>
<%@page errorPage="errorPage.jsp" %>
<%@page language="java" %>
<%@page import="javax.management.A
ttribute"%
>
<%@page import="javax.servlet.*, javax.servlet.http.*"%>
<%@page import="javax.servlet.http
.HttpServl
etRequest"
%>
<%@page import="java.util.*" %>
<%@page import="java.io.*" %>
<%@page import="javax.management.r
emote.JMXC
onnector"%
>
<%@page import="javax.management.r
emote.JMXC
onnectorFa
ctory"%>
<%@page import="javax.management.r
emote.JMXS
erviceURL"
%>
<%@page import="javax.management.O
bjectName"
%>
<%@page import="util.SimpleStandar
dMBean"%>
<%@page import="javax.management.M
BeanServer
Invocation
Handler"%>
<%@page import="javax.management.M
BeanServer
Connection
"%>
<%
// Create an RMI Connector client and connect it to the RMI connector server
//------------------------
----------
----------
----------
----------
----------
JMXConnector jmxc = null;
System.out.println("\nCrea
te an RMI connector client and " +
"connect it to the RMI connector server");
JMXServiceURL url = new JMXServiceURL(
"service:jmx:rmi:///jndi/r
mi://local
host:9999/
server");
jmxc = JMXConnectorFactory.connec
t(url,null
);
%>
Create an RMI connector client and connect it to the RMI connector server..
<%
// Get an MBeanServerConnection
//------------------------
-----
System.out.println("\nGet an MBeanServerConnection");
ObjectName mbeanName = new ObjectName ("MBean:type=SimpleStandar
d");
MBeanServerConnection mbsc = jmxc.getMBeanServerConnect
ion();
SimpleStandardMBean mbean = (SimpleStandardMBean) MBeanServerInvocationHandl
er.newProx
yInstance (mbsc,mbeanName, SimpleStandardMBean.class,
true);
%>
<P>
Get an MBeanServerConnection.....
...
<%
// GET THE STATE
//--------------
//String string = mbean.getState();
String string = mbean.getState();
//System.out.println("stri
ng="+strin
g);
%>
<P>
Get the state .....
<%
// Close MBeanServer connection
//------------------------
--
System.out.println("\nClos
e MBean Server connection...");
jmxc.close();
%>
</body>
</html>
===
===============
Start Free Trial