glassfish icon indicating copy to clipboard operation
glassfish copied to clipboard

Application using MicroProfile Config does not deploy

Open rdebusscher opened this issue 2 years ago • 9 comments

According to this tweet, it should work (TCK passes) but application fails to deploy.

https://twitter.com/arjan_tijms/status/1577220767183314944

Environment Details

  • GlassFish Version (and build number): 7.0 M9 (and 6.2.5)
  • JDK version: JDK 11 and JDK 17
  • OS: MacOS
  • Database: None

Problem Description

Application using MicroProfile Config fails to deploy.

remote failure: Error occurred during deployment: Exception while loading the app : CDI deployment failure:WELD-001408: Unsatisfied dependencies for type String with qualifiers @Default
  at injection point [BackedAnnotatedField] @Inject private com.example.demo.config.ConfigTestController.injectedValue
  at com.example.demo.config.ConfigTestController.injectedValue(ConfigTestController.java:0)
WELD-001475: The following beans match by type, but none have matching qualifiers:
  - Producer Method [String] with qualifiers [@JaxRsParamQualifier @Any] declared as [[UnbackedAnnotatedMethod] @Produces @JaxRsParamQualifier public org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProviderServerRuntimeSpecifics$JaxRsParamProducer.getParameterValue(InjectionPoint, BeanManager)],
  - Producer Method [String] with qualifiers [@BatchProperty @Any] declared as [[UnbackedAnnotatedMethod] @Produces @Dependent @BatchProperty public com.ibm.jbatch.container.cdi.BatchProducerBean.produceStringProperty(InjectionPoint)]
. Please see server.log for more details.
Command deploy failed.

Steps to reproduce

  • unzip attached maven reproducer project
  • mvn clean package
  • ./asadmin deploy <path-to>/mpconfig-basics.war

test-mp-config.zip

Impact of Issue

rdebusscher avatar Oct 04 '22 17:10 rdebusscher

I'm sure we will take a look later, but just for clarification: for microprofile you have to use JDK17 and GlassFish7M9+. On JDK11 is microprofile support automatically excluded, because Helidon requires JDK17+. On GF6 the support wasn't implemented yet.

dmatej avatar Oct 04 '22 17:10 dmatej

The JDK17+ requirement will be very confusing as GF 7 only needs JDK 11.

And the claim "I have MicroProfile Config since some time ;)" (made here https://twitter.com/glassfish/status/1577202760734457862) is also a bit exaggerated then as the functionality it is not released yet.

rdebusscher avatar Oct 04 '22 17:10 rdebusscher

The JDK17+ requirement will be very confusing as GF 7 only needs JDK 11.

And the claim "I have MicroProfile Config since some time ;)" (made here https://twitter.com/glassfish/status/1577202760734457862) is also a bit exaggerated then as the functionality it is not released yet.

>>> https://github.com/eclipse-ee4j/glassfish#prerequisites JDK11 is at the end of it's life and most people is abandoning it as obsolete. JEE 10 is bit late, original plan of the release date was around half year back, and JEE 11 will probably use JDK17 as it's base.

If there is something broken, anyone can create a PR with the fix ;)

dmatej avatar Oct 04 '22 18:10 dmatej

And the claim "I have MicroProfile Config since some time ;)" (made here https://twitter.com/glassfish/status/1577202760734457862) is also a bit exaggerated

"Some time" is obviously an inexact measurement, but I guess it's referring to the fact it was added about 4 months ago:

https://github.com/eclipse-ee4j/glassfish/commits/master/appserver/microprofile/config

I'll leave it to everyone's own judgement whether 4 months is "some time" or not ;)

arjantijms avatar Oct 04 '22 20:10 arjantijms

JEE 11 will probably use JDK17 as it's base.

We may even do a Jakarta EE 10.1 using JDK 17 as a base.

arjantijms avatar Oct 04 '22 20:10 arjantijms

The JDK17+ requirement will be very confusing as GF 7 only needs JDK 11.

Maybe, it was mentioned in the release notes though:

  • https://github.com/eclipse-ee4j/glassfish/releases/tag/7.0.0-M8
  • https://github.com/eclipse-ee4j/glassfish/releases/tag/7.0.0-M6

i.e.

MicroProfile Config (via Helidon) doesn't require a JDK 17 specific build anymore (but does require JDK 17 at runtime, as Helidon requires JDK 17).

arjantijms avatar Oct 04 '22 20:10 arjantijms

At any length, thanks for the rapport @rdebusscher. The MP TCK passes in a controlled development environment, but we have some work to do to make this easy and workable in various environments out there.

arjantijms avatar Oct 05 '22 07:10 arjantijms

After some investigation, the issue appears to be caused by a problem in the build, which used JDK 11, and a bug in the cipher selection during the build. The existing build glassfish-7.0.0-M9.zip was created using JDK 11, and MP Config doesn't work correctly there. I added a test build glassfish-7.0.0-M9.1.zip where MP Config should work correctly (it requires JDK 17 or higher though).

@rdebusscher if you want, can you try again with that build? A 'beans.xml' is not necessary.

arjantijms avatar Oct 05 '22 20:10 arjantijms

Using https://github.com/arjantijms/test-mp-config

git clone https://github.com/arjantijms/test-mp-config.git

Cloning into 'test-mp-config'...
remote: Enumerating objects: 28, done.
remote: Counting objects: 100% (28/28), done.
remote: Compressing objects: 100% (17/17), done.
remote: Total 28 (delta 2), reused 22 (delta 0), pack-reused 0
Receiving objects: 100% (28/28), done.
Resolving deltas: 100% (2/2), done.
mvn -version

Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: /opt/homebrew/Cellar/maven/3.8.6/libexec
Java version: 17.0.2, vendor: Oracle Corporation, runtime: /Users/mytest/.sdkman/candidates/java/17.0.2-open
Default locale: en_GB, platform encoding: UTF-8
OS name: "mac os x", version: "12.4", arch: "aarch64", family: "mac"
cd test-mp-config 
mvn clean install

[INFO] Building war: /Users/mytest/test-mp-config/target/mpconfig-basics.war
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ test-mp-config ---
[INFO] Installing /Users/mytest/test-mp-config/target/mpconfig-basics.war to /Users/mytest/.m2/repository/be/rubus/atbash/demo/test-mp-config/1.0-SNAPSHOT/test-mp-config-1.0-SNAPSHOT.war
[INFO] Installing /Users/mytest/test-mp-config/pom.xml to /Users/mytest/.m2/repository/be/rubus/atbash/demo/test-mp-config/1.0-SNAPSHOT/test-mp-config-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.438 s
[INFO] Finished at: 2022-10-05T08:38:44+02:00
[INFO] ------------------------------------------------------------------------
wget https://github.com/eclipse-ee4j/glassfish/releases/download/7.0.0-M9/glassfish-7.0.0-M9.1.zip
unzip glassfish-7.0.0-M9.1.zip  
cd glassfish7/bin
./asadmin start-domain --verbose
./asadmin deploy /Users/mytest/test-mp-config/target/mpconfig-basics.war 

Application deployed with name mpconfig-basics.
Command deploy executed successfully.
curl http://localhost:8080/mpconfig-basics/data/config/injected

Config value as Injected by CDI Developer value

arjantijms avatar Oct 05 '22 21:10 arjantijms

@rdebusscher We just released M10, if you want, can you try again?

See https://github.com/eclipse-ee4j/glassfish/releases/tag/7.0.0-M10

arjantijms avatar Nov 22 '22 16:11 arjantijms

JDK17 : Success JDK11 : Failed to Deploy (as expected)

rdebusscher avatar Nov 23 '22 17:11 rdebusscher

Thanks Rudy! Highly appreciate your feedback.

arjantijms avatar Nov 24 '22 19:11 arjantijms