OpenLiberty / ci.maven

Maven plugins for managing Liberty profile servers #devops
Apache License 2.0
127 stars 90 forks source link

FeatureModifiedException occurring often with multi-module project #1497

Closed TrevCraw closed 2 years ago

TrevCraw commented 2 years ago

Using https://github.ibm.com/was-svt/acme-ee Most attempts to generate features result in two calls to the binary scanner and a FeatureModifiedException. This especially does not make sense for the initial call to the binary scanner as there are no current features passed to the binary scanner. And on calls made afterwards, the current features were all determined by binary scanner from the initial call. Below is some debug output from running mvn liberty:dev (including changes from https://github.com/OpenLiberty/ci.common/pull/361 - also confirmed this error occurs without these changes)

Initial generate features on startup

[DEBUG] Calling binary-app-scanner-22.0.0.2-SNAPSHOT.jar with the following inputs...
  binaryInputs: [C:\Projects\acme-ee-main\AcmeAnnuityJAXRSWSes_jaxrs11_m2\target\classes, C:\Projects\acme-ee-main\AcmeCommon\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityJAXRSWSes_jaxrs11_m1\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityCommon\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityJAXRSWSes_jaxrs20\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityJAXRSCommon\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityPojoWSes\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityWeb\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityEJB3JAXWS\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityEJB3JAXWS_CDI\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityEJB3MDB\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityEJB3\target\classes]
  targetJavaEE: ee7
  targetMicroP: null
  currentFeatures: []
  logLocation: C:\Projects\acme-ee-main\AcmeWebEjbEar\target
  logLevel: *=FINE
  locale: en_CA
[DEBUG] Recalling binary scanner with the following inputs...
  binaryInputs: [C:\Projects\acme-ee-main\AcmeAnnuityJAXRSWSes_jaxrs11_m2\target\classes, C:\Projects\acme-ee-main\AcmeCommon\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityJAXRSWSes_jaxrs11_m1\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityCommon\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityJAXRSWSes_jaxrs20\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityJAXRSCommon\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityPojoWSes\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityWeb\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityEJB3JAXWS\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityEJB3JAXWS_CDI\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityEJB3MDB\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityEJB3\target\classes]
  targetJavaEE: ee7
  targetMicroP: null
  currentFeatures: []
  logLocation: C:\Projects\acme-ee-main\AcmeWebEjbEar\target
  logLevel: *=FINE
  locale: en_CA
[DEBUG] FeatureModifiedException, modifiedSet containsAll userFeatures, pass modifiedSet on to generateFeatures
[DEBUG] User defined features:[]
[DEBUG] Features detected by binary scanner which are not in server.xml[ejbLite-3.2, servlet-3.1, beanValidation-1.1, jndi-1.0, jaxws-2.2, jms-2.0, samlWeb-2.0, appSecurity-2.0, jaxrs-2.0, socialLogin-1.0, ejbRemote-3.2, jaxb-2.2, openidConnectServer-1.0, mdb-3.2, cdi-1.2, jpa-2.1]
...
...
...
[DEBUG] Created file C:\Projects\acme-ee-main\AcmeWebEjbEar\src\main\liberty\config\configDropins\overrides\generated-features.xml
[INFO] Generated the following features: [ejbLite-3.2, servlet-3.1, beanValidation-1.1, jndi-1.0, jaxws-2.2, jms-2.0, samlWeb-2.0, appSecurity-2.0, jaxrs-2.0, socialLogin-1.0, ejbRemote-3.2, jaxb-2.2, openidConnectServer-1.0, mdb-3.2, cdi-1.2, jpa-2.1]

Generate features after change to acme-ee-main\AcmeCommon\src\main\java\com\ibm\wssvt\acme\common\bean\StringConfigrable.java FeatureModifiedException did not occur in this instance

[DEBUG] Calling binary-app-scanner-22.0.0.2-SNAPSHOT.jar with the following inputs...
  binaryInputs: [C:\Projects\acme-ee-main\AcmeCommon\target\classes]
  targetJavaEE: ee7
  targetMicroP: null
  currentFeatures: [ejbLite-3.2, servlet-3.1, beanValidation-1.1, jndi-1.0, jaxws-2.2, jms-2.0, samlWeb-2.0, appSecurity-2.0, jaxrs-2.0, socialLogin-1.0, ejbRemote-3.2, jaxb-2.2, openidConnectServer-1.0, mdb-3.2, cdi-1.2, jpa-2.1]
  logLocation: C:\Projects\acme-ee-main\AcmeWebEjbEar\target
  logLevel: *=FINE
  locale: en_CA
...
...
...
[DEBUG] Parsing the server file for features and includes: config\server.xml
[DEBUG] User defined features:null
[DEBUG] Features detected by binary scanner which are not in server.xml[ejbLite-3.2, servlet-3.1, beanValidation-1.1, jndi-1.0, jaxws-2.2, jms-2.0, samlWeb-2.0, appSecurity-2.0, jaxrs-2.0, socialLogin-1.0, ejbRemote-3.2, jaxb-2.2, openidConnectServer-1.0, mdb-3.2, cdi-1.2, jpa-2.1]
[DEBUG] Xml document we'll try to update after generate features doc=io.openliberty.tools.common.plugins.config.ServerConfigXmlDocument@63e7de46 file=C:\Projects\acme-ee-main\AcmeWebEjbEar\src\main\liberty\config\server.xml
...
...
...
[DEBUG] Created file C:\Projects\acme-ee-main\AcmeWebEjbEar\src\main\liberty\config\configDropins\overrides\generated-features.xml
[INFO] Generated the following features: [ejbLite-3.2, servlet-3.1, beanValidation-1.1, jndi-1.0, jaxws-2.2, jms-2.0, samlWeb-2.0, appSecurity-2.0, jaxrs-2.0, socialLogin-1.0, ejbRemote-3.2, jaxb-2.2, openidConnectServer-1.0, mdb-3.2, cdi-1.2, jpa-2.1]

Generate features after change to acme-ee-main\AcmeAnnuityJAXRSCommon\src\main\java\com\ibm\wssvt\acme\annuity\common\business\jaxrs\MyJAXBResolver.java

[DEBUG] Calling binary-app-scanner-22.0.0.2-SNAPSHOT.jar with the following inputs...
  binaryInputs: [C:\Projects\acme-ee-main\AcmeAnnuityJAXRSCommon\target\classes]
  targetJavaEE: ee7
  targetMicroP: null
  currentFeatures: [ejbLite-3.2, servlet-3.1, beanValidation-1.1, jndi-1.0, jaxws-2.2, jms-2.0, samlWeb-2.0, appSecurity-2.0, jaxrs-2.0, socialLogin-1.0, ejbRemote-3.2, jaxb-2.2, openidConnectServer-1.0, mdb-3.2, cdi-1.2, jpa-2.1]
  logLocation: C:\Projects\acme-ee-main\AcmeWebEjbEar\target
  logLevel: *=FINE
  locale: en_CA
[DEBUG] Recalling binary scanner with the following inputs...
  binaryInputs: [C:\Projects\acme-ee-main\AcmeAnnuityJAXRSWSes_jaxrs11_m2\target\classes, C:\Projects\acme-ee-main\AcmeCommon\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityJAXRSWSes_jaxrs11_m1\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityCommon\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityJAXRSWSes_jaxrs20\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityJAXRSCommon\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityPojoWSes\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityWeb\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityEJB3JAXWS\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityEJB3JAXWS_CDI\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityEJB3MDB\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityEJB3\target\classes]
  targetJavaEE: ee7
  targetMicroP: null
  currentFeatures: []
  logLocation: C:\Projects\acme-ee-main\AcmeWebEjbEar\target
  logLevel: *=FINE
  locale: en_CA
[DEBUG] Parsing the server file for features and includes: config\server.xml
[DEBUG] FeatureModifiedException, modifiedSet containsAll userFeatures, pass modifiedSet on to generateFeatures
[DEBUG] Parsing the server file for features and includes: config\server.xml
[DEBUG] User defined features:null
[DEBUG] Features detected by binary scanner which are not in server.xml[ejbLite-3.2, servlet-3.1, beanValidation-1.1, jndi-1.0, jaxws-2.2, jms-2.0, samlWeb-2.0, appSecurity-2.0, jaxrs-2.0, socialLogin-1.0, ejbRemote-3.2, jaxb-2.2, openidConnectServer-1.0, mdb-3.2, cdi-1.2, jpa-2.1]
[DEBUG] Xml document we'll try to update after generate features doc=io.openliberty.tools.common.plugins.config.ServerConfigXmlDocument@617cafc6 file=C:\Projects\acme-ee-main\AcmeWebEjbEar\src\main\liberty\config\server.xml
...
...
...
[DEBUG] Created file C:\Projects\acme-ee-main\AcmeWebEjbEar\src\main\liberty\config\configDropins\overrides\generated-features.xml
[INFO] Generated the following features: [ejbLite-3.2, servlet-3.1, beanValidation-1.1, jndi-1.0, jaxws-2.2, jms-2.0, samlWeb-2.0, appSecurity-2.0, jaxrs-2.0, socialLogin-1.0, ejbRemote-3.2, jaxb-2.2, openidConnectServer-1.0, mdb-3.2, cdi-1.2, jpa-2.1]

Generate features after change to acme-ee-main\AcmeAnnuityJAXRSWSes_jaxrs20\src\main\java\com\ibm\wssvt\acme\annuity\business\impl\jaxrs\AnnuityMgmtSvcJAXRS.java

[DEBUG] Calling binary-app-scanner-22.0.0.2-SNAPSHOT.jar with the following inputs...
  binaryInputs: [C:\Projects\acme-ee-main\AcmeAnnuityJAXRSWSes_jaxrs20\target\classes]
  targetJavaEE: ee7
  targetMicroP: null
  currentFeatures: [ejbLite-3.2, servlet-3.1, beanValidation-1.1, jndi-1.0, jaxws-2.2, jms-2.0, samlWeb-2.0, appSecurity-2.0, jaxrs-2.0, socialLogin-1.0, ejbRemote-3.2, jaxb-2.2, openidConnectServer-1.0, mdb-3.2, cdi-1.2, jpa-2.1]
  logLocation: C:\Projects\acme-ee-main\AcmeWebEjbEar\target
  logLevel: *=FINE
  locale: en_CA
[DEBUG] Recalling binary scanner with the following inputs...
  binaryInputs: [C:\Projects\acme-ee-main\AcmeAnnuityJAXRSWSes_jaxrs11_m2\target\classes, C:\Projects\acme-ee-main\AcmeCommon\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityJAXRSWSes_jaxrs11_m1\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityCommon\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityJAXRSWSes_jaxrs20\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityJAXRSCommon\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityPojoWSes\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityWeb\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityEJB3JAXWS\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityEJB3JAXWS_CDI\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityEJB3MDB\target\classes, C:\Projects\acme-ee-main\AcmeAnnuityEJB3\target\classes]
  targetJavaEE: ee7
  targetMicroP: null
  currentFeatures: []
  logLocation: C:\Projects\acme-ee-main\AcmeWebEjbEar\target
  logLevel: *=FINE
  locale: en_CA
[DEBUG] Parsing the server file for features and includes: config\server.xml
[DEBUG] FeatureModifiedException, modifiedSet containsAll userFeatures, pass modifiedSet on to generateFeatures
[DEBUG] Parsing the server file for features and includes: config\server.xml
[DEBUG] User defined features:null
[DEBUG] Features detected by binary scanner which are not in server.xml[ejbLite-3.2, servlet-3.1, beanValidation-1.1, jndi-1.0, jaxws-2.2, jms-2.0, samlWeb-2.0, appSecurity-2.0, jaxrs-2.0, socialLogin-1.0, ejbRemote-3.2, jaxb-2.2, openidConnectServer-1.0, mdb-3.2, cdi-1.2, jpa-2.1]
[DEBUG] Xml document we'll try to update after generate features doc=io.openliberty.tools.common.plugins.config.ServerConfigXmlDocument@ba05f301 file=C:\Projects\acme-ee-main\AcmeWebEjbEar\src\main\liberty\config\server.xml
...
...
...
[DEBUG] Created file C:\Projects\acme-ee-main\AcmeWebEjbEar\src\main\liberty\config\configDropins\overrides\generated-features.xml
[INFO] Generated the following features: [ejbLite-3.2, servlet-3.1, beanValidation-1.1, jndi-1.0, jaxws-2.2, jms-2.0, samlWeb-2.0, appSecurity-2.0, jaxrs-2.0, socialLogin-1.0, ejbRemote-3.2, jaxb-2.2, openidConnectServer-1.0, mdb-3.2, cdi-1.2, jpa-2.1]

Full debug output: debugOutput.txt

kathrynkodama commented 2 years ago

After further investigation, we do not need to call the binary scanner twice in the cases where we are already optimizing and we are not passing any user specified features. This is covered with https://github.com/OpenLiberty/ci.common/pull/362.

Then the binary scanner is returning a FeatureModifiedException because the app is using conflicting features:

FeatureModifiedException: com.ibm.websphere.binary.cmdline.exceptions.RequiredFeatureModifiedException: 
CWMIG12127W: The jpa-2.0 features are required by the application but conflicts with other features. The features were 
replaced with a different version to create a valid feature list. The application might need updates to run with the generated
 feature list.

Modified list returned from the binary scanner: [ejbLite-3.2, servlet-3.1, beanValidation-1.1, jndi-1.0, jaxws-2.2, jms-2.0, samlWeb-2.0, appSecurity-2.0, jaxrs-2.0, socialLogin-1.0, ejbRemote-3.2, jaxb-2.2, openidConnectServer-1.0, mdb-3.2, cdi-1.2, jpa-2.1]

Then, should we be still generating the feature list (using the modified list returned from the binary scanner) and displaying a warning to users that we detected jpa-2.0 in their application but had to modify it to jpa-2.1. Or should we be displaying an error with the above message?

The current behaviour is to generate the modified feature list and no warning or error is displayed to users.

TrevCraw commented 2 years ago

Let's go with generating the modified feature list and displaying the warning. This is the case where user specified features have not been modified.