0

I've got two apps deployed to a jboss7 server, a springboot oauth app (app1) and an api app (app2) that uses the token it generates. Both apps deploy and run fine, however when I deploy app2 and app1 is already running, app1 will fail to instantiate the jwk controller.

Re-deploying app1 fixes the issue. But deploying app2 consistently breaks app1 with the same error.

Is there additional config needed when deploying a spring oauth app to jboss?

https://www.baeldung.com/spring-security-oauth2-jws-jwk

Error

Caused by: java.lang.RuntimeException: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jwkSetController': Unsatisfied dependency expressed through field 'jwkSet'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jwkSet' defined in class path resource [oauth/config/OAuth2Conf.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.nimbusds.jose.jwk.JWKSet]: Factory method 'jwkSet' threw exception; nested exception is java.lang.NullPointerException

Code

@Bean
  public JWKSet jwkSet() {
    RSAKey.Builder builder = new RSAKey.Builder((RSAPublicKey) keyPair().getPublic())
            .keyUse(KeyUse.SIGNATURE)
            .algorithm(JWSAlgorithm.RS256)
            .keyID(JWK_KID);
    return new JWKSet(builder.build());
  }
PT_C
  • 1,178
  • 5
  • 24
  • 57

1 Answers1

0

I was deploying 2 apps with 2 different Spring profiles (dev vs development) which was breaking each app and preventing them from being deployed together.

TLDR: Active Spring Profiles should match across apps

app1

./system-property=spring.profiles.active:add(value="development")

app2

./system-property=spring.profiles.active:add(value="development")

PT_C
  • 1,178
  • 5
  • 24
  • 57