10 Replies Latest reply on Mar 8, 2012 11:58 AM by gboro54

    JBoss 7.1 and Guava 11.0.2

    gboro54

      I am trying to deploy an application which is utilizing guava 11.0.2. I have added the following to the meta-inf of the deployed ear but I still get the error below:

       

       

       

      jboss-deployment-structure.xml:

      {code:xml}

       

      <jboss-deployment-structure>

        <!-- Make sub deployments isolated by default, so they cannot see each others classes without a Class-Path entry -->

        <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

        <!-- This corresponds to the top level deployment. For a war this is the war's module, for an ear -->

        <!-- This is the top level ear module, which contains all the classes in the EAR's lib folder     -->

        <deployment>

          <!-- Exclusions allow you to prevent the server from automatically adding some dependencies     -->

          <exclusions>

              <module name="com.google.guava" />

          </exclusions>

        </deployment>

       

      </jboss-deployment-structure>

       

      {code}

       

      exception:

      {code}

      Caused by: java.lang.NoSuchMethodError: com.google.common.base.Objects.firstNonNull(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

                at com.google.common.cache.CacheBuilder.getKeyStrength(CacheBuilder.java:472) [guava-11.0.2.jar:]

                at com.google.common.cache.LocalCache.<init>(LocalCache.java:236) [guava-11.0.2.jar:]

                at com.google.common.cache.LocalCache$LocalManualCache.<init>(LocalCache.java:4750) [guava-11.0.2.jar:]

                at com.google.common.cache.LocalCache$LocalLoadingCache.<init>(LocalCache.java:4858) [guava-11.0.2.jar:]

                at com.google.common.cache.CacheBuilder.build(CacheBuilder.java:739) [guava-11.0.2.jar:]

                at com.nasdaq.backoffice.billing.common.rules.impl.RulesBaseBuilderImpl.init(RulesBaseBuilderImpl.java:49) [billing-common-test.jar:]

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_27]

                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.6.0_27]

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.6.0_27]

                at java.lang.reflect.Method.invoke(Unknown Source) [rt.jar:1.6.0_27]

                at org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptorFactory$ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMethodInterceptorFactory.java:130) [jboss-as-ee-7.1.0.Final.jar:7.1.0.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.weld.injection.WeldInjectionInterceptor.processInvocation(WeldInjectionInterceptor.java:73) [jboss-as-weld-7.1.0.Final.jar:7.1.0.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ee.component.ManagedReferenceInterceptorFactory$ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptorFactory.java:95) [jboss-as-ee-7.1.0.Final.jar:7.1.0.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.0.Final.jar:7.1.0.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:228) [jboss-as-ejb3-7.1.0.Final.jar:7.1.0.Final]

                ... 201 more

       

      {code}

        • 1. Re: JBoss 7.1 and Guava 11.0.2
          jaikiran

          You will have to add the exclusion to subdeployments too. See https://community.jboss.org/thread/195749?tstart=0.

          • 2. Re: JBoss 7.1 and Guava 11.0.2
            gboro54

            I am not sure I understand. Do I need to add the the xml file to each subdeployment or do I have to define the subdeployments in the roots xml file and exclude it there?

            • 3. Re: JBoss 7.1 and Guava 11.0.2
              gboro54

              I updated the xml to the following and still get the same exception. Am I missing something?

               

               

              {code:xml}

               

              <jboss-deployment-structure>

                        <!-- Make sub deployments isolated by default, so they cannot see each others

                                  classes without a Class-Path entry -->

                        <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

                        <!-- This corresponds to the top level deployment. For a war this is the

                                  war's module, for an ear -->

                        <!-- This is the top level ear module, which contains all the classes in

                                  the EAR's lib folder -->

                        <deployment>

                                  <!-- Exclusions allow you to prevent the server from automatically adding

                                            some dependencies -->

                                  <exclusions>

                                            <module name="com.google.guava" />

                                  </exclusions>

                        </deployment>

               

               

                        <sub-deployment name="common-test.jar">

                                  <exclusions>

                                            <module name="com.google.guava" />

                                  </exclusions>

                        </sub-deployment>

               

               

              </jboss-deployment-structure>

               

              {code}

              • 4. Re: JBoss 7.1 and Guava 11.0.2
                jaikiran

                What subdeployments does your .ear contain? I don't know if you added that exclusion to the correct subdeployment.

                • 5. Re: JBoss 7.1 and Guava 11.0.2
                  gboro54

                  It contains a jar and a test.war which is inserted by Arquillian.

                  • 6. Re: JBoss 7.1 and Guava 11.0.2
                    jaikiran

                    Add the exclusion to test.war subdeployment too then. But ultimately you are the better judge of which part of the code is ending up using that library and you'll have to add the exclusion to that specific subdeployment.

                    • 7. Re: JBoss 7.1 and Guava 11.0.2
                      gboro54

                      Am I putting the xml file in the wrong place? I add it to the META-INF folder of the EAR. Should it go in the root?

                      • 8. Re: JBoss 7.1 and Guava 11.0.2
                        gboro54

                        It must be something with Arquillian thing

                        • 9. Re: JBoss 7.1 and Guava 11.0.2
                          jamezp

                          FWIW a pull request (https://github.com/jbossas/jboss-as/pull/1755) got merged yesterday that updates the version in the server to 11.0.2. It should be available in 7.1.1.

                          1 of 1 people found this helpful
                          • 10. Re: JBoss 7.1 and Guava 11.0.2
                            gboro54

                            Thanks for the info! I updated my dev envrionment with the latest version