glassfish
  1. glassfish
  2. GLASSFISH-20802

weld fails to initialize when running with embedded-glassfish maven plugin and maven 3.1

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: embedded
    • Labels:
      None
    • Environment:

      1 ubuntu/windows
      2 jdk 7
      3 maven 3.1

      Description

      see attached maven project

      deploying with
      mvn clean package embedded-glassfish:run yields this error

      Sep 08, 2013 11:05:37 PM org.glassfish.deployment.admin.DeployCommand execute
      SEVERE: Exception while loading the app : CDI deployment failure:WELD-001524 Unable to load proxy class for bean Implicit Bean [javax.enterprise.inject.Instance] with qualifiers [@Default] with class interface javax.enterprise.inject.Instance using classloader WebappClassLoader (delegate=true; repositories=WEB-INF/classes/)
      org.jboss.weld.exceptions.WeldException: WELD-001524 Unable to load proxy class for bean Implicit Bean [javax.enterprise.inject.Instance] with qualifiers [@Default] with class interface javax.enterprise.inject.Instance using classloader WebappClassLoader (delegate=true; repositories=WEB-INF/classes/)
      at org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:306)
      at org.jboss.weld.bean.builtin.AbstractFacadeBean.initializeAfterBeanDiscovery(AbstractFacadeBean.java:60)
      at org.jboss.weld.bootstrap.BeanDeployer.doAfterBeanDiscovery(BeanDeployer.java:354)
      at org.jboss.weld.bootstrap.BeanDeployment.afterBeanDiscovery(BeanDeployment.java:280)
      at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:522)
      at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:213)
      at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)
      at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:328)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:493)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
      at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAs(Subject.java:356)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)
      at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:133)
      at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:109)
      at org.glassfish.maven.PluginUtil.doDeploy(PluginUtil.java:106)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.glassfish.maven.AbstractDeployMojo.doDeploy(AbstractDeployMojo.java:239)
      at org.glassfish.maven.RunMojo.execute(RunMojo.java:68)
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:318)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:153)
      at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:414)
      at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:357)
      Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of org/codehaus/plexus/classworlds/realm/ClassRealm) previously initiated loading for a different type with name "javax/enterprise/util/TypeLiteral"
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:792)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
      at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
      at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:386)
      at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
      at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
      at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
      at java.lang.Class.getDeclaredMethods0(Native Method)
      at java.lang.Class.privateGetDeclaredMethods(Class.java:2521)
      at java.lang.Class.privateGetPublicMethods(Class.java:2641)
      at java.lang.Class.getMethods(Class.java:1457)
      at org.jboss.weld.bean.proxy.ProxyFactory.addMethodsFromClass(ProxyFactory.java:513)
      at org.jboss.weld.bean.proxy.ProxyFactory.addMethods(ProxyFactory.java:468)
      at org.jboss.weld.bean.proxy.ProxyFactory.createProxyClass(ProxyFactory.java:402)
      at org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:299)
      ... 50 more

      Sep 08, 2013 11:05:37 PM PluginUtil doDeploy
      INFO: Deployed null

        Activity

        Hide
        domdorn added a comment -

        ok, as I can't upload any files, I created a github repo for this bug:
        https://github.com/domdorn/glassfish4_embedded_cdi_bug

        Show
        domdorn added a comment - ok, as I can't upload any files, I created a github repo for this bug: https://github.com/domdorn/glassfish4_embedded_cdi_bug
        Hide
        TangYong added a comment -

        I have tried your demo on my windows environment, however, the issue has not been re-produced.

        ...
        情報: realm.loaded.successfully
        Aug 15, 2013 4:38:27 PM com.sun.enterprise.security.auth.realm.Realm doInstantiate
        情報: realm.loaded.successfully
        Aug 15, 2013 4:38:27 PM com.sun.enterprise.security.SecurityLifecycle onInitialization
        情報: sec.service.startup.exit
        Aug 15, 2013 4:38:28 PM com.sun.enterprise.web.WebContainer createHttpListener
        情報: Created HTTP listener http-listener on host/port 0.0.0.0:8282
        Aug 15, 2013 4:38:28 PM com.sun.enterprise.web.WebContainer createHttpListener
        情報: Created HTTP listener https-listener on host/port 0.0.0.0:8383
        Aug 15, 2013 4:38:28 PM com.sun.enterprise.web.WebContainer createHosts
        情報: Created virtual server server
        Aug 15, 2013 4:38:28 PM org.apache.catalina.realm.JAASRealm setContainer
        情報: Setting JAAS app name glassfish-web
        Aug 15, 2013 4:38:28 PM com.sun.enterprise.web.WebContainer loadSystemDefaultWebModules
        情報: Virtual server server loaded default web module
        Aug 15, 2013 4:38:29 PM org.jboss.weld.bootstrap.WeldBootstrap <clinit>
        情報: WELD-000900 SNAPSHOT
        Dominik: Context started
        Aug 15, 2013 4:38:30 PM com.sun.enterprise.web.WebApplication start
        情報: Loading application [myapp] at [/javaee7demo]
        Aug 15, 2013 4:38:30 PM org.glassfish.deployment.admin.DeployCommand execute
        情報: myapp was successfully deployed in 2,875 milliseconds.
        Aug 15, 2013 4:38:30 PM PluginUtil doDeploy
        情報: Deployed myapp
        Hit ENTER to redeploy, X to exit
        ...

        Show
        TangYong added a comment - I have tried your demo on my windows environment, however, the issue has not been re-produced. ... 情報: realm.loaded.successfully Aug 15, 2013 4:38:27 PM com.sun.enterprise.security.auth.realm.Realm doInstantiate 情報: realm.loaded.successfully Aug 15, 2013 4:38:27 PM com.sun.enterprise.security.SecurityLifecycle onInitialization 情報: sec.service.startup.exit Aug 15, 2013 4:38:28 PM com.sun.enterprise.web.WebContainer createHttpListener 情報: Created HTTP listener http-listener on host/port 0.0.0.0:8282 Aug 15, 2013 4:38:28 PM com.sun.enterprise.web.WebContainer createHttpListener 情報: Created HTTP listener https-listener on host/port 0.0.0.0:8383 Aug 15, 2013 4:38:28 PM com.sun.enterprise.web.WebContainer createHosts 情報: Created virtual server server Aug 15, 2013 4:38:28 PM org.apache.catalina.realm.JAASRealm setContainer 情報: Setting JAAS app name glassfish-web Aug 15, 2013 4:38:28 PM com.sun.enterprise.web.WebContainer loadSystemDefaultWebModules 情報: Virtual server server loaded default web module Aug 15, 2013 4:38:29 PM org.jboss.weld.bootstrap.WeldBootstrap <clinit> 情報: WELD-000900 SNAPSHOT Dominik: Context started Aug 15, 2013 4:38:30 PM com.sun.enterprise.web.WebApplication start 情報: Loading application [myapp] at [/javaee7demo] Aug 15, 2013 4:38:30 PM org.glassfish.deployment.admin.DeployCommand execute 情報: myapp was successfully deployed in 2,875 milliseconds. Aug 15, 2013 4:38:30 PM PluginUtil doDeploy 情報: Deployed myapp Hit ENTER to redeploy, X to exit ...
        Hide
        domdorn added a comment -

        are you using maven 3.1 ? After a night of sleep, I think it's a problem with Plexus (a kind of CDI implementation, http://plexus.codehaus.org/) being in the classpath of maven and thus in the classpath of embedded glassfish.

        Thats my maven version:

        domdorn $ mvn -version
        Apache Maven 3.1.0 (893ca28a1da9d5f51ac03827af98bb730128f9f2; 2013-06-28 04:15:32+0200)
        Maven home: /opt/maven3/apache-maven-3.0
        Java version: 1.7.0_25, vendor: Oracle Corporation
        Java home: /usr/lib/jvm/jdk1.7.0_25/jre
        Default locale: en_US, platform encoding: UTF-8
        OS name: "linux", version: "3.2.0-51-generic", arch: "amd64", family: "unix"

        Show
        domdorn added a comment - are you using maven 3.1 ? After a night of sleep, I think it's a problem with Plexus (a kind of CDI implementation, http://plexus.codehaus.org/ ) being in the classpath of maven and thus in the classpath of embedded glassfish. Thats my maven version: domdorn $ mvn -version Apache Maven 3.1.0 (893ca28a1da9d5f51ac03827af98bb730128f9f2; 2013-06-28 04:15:32+0200) Maven home: /opt/maven3/apache-maven-3.0 Java version: 1.7.0_25, vendor: Oracle Corporation Java home: /usr/lib/jvm/jdk1.7.0_25/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "3.2.0-51-generic", arch: "amd64", family: "unix"
        Hide
        TangYong added a comment -

        Domdorn,

        Yes, the issue can be re-produced by using maven 3.1

        ...
        Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of org/codehaus/plexus/classworlds/
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:386)
        at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)
        at java.lang.Class.privateGetPublicMethods(Class.java:2562)
        at java.lang.Class.getMethods(Class.java:1427)
        at org.jboss.weld.bean.proxy.ProxyFactory.addMethodsFromClass(ProxyFactory.java:513)
        at org.jboss.weld.bean.proxy.ProxyFactory.addMethods(ProxyFactory.java:468)
        at org.jboss.weld.bean.proxy.ProxyFactory.createProxyClass(ProxyFactory.java:402)
        at org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:299)
        ... 50 more
        ...

        LinkageError is fatal in the scene, and I also noticed since maven 3.1, it has used JSR 330 which maybe cause the issue, needing to evaluate deeply. However, I must believe that the issue is not related to CDI, instead, should firstly forward to embedded comp to evaluate.

        Thanks reporting the issue.

        Tang

        Show
        TangYong added a comment - Domdorn, Yes, the issue can be re-produced by using maven 3.1 ... Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of org/codehaus/plexus/classworlds/ at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:791) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:386) at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230) at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2442) at java.lang.Class.privateGetPublicMethods(Class.java:2562) at java.lang.Class.getMethods(Class.java:1427) at org.jboss.weld.bean.proxy.ProxyFactory.addMethodsFromClass(ProxyFactory.java:513) at org.jboss.weld.bean.proxy.ProxyFactory.addMethods(ProxyFactory.java:468) at org.jboss.weld.bean.proxy.ProxyFactory.createProxyClass(ProxyFactory.java:402) at org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:299) ... 50 more ... LinkageError is fatal in the scene, and I also noticed since maven 3.1, it has used JSR 330 which maybe cause the issue, needing to evaluate deeply. However, I must believe that the issue is not related to CDI, instead, should firstly forward to embedded comp to evaluate. Thanks reporting the issue. Tang
        Hide
        domdorn added a comment -

        ok, this seems to be a maven 3.1 related problem, it works with maven 3.0.5 !
        I'll report this to the maven list.. maybe there's something in weld/glassfish we can do to prevent such problems (isolation of the classpath or something..)

        Show
        domdorn added a comment - ok, this seems to be a maven 3.1 related problem, it works with maven 3.0.5 ! I'll report this to the maven list.. maybe there's something in weld/glassfish we can do to prevent such problems (isolation of the classpath or something..)
        Hide
        TangYong added a comment -

        OK, needing to report this into Maven JIRA, and I think that we should firstly request Embedded Comp's leader to see the issue, then, based on Maven and Embedded's response, maybe will come back CDI comp.

        Tang

        Show
        TangYong added a comment - OK, needing to report this into Maven JIRA, and I think that we should firstly request Embedded Comp's leader to see the issue, then, based on Maven and Embedded's response, maybe will come back CDI comp. Tang
        Hide
        adrianmoya added a comment -

        Hi guys, I've just hitted this issue. Was any progress done to fix it?

        Thanks,

        Show
        adrianmoya added a comment - Hi guys, I've just hitted this issue. Was any progress done to fix it? Thanks,
        Hide
        krueger71 added a comment -

        I have this problem with maven 3.2.1 and the embedded-glassfish 4.0 plugin

        Show
        krueger71 added a comment - I have this problem with maven 3.2.1 and the embedded-glassfish 4.0 plugin
        Hide
        a.accioly added a comment -

        Any news on this? domdorn, can you link the respective Maven Issue so that we can upvote it?

        Show
        a.accioly added a comment - Any news on this? domdorn , can you link the respective Maven Issue so that we can upvote it?

          People

          • Assignee:
            Bhavanishankar
            Reporter:
            domdorn
          • Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated: