Trying to run ijamon on a weblogic cluster

2011-10-21
2013-05-20
  • Steve Souza
    Steve Souza
    2011-10-21

    I integrated JAMon into my application and tested it on my local environment. Everything seems to be working correctly.

    I have now moved the updated application code into my production environment and I am having several issues.

    1.       I can view all pages expect the monmanage.jsp page which returns a 500 error. In my logs I see the following exception:

    java.lang.NullPointerException

                    at java.util.concurrent.ConcurrentHashMap.containsKey(ConcurrentHashMap.java:782)

                    at com.jamonapi.FactoryEnabled.exists(FactoryEnabled.java:178)

                    at com.jamonapi.MonitorFactory.exists(MonitorFactory.java:273)

                    at jsp_servlet.__monmanage.executeAction(__monmanage.java:237)

                    at jsp_servlet.__monmanage._jspService(__monmanage.java:303)

                    at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)

                    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)

                    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)

                    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)

                    at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:416)

                    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:326)

                    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:183)

                    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3686)

                    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650)

                    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)

                    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)

                    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268)

                    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)

                    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)

                    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)

                    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

    >

    2.       None of my monitors are being displayed on the jamonadmin.sjp page or sql details page. Both worked fine on my local environment.

    My production environment consists of 4 servers distributed over two clusters.

    I have copied the jamon.jar file into a common directory and added it to each server instance classpath.  I also include the jamon.jar in the web-inf/lib folder of my application. I deployed jamon.war to two servers (one on each cluster)

    Any insights would be appreciated.

    Thank you!

     
  • Steve Souza
    Steve Souza
    2011-10-21

    Chris, I'll answer question 2 first.  Almost always the problem with jamon is a simple classloader issue.  In fact this is really THE ONLY reason I have ever seen for it not working.

    The usual scenario plays out like this.  A copy of jamon jar is put in the application war or ejb jar.  Another copy is put at the server level.  The jamon war doesn't contain it's own version of jamon war and so uses the one at the server level (the fact that you aren't getting exceptions in jamonadmin.jsp tells me that you have an accesssible jamon jar probably at the server level).  Meanwhile the application usually is writting to the jamon jar file loaded in application scope.  The result would be that you are doing your reads from a loaded jamon jar that never has data, and writing to a loaded jamon jar that is never read.  This would explain seeing no data.

    To answer first question do you directly execute monmanage.jsp? If so you would get that exception.  It is properly called by clicking on a monitor from the jamonadmin.jsp screen.  Another way you can get the error is to click on a monitor that no longer exists (say you reset your monitors from another screen). 

    In general make sure you have the same version of the jamon jar file loaded only at the server level and not in multiple locations (i.e. ejb jar, war etc).

    Cheers,
    Steve

     
  • Steve Souza
    Steve Souza
    2011-10-21

    I should have read your whole email.   I just saw this:

    << I have copied the jamon.jar file into a common directory and added it to each server instance classpath. I also include the jamon.jar in the web-inf/lib folder of my application. I deployed jamon.war to two servers (one on each cluster)>>
    Which as I expected you have loaded jamon jar in both application and server scope.  jamon war is reading the jamon stats from the server scoped jar and your application is writing to the one in web-inf/lib.   In general it is never good to have the same jar in multiple locations in your classpath using different classloaders.

     
  • Steve Souza
    Steve Souza
    2011-10-21

    Thanks Steve! I will make this change and see if it solves my issues.