RE: Using JMX with Tomcat: classloading issues

2009-06-16 Thread Caldarale, Charles R
 From: Pankaj Tandon [mailto:pankajtan...@gmail.com]
 Subject: Using JMX with Tomcat: classloading issues
 
 Because rt.jar is (probably) used by the bootstrap classloader,
 I HAVE to include weblogic.jar in the CATALINA_HOME/common/lib
 directory.

Yes, rt.jar is handled by the bootstrap classloader.  Why do you think that 
requires placing weblogic.jar in common/lib?  It should work properly in your 
webapp's WEB-INF/lib, which would be the preferred location.

However, weblogic.jar may contain classes that Tomcat already supplies (notably 
the ones in servlet-api.jar), so these would need to be removed from 
weblogic.jar before you can use it anywhere.

 I can get the JMX part of the solution to work because both, rt.jar and
 weblogic.jar are loaded by the same (system) classloader.

That statement is also not true.  As previously established, rt.jar is handled 
by the bootstrap classloader, while jars in common/lib are handled by Tomcat's 
common classloader.

 But then my Jython classes do not work because jython.jar is tucked
 away in the webapp's WEB-INF/lib dir of the webapp and my Jython 
 solution needs classes from weblogic.jar which is loaded by the
 system classloader and hence in a different namespace.

I think you're misinterpreting whatever symptoms you're encountering.  None of 
what you describe so far is a problem, although you do have some misconceptions 
about how classloading in Tomcat works.

What symptoms are you seeing?  (You never actually said.)

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Using JMX with Tomcat: classloading issues

2009-06-16 Thread Martin Gainty

request TOMCAT use the weblogic.management.remote package from wljmxclient.jar 
instead as illustrated here:

Djmx.remote.protocol.provider.pkgs=weblogic.management.remote



and 



Djava.class.path=D:\jdk1.5.0_16\lib\jconsole.jar;D:\jdk1.5.0_16\lib\tools.jar;%WL_HOME%\server\lib\wljmxclient.jar

http://e-docs.bea.com/wls/docs81/jms/thin_client.html

Martin Gainty 
__ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




 Date: Tue, 16 Jun 2009 07:39:17 -0700
 From: pankajtan...@gmail.com
 To: users@tomcat.apache.org
 Subject: Using JMX with Tomcat: classloading issues
 
 
 Hi all,
 I am writing a webapp that uses JMX to manage weblogic and websphere servers
 and hosting it on Tomcat 6.0.18. The app also uses Jython to manipulate
 MBeans within the app servers.
 
 Here's the issue that I'm facing:
 To get a JMX connection using JMXConnectionFactory using below:
 JMXConnector connector = JMXConnectorFactory.connect(serviceURL, h);
 I have to rely on classes in weblogic.jar
 That is because the implementation of JMXConnector is in weblogic.jar.
 However, the interface/abstract class for JMXConnectionFactory lives in
 rt.jar that comes with JDK1.5 or JDK1.6
 
 Because rt.jar is (probably) used by the bootstrap classloader, I HAVE to
 include weblogic.jar in the CATALINA_HOME/common/lib directory. If I do so,
 I can get the JMX part of the solution to work because both, rt.jar and
 weblogic.jar are loaded by the same (system) classloader. 
 
 But then my Jython classes do not work because jython.jar is tucked away in
 the webapp's WEB-INF/lib dir of the webapp and my Jython solution needs
 classes from weblogic.jar which is loaded by the system classloader and
 hence in a different namespace.
 I tried placing jython.jar in common/lib too, but that did not work because
 Jython needs classes from my webapp and I go down a slippery slope of
 chasing classes across classlaoders.
 
 So the ideal solution would be to get weblogic.jar loaded from the webapp
 classloader. And not place anything in the CATALINA_HOME/common/lib
 directory.
 
 How can I place weblogic.jar in the webapp classlaoder and have my JMX
 solution work, given that javax.management.remote.JMXConnectorFactory
 resides in rt.jar which is in the System classpath?
 
 Any pointers will be appreciated!
 
 Thanks a lot!
 
 Pankaj
 
 
 
 
 -- 
 View this message in context: 
 http://www.nabble.com/Using-JMX-with-Tomcat%3A-classloading-issues-tp24055767p24055767.html
 Sent from the Tomcat - User mailing list archive at Nabble.com.
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 

_
Microsoft brings you a new way to search the web.  Try  Bing™ now
http://www.bing.com?form=MFEHPGpubl=WLHMTAGcrea=TEXT_MFEHPG_Core_tagline_try 
bing_1x1

Re: Using JMX with Tomcat: classloading issues

2009-06-16 Thread Pankaj Tandon

@Chuck: Yes, I did kind of munge the bootstrap and System classloaders
together. But the problem still remains. When I remove weblogic.jar from
common/lib and my code attempts to establish a JMX connection using below:
JMXConnector connector = JMXConnectorFactory.connect(serviceURL, h);

I get the following error stack:
java.net.MalformedURLException: Unsupported protocol: t3

javax.management.remote.JMXConnectorFactory.newJMXConnector(JMXConnectorFactory.java:327)

javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:247)

com.fedex.ground.scm.service.ControllerServiceImpl.initConnection(ControllerServiceImpl.java:105)

com.fedex.ground.scm.service.ControllerServiceImpl.retrieveAppDataForHost(ControllerServiceImpl.java:47)

com.fedex.ground.scm.ControllerBean.setSelectedHost(ControllerBean.java:75)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.apache.el.parser.AstValue.invoke(AstValue.java:172)
org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)

com.sun.faces.application.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:71)
javax.faces.component.UICommand.broadcast(UICommand.java:377)

com.icesoft.faces.component.panelseries.UISeries$RowEvent.broadcast(UISeries.java:559)

com.icesoft.faces.component.panelseries.UISeries.broadcast(UISeries.java:238)
javax.faces.component.UIData.broadcast(UIData.java:849)

com.icesoft.faces.component.panelseries.UISeries.broadcast(UISeries.java:233)
javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:452)
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:764)

com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:266)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:132)

com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:17)

com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.renderCyclePartial(ReceiveSendUpdates.java:64)

com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.service(ReceiveSendUpdates.java:40)

com.icesoft.faces.webapp.http.core.ViewBoundServer.service(ViewBoundServer.java:65)

com.icesoft.faces.webapp.http.core.RequestVerifier.service(RequestVerifier.java:44)

com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer$Matcher.serviceOnMatch(PathDispatcherServer.java:50)

com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:19)

com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)

com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:63)

com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:139)

com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:53)

com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)

com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)

com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:82)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:46)

t3 is a WLS proprietary protocol so I am assuming that JMXConnectorFactory
does not even get to the weblogic.jar class to pick up the JMX classes to
recognize the weblogic protocol.

So that is the symptom. If I can get the Weblogic.jar file out of the System
classpath (and into the WEB-INF/lib), I'm pretty sure, I can get the Jython
piece to work. 


@Martin: The wljmxclient.jar that you mentioned does not have the class
JMXConnector. And I'm not sure why jConsole is being used here.

Thanks!

Pankaj





Pankaj Tandon wrote:
 
 Hi all,
 I am writing a webapp that uses JMX to manage weblogic and websphere
 servers and hosting it on Tomcat 6.0.18. The app also uses Jython to
 manipulate MBeans within the app servers.
 
 Here's the issue that I'm facing:
 To get a JMX connection using JMXConnectionFactory using below:
 JMXConnector connector = JMXConnectorFactory.connect(serviceURL, h);
 I have to rely on classes in weblogic.jar
 That is because the implementation of JMXConnector is in weblogic.jar.
 However, the interface/abstract class for JMXConnectionFactory lives in
 rt.jar that comes with JDK1.5 or JDK1.6
 
 Because rt.jar is (probably) used by the bootstrap classloader, I HAVE to
 include weblogic.jar in the CATALINA_HOME/common/lib directory. If I do
 so, I can get 

Re: Using JMX with Tomcat: classloading issues

2009-06-16 Thread Pankaj Tandon

@chuck and @martin You both helped me. Turns out that I could move all
weblogic classes in WEB-INF/lib and out of the System classloader. But
moving just weblogic.jar did not do the trick. I needed to package the
following jars from the BEA distribution into the Webapp:
weblogic.jar
wljmxclient.jar
wlclient.jar

Thanks for your help!

Pankaj


Pankaj Tandon wrote:
 
 Hi all,
 I am writing a webapp that uses JMX to manage weblogic and websphere
 servers and hosting it on Tomcat 6.0.18. The app also uses Jython to
 manipulate MBeans within the app servers.
 
 Here's the issue that I'm facing:
 To get a JMX connection using JMXConnectionFactory using below:
 JMXConnector connector = JMXConnectorFactory.connect(serviceURL, h);
 I have to rely on classes in weblogic.jar
 That is because the implementation of JMXConnector is in weblogic.jar.
 However, the interface/abstract class for JMXConnectionFactory lives in
 rt.jar that comes with JDK1.5 or JDK1.6
 
 Because rt.jar is (probably) used by the bootstrap classloader, I HAVE to
 include weblogic.jar in the CATALINA_HOME/common/lib directory. If I do
 so, I can get the JMX part of the solution to work because both, rt.jar
 and weblogic.jar are loaded by the same (system) classloader. 
 
 But then my Jython classes do not work because jython.jar is tucked away
 in the webapp's WEB-INF/lib dir of the webapp and my Jython solution needs
 classes from weblogic.jar which is loaded by the system classloader and
 hence in a different namespace.
 I tried placing jython.jar in common/lib too, but that did not work
 because Jython needs classes from my webapp and I go down a slippery slope
 of chasing classes across classlaoders.
 
 So the ideal solution would be to get weblogic.jar loaded from the webapp
 classloader. And not place anything in the CATALINA_HOME/common/lib
 directory.
 
 How can I place weblogic.jar in the webapp classlaoder and have my JMX
 solution work, given that javax.management.remote.JMXConnectorFactory
 resides in rt.jar which is in the System classpath?
 
 Any pointers will be appreciated!
 
 Thanks a lot!
 
 Pankaj
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Using-JMX-with-Tomcat%3A-classloading-issues-tp24055767p24058867.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org