Monitoring ADF application deployed on Weblogic using Newrelic Java agent

I had registered on Newrelic some time back. I was lured into the registration by the free T-Shirt on offer for anyone who deploys Newrelic agent and use it to monitor the application. I never thought one could monitor the applications deployed locally. And then again today there was an email about anyone registering gets one month of CodeSchool subscription. So why not give Newrelic a try.

I have been developing the tool for my project in ADF and deploying it to weblogic server. So I thought of using the Newrelic for monitoring Java applications. In this post I am using WebLogic Server of version 10.3.5.0. The documentation provided here didn’t really help in setting up completely.

I used JDeveloper with IntegratedWebLogicServer for managing the weblogic server.

Here are the steps to follow:
1. Download the Java Agent from here. And unzip to the Weblogic server home which is by default at this location:C:OracleMiddlewarewlserver_10.3. So you will now see a newrelic folder in your weblogic home directory.

2. Now you have to attach the Java agent which is the newrelic.jar to your weblogic server at the time of its startup. For the version of weblogic server I used and on the Windows machine the weblogic startup is managed by startWebLogic.cmd. In my case this script was present in:

C:UsersUSER_NAMEAppDataRoamingJDevelopersystem11.1.2.1.38.60.81DefaultDomainbin

. Another way to find which script is being used is that when you try to start the IntegratedWebLogicServer from your JDeveloper you see some logging happening and in that you can find out which script was used to start your weblogic server. The screenshot shows the logging showing the script name:
WeblogicStartCommand

Open the startWebLogic.cmd file and add the following line somewhere at the top of the script:

set JAVA_OPTIONS=%JAVA_OPTIONS% -javaagent:"C:OracleMiddlewarewlserver_10.3newrelicnewrelic.jar"

the path should be the path where you extracted the newrelic zip.

3. Now start the weblogic server and deploy your application to it using JDeveloper. When the server starts it picks the NewRelic agent and you can see some logging similar to:

Jun 26, 2013 23:21:38 +0530 NewRelic 1 INFO: Agent is using Logback
Jun 26, 2013 23:21:38 +0530 NewRelic 1 INFO: Loading configuration file "C:OracleMiddlewarewlserver_10.3newrelic.newrelic.yml"

And you will also see a logs directory being created in your agent directory and see the logs being updated on newrelic_agent.log

Once you are confirmed that your Newrelic agent has attached itself to the weblogic server, you can visit the Newrelic dashboard from their site and view the data being sent by the Newrelic agent.

Some issues I found

Issue 1: Failed hostname verification check
Once the agent is running it keeps communicating with the Newrelic Saas application to send the application statistics. I found that the Weblogic server was reporting the following error:

<Jun 26, 2013 10:47:58 PM IST> <Warning> <Security> <BEA-090504> <Certificate chain received from collector.newrelic.com. - 204.93.223.153 failed hostname verification check. Certificate contained *.newrelic.com but check expected collector.newrelic.com.>

One can resolve this by turning off the Domain name verification which I found here. I opened the startWebLogic.cmd file and appended the following line: -Dweblogic.security.SSL.ignoreHostnameVerification=true. You would have to append this at two places. Your startWebLogic.cmd will not look something like:

if "%WLS_REDIRECT_LOG%"=="" (
  echo Starting WLS with line:
  echo %JAVA_HOME%binjava %JAVA_VM% %MEM_ARGS% -Dweblogic.Name=%SERVER_NAME% -Djava.security.policy=%WL_HOME%serverlibweblogic.policy -Dweblogic.security.SSL.ignoreHostnameVerification=true %JAVA_OPTIONS% %PROXY_SETTINGS% %SERVER_CLASS%
  %JAVA_HOME%binjava %JAVA_VM% %MEM_ARGS% -Dweblogic.Name=%SERVER_NAME% -Djava.security.policy=%WL_HOME%serverlibweblogic.policy -Dweblogic.security.SSL.ignoreHostnameVerification=true %JAVA_OPTIONS% %PROXY_SETTINGS% %SERVER_CLASS%
) else (
  echo Redirecting output from WLS window to %WLS_REDIRECT_LOG%
  %JAVA_HOME%binjava %JAVA_VM% %MEM_ARGS% -Dweblogic.Name=%SERVER_NAME% -Djava.security.policy=%WL_HOME%serverlibweblogic.policy -Dweblogic.security.SSL.ignoreHostnameVerification=true %JAVA_OPTIONS% %PROXY_SETTINGS% %SERVER_CLASS%  >"%WLS_REDIRECT_LOG%" 2>&1 
)

Issue 2: Proxy settings related issue
One can set the proxy settings in the newrelic.yml file which can be found in the newrelic directory or the directory where your newrelic agent is present.

With this I was able to manage my ADF application deployed to a local weblogic server using the Newrelic Java application monitoring tool.

Let me know if you are stuck trying the above steps.

1 thought on “Monitoring ADF application deployed on Weblogic using Newrelic Java agent”

  1. Newrelic is one of the best application monitoring tool today. This software has earned good praises and wonderful reviews from the experts worldwide.

    Reply

Leave a Reply

Discover more from Experiences Unlimited

Subscribe now to keep reading and get access to the full archive.

Continue reading