Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot deploy MicroProfile applications in GlassFish 8 #25269

Open
tnagao7 opened this issue Dec 5, 2024 · 5 comments
Open

Cannot deploy MicroProfile applications in GlassFish 8 #25269

tnagao7 opened this issue Dec 5, 2024 · 5 comments
Labels
8.0 Issues that happen only on GlassFish 8 and not in version 7

Comments

@tnagao7
Copy link
Member

tnagao7 commented Dec 5, 2024

Environment Details

  • GlassFish Version (and build number): GlassFish 8.0.0-M8
  • JDK version: OpenJDK 21.0.4
  • OS: Red Hat Enterprise Linux 8.6
  • Database: none

Problem Description

Deployment of MicroProfile applications fails due to resolution errors of MicroProfile-related OSGi bundles.

$ asadmin deploy mp-sample.war
remote failure: Error occurred during deployment: Exception while deploying the app [mp-sample] : A MultiException has 3 exceptions.  They are:
1. com.sun.enterprise.module.ResolveError: Failed to start OSGiModuleImpl:: Bundle = [org.glassfish.main.microprofile.config [222]], State = [NEW]Unable to resolve
    org.glassfish.main.microprofile.config [222]
    missing requirement
[222] 
jar = file:/opt/glassfish-8.0.0-M8/glassfish8/glassfish/modules/microprofile-config.jar
artifactId = microprofile-config
groupId = org.glassfish.main.microprofile
version = 8.0.0-M8


2. java.lang.IllegalStateException: Could not load descriptor SystemDescriptor(
	implementation=org.glassfish.microprofile.config.ConfigContainer
	name=org.glassfish.microprofile.config.ConfigContainer
	contracts={org.glassfish.microprofile.config.ConfigContainer,org.glassfish.api.container.Container}
	scope=jakarta.inject.Singleton
	qualifiers={}
	descriptorType=CLASS
	descriptorVisibility=NORMAL
	metadata=Bundle-SymbolicName={org.glassfish.main.microprofile.config},Bundle-Version={8.0.0.M8}
	rank=0
	loader=OsgiPopulatorPostProcessor.HK2Loader(OSGiModuleImpl:: Bundle = [org.glassfish.main.microprofile.config [222]], State = [NEW],2056599399)
	proxiable=null
	proxyForSameScope=null
	analysisName=null
	id=1017
	locatorId=0
	identityHashCode=1367968301
	reified=false)
3. java.lang.IllegalStateException: Unable to resolve
    org.glassfish.main.microprofile.config [222]
    missing requirement
        package = io.helidon.common.types

. Please see server.log for more details.
Command deploy failed.

Steps to reproduce

Deploy an application that uses MicroProfile.

Impact of Issue

GlassFish users cannot enjoy MicroProfile features.

Notes

Deploying an application that does not use MicroProfile but CDI also triggers related warning messages:

    [2024-12-03T19:15:41.798346+09:00] [GF 8.0.0-M8] [WARNING] [] [ServiceLoader] [tid: _ThreadID=57 _ThreadName=admin-listener(4)] [levelValue: 900] [[
      Could not load service class org.glassfish.jersey.microprofile.restclient.RestClientExtension]]
    
    [2024-12-03T19:15:41.923805+09:00] [GF 8.0.0-M8] [WARNING] [] [ServiceLoader] [tid: _ThreadID=57 _ThreadName=admin-listener(4)] [levelValue: 900] [[
      Could not load service class io.helidon.microprofile.config.ConfigCdiExtension]]
@tnagao7
Copy link
Member Author

tnagao7 commented Dec 5, 2024

If the debugging mode is enabled (asadmin start-domain --debug), the following error message can be obtained at first:

    [2024-12-04T11:50:58.088866+09:00] [GF 8.0.0-M8] [SEVERE] [] [jakarta.enterprise.system.core] [tid: _ThreadID=57 _ThreadName=admin-listener(2)] [levelValue: 1000] [[
      
    Failed loading class org.glassfish.jersey.microprofile.restclient.RequestHeaderAutoDiscoverable by API Class Loader
    
    Unable to resolve
        org.glassfish.jersey.ext.microprofile.jersey-mp-rest-client [192]
        missing requirement
            &(package = org.eclipse.microprofile.rest.client.annotation) (version >= 1.1.0) (!(version >= 2.0.0))
            caused by:
                Unable to resolve
                    org.eclipse.microprofile.rest.client [227]
                    missing requirement
                        &(package = jakarta.annotation) (version >= 2.0.0) (!(version >= 3.0.0)))]
    
    ]]

The above message implies version mismatch of Jakarta Annotation.

  • GlassFish 8.0.0-M8 distribution contains Jakarta Annotation API 3.0 (Jakarta EE 11).
  • MicroProfile Rest Client API included in GlassFish 8.0.0-M8 requires Jakarta Annotation API 2.x (Jakarta EE 10).

Is it possible to coexist Jakarta Annotation API 2.x and 3.x?
If not, this problem might not be resolved until MicroProfile APIs align with Jakarta EE 11...

@OndroMih OndroMih added the 8.0 Issues that happen only on GlassFish 8 and not in version 7 label Dec 6, 2024
@OndroMih
Copy link
Contributor

OndroMih commented Dec 6, 2024

As the only thing changed in the Annotations API was removing ManagedBean annotation and MicroProfile doesn't use this annotation, it should be fine to relax the OSGi version and accept also 3.0.0 version in Rest Client.

This could be done either in the Jersey project directly, or GlassFish could repackage the Jersey dependency and modify the OSGi manifest.

@hantsy
Copy link

hantsy commented Dec 26, 2024

Got a similar issue when I was trying to use MP Config. Glassfish 8.0.0 M9 announced it supports MP Config and MP JWT auth(not tried yet).

See: #25298

@JamalYounes
Copy link

Please can support with video tutorials because we some problems as above?

And doesn't we have any video tutorials explain micro profile with glassfish

@OndroMih
Copy link
Contributor

Hi, @JamalYounes, the problems described above are only with GlassFish 8, which is still a work in progress.

if you want some video tutorials, training, or help with fixing your issues, please contact us at https://omnifish.ee/contact-us/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.0 Issues that happen only on GlassFish 8 and not in version 7
Projects
None yet
Development

No branches or pull requests

4 participants