Uploaded image for project: 'TomEE'
  1. TomEE
  2. TOMEE-4294

TomEE doesn't start in tomee-embedded-maven-plugin when mp-common is present

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 9.1.2
    • 10.0.0-M1, 9.1.2
    • None
    • None

    Description

      The following exception is thrown when trying to run tomee-embedded through the maven plugin when adding mp-common:

      Caused by: java.lang.NoSuchMethodError: 'void jakarta.enterprise.inject.spi.BeforeBeanDiscovery.addAnnotatedType(jakarta.enterprise.inject.spi.AnnotatedType)'
          at org.apache.bval.cdi.BValExtension.addBvalBinding (BValExtension.java:112)
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
          at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke (Method.java:568)
          at org.apache.webbeans.event.ObserverMethodImpl.invoke (ObserverMethodImpl.java:410)
          at org.apache.webbeans.event.ContainerEventObserverMethodImpl.invoke (ContainerEventObserverMethodImpl.java:86)
          at org.apache.webbeans.event.ObserverMethodImpl.notify (ObserverMethodImpl.java:371)
          at org.apache.webbeans.event.NotificationManager.invokeObserverMethod (NotificationManager.java:1146)
          at org.apache.webbeans.event.NotificationManager.doFireSync (NotificationManager.java:1009)
          at org.apache.webbeans.event.NotificationManager.doFireEvent (NotificationManager.java:952)
          at org.apache.webbeans.event.NotificationManager.fireEvent (NotificationManager.java:928)
          at org.apache.webbeans.container.BeanManagerImpl.fireEvent (BeanManagerImpl.java:495)
          at org.apache.webbeans.container.BeanManagerImpl.fireLifecycleEvent (BeanManagerImpl.java:490)
          at org.apache.webbeans.config.BeansDeployer.fireBeforeBeanDiscoveryEvent (BeansDeployer.java:805)
          at org.apache.webbeans.config.BeansDeployer.deploy (BeansDeployer.java:244)
          at org.apache.openejb.cdi.OpenEJBLifecycle.startApplication (OpenEJBLifecycle.java:196)
          at org.apache.openejb.cdi.ThreadSingletonServiceImpl.initialize (ThreadSingletonServiceImpl.java:268)
          at org.apache.openejb.cdi.CdiBuilder.build (CdiBuilder.java:43)
          at org.apache.openejb.assembler.classic.Assembler.createApplication (Assembler.java:974)
          at org.apache.openejb.assembler.classic.Assembler.createApplication (Assembler.java:762)
          at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal (TomcatWebAppBuilder.java:1340)
          at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart (TomcatWebAppBuilder.java:1162)
          at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent (GlobalListenerSupport.java:134)
          at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent (LifecycleBase.java:123)
          at org.apache.catalina.core.StandardContext.startInternal (StandardContext.java:5085)
          at org.apache.catalina.util.LifecycleBase.start (LifecycleBase.java:183)
          at org.apache.catalina.core.ContainerBase.addChildInternal (ContainerBase.java:726)
          at org.apache.catalina.core.ContainerBase.addChild (ContainerBase.java:698)
          at org.apache.catalina.core.StandardHost.addChild (StandardHost.java:747)
          at org.apache.tomee.catalina.TomcatWebAppBuilder.deployWar (TomcatWebAppBuilder.java:687)
          at org.apache.tomee.catalina.TomcatWebAppBuilder.deployWebApps (TomcatWebAppBuilder.java:616)
          at org.apache.tomee.catalina.deployment.TomcatWebappDeployer.deploy (TomcatWebappDeployer.java:47)
          at org.apache.tomee.embedded.Container.deploy (Container.java:876)
          at org.apache.openejb.maven.plugins.TomEEEmbeddedMojo.doDeploy (TomEEEmbeddedMojo.java:529)
          at org.apache.openejb.maven.plugins.TomEEEmbeddedMojo.execute (TomEEEmbeddedMojo.java:445)
          at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
          at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
          at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
          at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
          at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
          at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
          at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
          at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
          at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
          at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
          at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
          at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
          at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
          at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
          at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke (Method.java:568)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
          at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
          at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)

      Setting the containerProperty tomee.mp.scan=true causes a different stacktrace but looks to have the same root cause:

      Caused by: java.lang.NoSuchMethodError: 'void jakarta.enterprise.inject.spi.BeforeBeanDiscovery.addAnnotatedType(jakarta.enterprise.inject.spi.AnnotatedType)'
          at org.apache.tomee.microprofile.opentracing.MPOpenTracingCDIExtension.observeBeforeBeanDiscovery (MPOpenTracingCDIExtension.java:33)
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
          at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke (Method.java:568)
          at org.apache.webbeans.event.ObserverMethodImpl.invoke (ObserverMethodImpl.java:410)
          at org.apache.webbeans.event.ContainerEventObserverMethodImpl.invoke (ContainerEventObserverMethodImpl.java:86)
          at org.apache.webbeans.event.ObserverMethodImpl.notify (ObserverMethodImpl.java:371)
          at org.apache.webbeans.event.NotificationManager.invokeObserverMethod (NotificationManager.java:1146)
          at org.apache.webbeans.event.NotificationManager.doFireSync (NotificationManager.java:1009)
          at org.apache.webbeans.event.NotificationManager.doFireEvent (NotificationManager.java:952)
          at org.apache.webbeans.event.NotificationManager.fireEvent (NotificationManager.java:928)
          at org.apache.webbeans.container.BeanManagerImpl.fireEvent (BeanManagerImpl.java:495)
          at org.apache.webbeans.container.BeanManagerImpl.fireLifecycleEvent (BeanManagerImpl.java:490)
          at org.apache.webbeans.config.BeansDeployer.fireBeforeBeanDiscoveryEvent (BeansDeployer.java:805)
          at org.apache.webbeans.config.BeansDeployer.deploy (BeansDeployer.java:244)
          at org.apache.openejb.cdi.OpenEJBLifecycle.startApplication (OpenEJBLifecycle.java:196)
          at org.apache.openejb.cdi.ThreadSingletonServiceImpl.initialize (ThreadSingletonServiceImpl.java:268)
          at org.apache.openejb.cdi.CdiBuilder.build (CdiBuilder.java:43)
          at org.apache.openejb.assembler.classic.Assembler.createApplication (Assembler.java:974)
          at org.apache.openejb.assembler.classic.Assembler.createApplication (Assembler.java:762)
          at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal (TomcatWebAppBuilder.java:1340)
          at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart (TomcatWebAppBuilder.java:1162)
          at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent (GlobalListenerSupport.java:134)
          at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent (LifecycleBase.java:123)
          at org.apache.catalina.core.StandardContext.startInternal (StandardContext.java:5085)
          at org.apache.catalina.util.LifecycleBase.start (LifecycleBase.java:183)
          at org.apache.catalina.core.ContainerBase.addChildInternal (ContainerBase.java:726)
          at org.apache.catalina.core.ContainerBase.addChild (ContainerBase.java:698)
          at org.apache.catalina.core.StandardHost.addChild (StandardHost.java:747)
          at org.apache.tomee.catalina.TomcatWebAppBuilder.deployWar (TomcatWebAppBuilder.java:687)
          at org.apache.tomee.catalina.TomcatWebAppBuilder.deployWebApps (TomcatWebAppBuilder.java:616)
          at org.apache.tomee.catalina.deployment.TomcatWebappDeployer.deploy (TomcatWebappDeployer.java:47)
          at org.apache.tomee.embedded.Container.deploy (Container.java:876)
          at org.apache.openejb.maven.plugins.TomEEEmbeddedMojo.doDeploy (TomEEEmbeddedMojo.java:529)
          at org.apache.openejb.maven.plugins.TomEEEmbeddedMojo.execute (TomEEEmbeddedMojo.java:445)
          at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
          at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
          at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
          at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
          at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
          at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
          at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
          at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
          at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
          at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
          at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
          at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
          at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
          at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
          at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke (Method.java:568)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
          at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
          at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)

      System information:

      ➜ mvn --version
      Apache Maven 3.9.5 (57804ffe001d7215b5e7bcb531cf83df38f93546)
      Maven home: /home/markus/.sdkman/candidates/maven/current
      Java version: 17.0.8, vendor: Eclipse Adoptium, runtime: /home/markus/.sdkman/candidates/java/17.0.8-tem
      Default locale: en_US, platform encoding: UTF-8
      OS name: "linux", version: "6.5.0-14-generic", arch: "amd64", family: "unix 

       

      I've attached a reproducer, simply run mvn package tomee-embedded:run

      The exception isn't being thrown as soon as I remove the mp-common dependency. Starting TomEE microprofile the normal standalone way also appears to work fine.

      Attachments

        1. tomee-embedded-mp.zip
          2 kB
          Markus Jung

        Issue Links

          Activity

            People

              jgallimore Jonathan Gallimore
              markus-jung Markus Jung
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 10m
                  1h 10m