cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

passing parameters to play apps

dan_m_smith
Helper
 
6 REPLIES 6

dan_m_smith
Helper

We have stand-alone applications running in the Play/Akka Framework.
We can't seem to get the -agentpath command line parameter to be
included in the java start-up. Are there any secrets to get this to
work?

brett_b2
Inactive

Hey Dan,

Is the argument simply skipped over? Is there an error or exception during startup? Are you able to see anything in your application logs and is a app mon agent log file created?

Thanks!

Joe_Hoffman
Dynatrace Champion
Dynatrace Champion

In addition to Bretts good questions, can you provide the syntax of your startup command line, perhaps this is a syntactical issue.

If you're putting the -agentpath into some file that is read by some startup process, it is possible the startup process does not recognize the -agentpath parameter and ignores it. This can be confirmed by inspecting the actual running jvm command line at the OS level and seeing if the AgentPath string is actually in there.

If it is, then the next step is the agent log file.

If -agentpath is not getting into the process, there is another way using environment variables. But first determine whether it's making it into the process command line or not.

harald_berger
Dynatrace Pro
Dynatrace Pro

Hi Dan,

Please try to modify the build/build.bat file in the play subfolder framework. This is where the java command is defined.

Best

Harry

dan_m_smith
Helper

Thanks for all of your quick responses. I'm acting as a middleman on this one so it may take a while to try out your ideas and provide the feedback/details you are looking for.

I'll let you know as soon as I get some responses.

Thanks again.

Dan

dan_m_smith
Helper

Hello,

It looks like the Build teams have figured this out. I'll post their approach here for others although I am not completely clear on what they did differently.

Here are some updates on how the
agent issue is fixed for PS application.

  • 1.When we tried to start application by giving
    agent path in the startup command (JAVA_OPTS), there was an error thrown saying
    bad path. This is because, in the startup script, application home directory is
    defined. So script was expecting any path given in JAVA_OPTS while running
    script to be inside the application home directory.
  • 2.In our case agent is not inside the
    application, it is installed in some other directory. Though we give absolute
    path of agent the script could not recognize the same.
  • 3.The changes I have made is, the agent path
    is added inside the script directly. Since it is part of script, it does not
    care about the application home directory and considers only the absolute path.
    (find the mail chain below.)

Dynatrace is configured in PS Play application successfully.

Please find the details,

  • 1.Changes made in the PS application startup scripts.
  • a.profileservices.bat




rem We use the value of the
JAVA_OPTS environment variable if defined, rather than the config.

set _JAVA_OPTS=%JAVA_OPTS%


JAVA_OPTS="$JAVA_OPTS
-agentpath:/usr/local/Dynatrace/dynatrace-6.2/agent/lib64/libdtagent.so=name=SL_WDC_PS_PERF_ATOMIC_N1,server=10.149.96.107:9999"


if
"!_JAVA_OPTS!"=="" set _JAVA_OPTS=!CFG_OPTS!

  • b.profileservices




declare -r
app_mainclass="play.core.server.ProdServerStart"

JAVA_OPTS="$JAVA_OPTS
-agentpath:/usr/local/Dynatrace/dynatrace-6.2/agent/lib64/libdtagent.so=name=SL_WDC_PS_PERF_ATOMIC_N1,server=10.149.96.107:9999"


declare -r
script_conf_file="${app_home}/../conf/application.ini"

Thanks again for your help.

Dan