Advertisement

07.22.2005 at 10:27AM PDT, ID: 21501209
[x]
Attachment Details

Cannot reach RMI JMX methods using JSP

Asked by celia05es in Java Server Pages (JSP)

Tags: jsp, rmi, can, jmx

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/examples/Basic/rmi.
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.JasperException: 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&oacute;n de Par&aacute;metros usando JMX RMI</title>
</head>
<body>
<%@page errorPage="errorPage.jsp" %>
<%@page language="java" %>
<%@page import="javax.management.Attribute"%>
<%@page import="javax.servlet.*, javax.servlet.http.*"%>
<%@page import="javax.servlet.http.HttpServletRequest"%>
<%@page import="java.util.*" %>
<%@page import="java.io.*" %>
<%@page import="javax.management.remote.JMXConnector"%>
<%@page import="javax.management.remote.JMXConnectorFactory"%>
<%@page import="javax.management.remote.JMXServiceURL"%>
<%@page import="javax.management.ObjectName"%>
<%@page import="util.SimpleStandardMBean"%>
<%@page import="javax.management.MBeanServerInvocationHandler"%>
<%@page import="javax.management.MBeanServerConnection"%>

<%
// Create an RMI Connector client and connect it to the RMI connector server
//--------------------------------------------------------------------------
JMXConnector jmxc = null;
System.out.println("\nCreate an RMI connector client and " +
             "connect it to the RMI connector server");
 JMXServiceURL url = new JMXServiceURL(
       "service:jmx:rmi:///jndi/rmi://localhost:9999/server");

 jmxc = JMXConnectorFactory.connect(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=SimpleStandard");
MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
SimpleStandardMBean mbean = (SimpleStandardMBean) MBeanServerInvocationHandler.newProxyInstance (mbsc,mbeanName, SimpleStandardMBean.class,true);
%>
<P>
Get an MBeanServerConnection........
<%
// GET THE STATE
//--------------
//String string = mbean.getState();
String string = mbean.getState();
//System.out.println("string="+string);
%>
<P>
Get the state .....
<%
// Close MBeanServer connection
//--------------------------
System.out.println("\nClose MBean Server connection...");
jmxc.close();
%>
</body>
</html>
===

===============


Start Free Trial
 
Keywords: Cannot reach RMI JMX methods using JSP
 
Loading Advertisement...
 
[+][-]07.23.2005 at 07:02AM PDT, ID: 14509692

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.23.2005 at 08:15AM PDT, ID: 14510162

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.26.2005 at 01:22AM PDT, ID: 14524870

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.28.2005 at 09:08AM PDT, ID: 14547186

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.28.2005 at 09:24AM PDT, ID: 14547355

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.22.2005 at 06:24AM PST, ID: 15341872

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]11.26.2005 at 07:04AM PST, ID: 15364801

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Java Server Pages (JSP)
Tags: jsp, rmi, can, jmx
Sign Up Now!
Solution Provided By: Computer101
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32