Properites file inside java jar

I'm building a jar file that gets run on a remote server, is the agent jar on that server able to recognise a properties file that sits inside a jar, or does the properties file have to sit alongside the agent jar?

Could you elaborate a bit on your setup? Are you using Spring Boot to create an executable jar? Which installation method are you using? -javaagent, attacher standalone or as dependency?

If you are using a Spring Boot application with the attacher API, it will read the src/main/resources/elasticapm.properties.

I'm using a maven install to create the jar,the jar is then run via spring, I've put my elasticapm.properties file in the maven build resources along with my other spring configs. So the properties file location is

			<directory>../../etc/properties/App</directory>
			<filtering>true</filtering>
			<includes>
				<include>**/application-app*.properties</include>
				<include>**/log4j2.xml</include>
				<include>**/elasticapm.properties</include>
			</includes>
		</resource>

Then when I run the application, I use the following command on the server

java -javaagent:path/to/elastic/agent -jar myapp.jar

Think I'm about to answer my own question. I think my issue came from being a java noob, supplying the properties file in the application jar is no good because it's not the application jar that needs expects the properties file, it's the elastic agent jar that needs the properties, so I'm assuming that I was doing it wrong, and the properties file would need to at least sit on the same server as the elastic java agent

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.