0

I need to change my properties based on environment passed as argument to tomEE 6 server.

I have the following code:

String envProperties = System.getProperty("envProperties");
System.out.println("environment properties: "+envProperties);

This gets the property value that is set the first time. When I change the property to something different than the previous one, it doesnt detect the change. how do i get it to pick up any change being passed.

The way I am passing properties right now is by going into server run time configuration in eclipse and passing it

-DenvProperties="dev"

i tried following the post Passing JVM arguments to Tomcat when running as a service?, but i cant find anything matching Tomcat5w or ending with 5w. Please help

Community
  • 1
  • 1
manu
  • 77
  • 1
  • 3
  • 14

1 Answers1

0

TomEE does not look into the Eclipse run time configuration. If you need to pass variable values to the running Java EE application, you have two options:

  • pull properties periodically from a resource (file, network...)
  • push properties from the outside using HTTP requests or other supported protocols (TCP, JMS, JMX, ...)
mjn
  • 36,362
  • 28
  • 176
  • 378
  • I didnt understand when you say "pull properties periodically from a resource (file, network...)" I thought maybe I could just change the value in some file and TomEE will pick it up when i referred this link http://tomee.apache.org/system-properties-files.html. I am not sure where and how to set it though. – manu Jun 09 '16 at 18:42