Setting JVM Variable on WAS 8.5 - jvm

I have to set a JVM Variable on WAS 8.5 and then access that variable for configuration purposes in a Web Application.
I followed the IBM docs and I went to
Servers > Application Servers > server1 > process definitions > jvm
I added the new parameter in the Generics JVM arguments -dmyPath=c:\config
But when I try to access the value doing System.getProperty("myPath") it always returns me a null value. Have you got any clues about that?

Related

How to set Tomcat.runtime.environment.version as PROD on the web server?

I want to set Tomcat environment variable as PROD. I tried by putting
set "ENVIRONMENT=PROD"
set JAVA_OPTS="-Dtomcat.runtime.environment.version=PROD"
in catalina.bat
and tried to retrieve it with
env = System.getProperty("tomcat.runtime.environment.version");
but every time env is null! Where exactly does the variable have to be declared in catalina.bat and what's the perfect syntax to set the environment variable? Other possible ways to declare variables are also welcome!
Since you are on Windows and in production, I'm going to assume that you are using a Microsoft Windows Service for Tomcat. If that's the case, the .bat files are completely ignored when launching and stopping Tomcat. There is a service binary that reads the configuration from the Windows Registry and no disk-based scripts are used at all.
If you run the program called tomcatXw.exe (where X is your Tomcat major version number), that will run the configuration GUI. From there, you can configure everything stored in the Registry.
Go to the "System Properties" tab and add your system property -Dtomcat.runtime.environment.version=PROD to the list of properties already found in there. Restart your service and you should be able to see the new system property available to your application (actually the whole JVM, of course).

How to deploy an atg project in weblogic?

I created a simple project using ATG 10.2 .I want to know how to deploy it in weblogic. Please provide detailed procedure with screenshots,if possible.
To provide a 'detailed' procedure is beyond the scope of what StackOverflow is trying to provide. That said, if you have an understanding of the Weblogic Management Console you should be able to follow these steps to setup your initial deployment:
Create a Server
1.1 Specify a server name (eg. commerce) and the port number this server will run on (eg. 8180). Select it as a 'Stand-alone server'.
1.2 Once created go to Configuration > Server Start for the newly created server and modify the 'Arguments' block and include the following setings (assuming you are running windows, for Unix update your own paths)
-Datg.dynamo.data-dir=c:\ATG-Data -Datg.dynamo.server.name=commerce -d64 -XX:ParallelGCThreads=8 -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Xms1152m -Xmx2048m -XX:NewSize=128m -XX:MaxNewSize=256m -XX:PermSize=128m -XX:MaxPermSize=256m
1.3 Save your Server
Create DataSources
2.1 In the Console click on 'Services > Data Sources'
2.2 Create 'New' datasources for each of your connections. As a minimum you will need connections for ATGSwitchingDS_A, ATGSwitchingDS_B (Assuming you are doing switching datasources) and ATGProductionDS. These names should match your JNDI names in your property files. Remember to specify the 'commerce' server as the target for each of the datasources.
Create Deployment
3.1 Assuming you've already built your EAR (eg. ATGProduction.ear) and it is available in c:\deployments you need to create a deployment in Weblogic. You need to create the deployment in the console and specify the target as 'commerce'. Once done you need to also 'start serving requests' on the deployment.
Start Server
You should now be able to see your server running on port 8180 with the log files being written to c:\ATG-Data\servers\commerce\logs.
If after this things aren't running, post specific questions about your issues and someone here might be able to help you.

TeamCity how to set JVM Arguments

my teamcity build server has following JVM Arguments:
-Xmx512m -XX:MaxPermSize=270m
sometimes it shows some memory problem message like "TeamCity server memory usage for PS Old Gen pool exceeded 91% of 341 MB maximum available. 437 MB used of 506 MB total heap available. See the TeamCity documentation for possible solutions."
i read here https://confluence.jetbrains.com/display/TCD8/Installing+and+Configuring+the+TeamCity+Server#InstallingandConfiguringtheTeamCityServer-SettingUpMemorysettingsforTeamCityServer that the minimum recommended settings are: -Xmx750m -XX:MaxPermSize=270m.
how/where do i change this setting?
In TC9+ it is possible to set this variable in TC Server GUI:
Administration -> Diagnostics -> Internal Properties -> Edit internal properties
For 64-bit JVM the recommended setting is:
TEAMCITY_SERVER_MEM_OPTS=-Xmx4g -XX:MaxPermSize=270m -XX:ReservedCodeCacheSize=350m
Just add this line to the Internal properties edit box
I would recommend adding the JVM memory options in the startup script (start.sh) for server based startup using the variable TEAMCITY_SERVER_MEM_OPTS . Please do not set it in the profile of the userid that runs teamcity.
This link should be helpful to you.
In case you want different memory settings for server and agent(usually that's the case), please be selective in naming the variables so that there is a difference in identifying the JVM options for server and agent startup.
As a rule of thumb for teamcity setups, I normally let my teamcity server have 20% more memory than my avg usage to account for any increased load during peak usage periods.
Internal properties are read after the JVM is started and so the heap settings will not take effect if put where another answer suggests. I was looking into how to do this for a TeamCity container and the best option seems to be to use environment variables (TEAMCITY_SERVER_MEM_OPTS). For a container, those can be set by passing -e TEAMCITY_SERVER_MEM_OPTS='...' when creating the container.

ActiveMQ linux service not accepting --extdir in Application parameters

I'm tweaking the wrapper.conf in ActiveMQ so that the service will add an extdir of our camel jars.
In the windows wrapper I was able to change the Application parameters so that it added the extdir to the startup
# Application parameters. Add parameters as needed starting from 1
wrapper.app.parameter.1=org.apache.activemq.console.Main
wrapper.app.parameter.2=--extdir "..\..\lib\companyname"
wrapper.app.parameter.3=start
This successfully loads the lib folder at startup on windows machines.
However when I change the linux wrapper.conf to match this it fails and the log shows:
INFO | jvm 1 | 2013/11/12 06:51:05 | INFO: Unrecognized option: --extdir "..\..\lib\companyname"
INFO | jvm 1 | 2013/11/12 06:51:05 | Usage: Main [--extdir <dir>] [task] [task-options] [task data]
These tweaks are planned to be chefinised so having the service working is a requirement.
This problem was caused by a difference in how the windows and linux JVM handle parameters.
Looking into the service wrapper helped me to figure this out.
http://wrapper.tanukisoftware.com/doc/english/prop-app-parameter-n.html
The solution was to split the --extdir and directory path into separate parameters like so:
# Application parameters. Add parameters as needed starting from 1
wrapper.app.parameter.1=org.apache.activemq.console.Main
wrapper.app.parameter.2=--extdir
wrapper.app.parameter.3=/opt/apache-activemq-5.8.0/lib/companyname
wrapper.app.parameter.4=start

How to add environment variables to Tomcat 7 GUI service for windows

We've successfully setup tomcat 7 for windows and jruby but now we need to set an environment variables(RAILS_ENV and some other variable) before starting Tomcat.
We start Tomcat using the GUI on the lower right, and I was wondering how to add the variables in that gui. As usual windows isn't helpful enough with the vague terms for startup like:
class, method, arguments(has the value "start"), timeout and mode(has value "jvm")
So where do I add my environment variable here? I am guessing in arguments separated by a space? Or something else?
On Windows you can add environment variables under
Control Panel -> System -> Advanced -> Environment variables (the button at the bottom)
Then you can add a variable like JRUBY_OPTS with value --1.9