2

I'm trying to use Google guava with Application Server 4.1.0, but I'm running into conflicts. I'm including the guava jar in the .aar file that uses it, but I get an error saying that com.google.common.collect.ImmutableList does not have a method called copyOf. After looking around, WSO2 has a jar in the repository/components/plugins directory called google-collect-1.0.0.wso2v2.jar. This jar contains com.google.common.collect.ImmutableList, but does not have the copyOf method. It looks like jars from the plugin directory get loaded before jars in the .aar when I try to access the service.

What would need to be done so that WSO2 uses the jar included in the .aar file instead of the jar in the plugins folder?

Christoffer Lette
  • 14,346
  • 7
  • 50
  • 58
Kawoold
  • 21
  • 1
  • Possibly related: http://stackoverflow.com/questions/3126330/no-such-method-error-immutablelist-copyof – Etienne Neveu Oct 31 '11 at 20:55
  • That looks like it's the same problem. I know where google-collect is making it into the classpath, but I can't replace it with guava because it's declared in the manifest for WO2 AS's OSGi bundle. – Kawoold Nov 01 '11 at 14:25

1 Answers1

1

Did you try, enabling the ChildFirstClassLoading in your axis2, .aar file. If you haven't you can enable it in service level by putting the parameter,

<parameter name="EnableChildFirstClassLoading">true</parameter>

in your .aar, services.xml file.

Can you please try this and get back with the result ?

Cheers.

  • I tried enabling ChildFirstClassLoading, but WSAS would fail to start up afterwards due to a problem creating the JAXBContext we were using in other parts of the project. – Kawoold Nov 02 '11 at 15:57
  • Ok, so thats not a solution for you then. One option is to replace the google-collect jar with guava jar. I think they have already done this in the trunk version of wso2 AS. see [link] (http://wso2.markmail.org/search/?q=Trunk+build+failure+in+org.wso2.carbon.identity.oauth.server.feature#query:Trunk%20build%20failure%20in%20org.wso2.carbon.identity.oauth.server.feature+page:1+mid:rowykqjpgacrkytu+state:results) – Pradeep Fernando Nov 04 '11 at 17:25