Re: adding mx4j's connector class to factory list

Blaine Simpson <[email protected]>
Newsgroups gmane.comp.java.mx4j.devel
Message-ID <[email protected]>
Bordet, Simone wrote:
> Hi,
> 
> 
>>>BTW, I could not find the RJMX classes in Tomcat 5...
>>>Where are they ? I am trying to run your example to see 
>>
>>what it does not work.
>>
>>$CATALINA_HOME/common/lib.  It could very well depend on the 
>>sub-version
>>of Tomcat.  I know that they have been moving logging libraries around
>>due to classloader conflicts.
> 
> 
> Well, I could find there only the JMXRI's JMX classes (javax.management.*) but not remote's (javax.management.remote.*) RJMXRI's.

Here's my listing of $CATALINA_HOME/common/lib with my installation of TC
5.0.16.  You can tell by the timestamps that I messed with mail.jar, hsqldb.jar
and commons-logging.jar.  The rest all came with the distro.

balder$ ls -ltr
total 3625
-rw-r--r--    1 root     root       327603 2003-06-25 00:05 mail.jar
-r--r--r--    1 blaine   users       54665 2003-11-20 00:38 activation.jar
-rw-r--r--    1 root     root        92621 2003-11-30 10:03 servlet-api.jar
-rw-r--r--    1 root     root        42060 2003-11-30 10:03 naming-resources.jar
-rw-r--r--    1 root     root         2135 2003-11-30 10:03 naming-java.jar
-rw-r--r--    1 root     root        15073 2003-11-30 10:03 naming-factory.jar
-rw-r--r--    1 root     root        28455 2003-11-30 10:03 naming-common.jar
-rw-r--r--    1 root     root        49510 2003-11-30 10:03 jsp-api.jar
-rw-r--r--    1 root     root       188231 2003-11-30 10:03 jmx-remote-tools.jar
-rw-r--r--    1 root     root       168008 2003-11-30 10:03 jmx-remote.jar
-rw-r--r--    1 root     root       365858 2003-11-30 10:03 jmx.jar
-rw-r--r--    1 root     root       101546 2003-11-30 10:03 jasper-runtime.jar
-rw-r--r--    1 root     root       343575 2003-11-30 10:03 jasper-compiler.jar
-rw-r--r--    1 root     root        39523 2003-11-30 10:03 commons-pool-1.1.jar
-rw-r--r--    1 root     root       112341 2003-11-30 10:03 commons-el.jar
-rw-r--r--    1 root     root       100776 2003-11-30 10:03 commons-dbcp-1.1.jar
-rw-r--r--    1 root     root       165119 2003-11-30 10:03 commons-collections.jar
-rw-r--r--    1 root     root       736810 2003-11-30 10:03 ant.jar
-rw-r--r--    1 root     root       709639 2004-01-20 18:36 hsqldb.jar
-rw-rw-r--    1 tomcat   tomcat      31605 2004-01-25 11:52 commons-logging.jar
balder$

Would you suggest that I try removing the RI remote libs?  The Tomcat Admin
Tool or App Manager may use it with this version, but I'd find out soon enough.
(I know that it uses the base jmx.jar, but I don't know about the others).

> Maybe I'm confused, let's try to recap.
> 
> You're running a HTTP connector you wrote that uses a JMXConnector to connect to a JMXConnectorServer that lives in JVM2.
> You've packaged MBeans on the servlet container (outside WEB-INF), are their classes also present in JVM2 ?

Excellent point.  My other email about where the MBeans go is completely wrong.
As you notice, the MBeans get deployed on the server-side.  I hadn't gotten
around to deploying MBeans at all because I haven't gotten the Connector working
yet.

Note that on JVM1 you just need the class names of the MBeans (it can be a 
management method of a remote MBean that returns you this information).

Sounds good.  I like the idea of being able to tweak the instructions also,
not just the info on specific MBeans, and there's no reason to involve JMX
for that.

Right now I'm reading this text as a resource (since no security manager
is involved in the servlet JVM).  I propose long-term plan of getting MBean
list from an MBean operation, and other run-time display text from a
Dispatcher.include().

> You have mx4j.jar and mx4j-remote.jar in WEB-INF/lib.

Yes.  I don't want to fill up everybody's mailboxes.  Do you want me to
email the war to your personal email addr?

> You have the rmiregistry running.

No.  My confusion is because I have not coded my own remote clients for
over a year now (using in-JVM connectors and adaptors since then), but
when I was making production remote JMX clients, I could swear that I never
used any JNDI or rmiregistry-- I didn't need to when I used :rmi:.
(Unfortunately, I no longer work there so I don't have access to that code
now).  Has something changed, or am I going insane and you always need to
run rmiregistry to use :rmi: URLs?  No problem if it's the latter, I'll just
re-learn it.

> The goal is to allow a user to register/unregister/interact with MBeans from HTML to JVM2. JVM1 will only act as a bridge.
> 
> With this configuration, Tomcat's JMX classes should not be involved at all.

Comes down to a classloader issue.  My version of Tomcat does use the RI libs,
because it croaks if I remove them.  Since they are in common/lib, they can only
be loaded by a high-level classloader.  When my war is loaded, the RI JMX
factories have already been loaded by that high-level classloader.  Regardless
of the fact that war-bundled classes have higher priority with J2EE 1.3, they
will still defer to previously-loaded classes.

I thought that this was why things worked when I ran a mx4j server from my
servlet.  I used mx4j by setting javax.management.builder.initial and
asking the R.I. factory for a mx4j MBeanFactory (with MBeans using mx4j's
AbstractDynamicBean).  Maybe this isn't what is happening, especially since
it isn't working for the connector factory.

For the time being, I just want to get this working so I can get the demo
site running as planned.  I think I'll download the current stable TC 5.x
and see how they're bundling things nowadays.  Maybe the problem will go away.

At some point in the future, maybe we can figure the best way to get mx4j
working with all the different TC5.x subversions.

>>Thx for looking.
>>
>>If you're not running that for self-education
> 
> 
> Well, yes, I would like to see if there is any problem with T5. With T4 no issues at all, and I am hoping would be the case for T5 as well.
> 
> Thanks
> 
> Simon


-- 
Don't pray in my school, and I won't think in your church.
ICF:  703-934-3692       Cell:  703-944-9317


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.