1

The scenario:

I have a Spring boot application with 4 maven profiles, and 5 different application.properties files (e.g. application-dev.properties) (4 for the maven profiles and 1 for the default). Test and Production Maven profiles have almost the same settings, and the differences are things like domains, texts, etc. We have 2 Weblogic servers, with the same configuration and JNDIs. One for test and one for production.

The problem:

When deploying and activating the application on the test Weblogic server (with test maven profile selected on build), the deployment and the activation of the .war are successful. The application runs fine, and everyone is happy.

When deploying and activation the application on the production Weblogic server (with the production maven profile), the deployment is fine, but when activating the .war it goes FAILED with the following error.

    weblogic.application.ModuleException: java.lang.IllegalArgumentException: Could not resolve placeholder 'xxxxxxxx' in value "${xxxxxxxx}"

        at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140)

        at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)

        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:233)

        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:228)

        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)

        Truncated. see log file for complete stacktrace

Caused By: java.lang.IllegalArgumentException: Could not resolve placeholder 'xxxxxxxx' in value "${xxxxxxxx}"

        at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:178)

        at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:124)

        at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:236)

        at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:210)

        at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0(PropertySourcesPlaceholderConfigurer.java:175)

        Truncated. see log file for complete stacktrace

At first, I thought that the problem is the production maven profile, but then I tried to deploy and activate the app with the production profile in the test Weblogic, and everything went ok.

I also tried to check setDomainEnv.sh for differences in Weblogic environment variables, but they were the same.

Any ideas?

kameshsr
  • 327
  • 3
  • 13

1 Answers1

0

Ok so for some unknown reason, in the production weblogic server, when activating the .war, weblogic tried to resolve the placeholder from the application.properties file which contained only spring.profiles.active=prod. So normally Spring should find properties in application-prod.properties (works on test weblogic server).

SOLUTION

After doing some RnD for 2 days in a row, unable to understand why this doesnt work I tried a working solution. I replaced application.properties contents (spring.profiles.active row) with the contents of application-prod.properties.

I know, the best solution would be to find why spring.profiles.active didn't worked on the production weblogic. But I wrote this post just to help other people with deadlines how to quick-fix the problem.

I hope someone more experienced than me in Spring, explains why this happens.