NoSuchMethodError accessing wrong version of class/library..How do I check what's in the server's system classloader on ofbiz?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

NoSuchMethodError accessing wrong version of class/library..How do I check what's in the server's system classloader on ofbiz?

justin.g.robinson
I've been battling with this bug for since yesterday. I have checked
the build path and classpath and they are the same,
I've got these 2 declirations in my components <target
name="classpath"> <path id="local.class.path">
<fileset dir="${ofbiz.dir}/specialpurpose/subscriptions/lib" includes="*.jar"/>
<fileset dir="${ofbiz.dir}/specialpurpose/subscriptions/build/lib"
includes="*.jar"/>

It all seems to be in order. If I call this method from a JUnit test,
run from within eclipse, is passes no problem, if I run the server I
get this exception.

Also I have two other libraries that this component uses & I just
added it as a user library in eclipse & in the components lib
referenced in the build.xml and it works without a problem. I've tried
moving jars around resorting to trial and error when logic seemed to
fail me & no luck yet.

I've tried cleaning and rebuilding the whole web app several times
with no change.

NoSuchMethodError means that the class was found, but a referenced
method in that class is not found. The most typical cause of this is
accessing a wrong version of class/library. Since the problem only
manifests when running on the server, older integrations with the
google api's exist in the system, I suppose for a class like
com.google.common.collect.ImmutableMultimap it's quite likely that an
older version of the class exists somewhere in another library but how
do I find it, it's like looking for a needle in a hay stack

"a different version this library could wired into server's system
classloader (which would be ahead of whatever is bundled in your
webapp)." - how would I check what's in the server's system
classloader on ofbiz?


I'd like some advice about how to get closer to the problem so I can
try find the bug, how does one debug classpath issues is there
anywhere else the classpath is defened besides the build file?

Any suggestions on how to pin point the problem would be appreciated.

Exception: java.lang.NoSuchMethodError [java] Message:
com.google.common.collect.ImmutableMultimap.of()Lcom/google/common/collect/ImmutableMultimap;
[java] ---- stack trace
--------------------------------------------------------------- [java]
java.lang.NoSuchMethodError:
com.google.common.collect.ImmutableMultimap.of()Lcom/google/common/collect/ImmutableMultimap;
[java] com.google.gdata.util.common.net.UriParameterMap.<clinit>(UriParameterMap.java:78)
[java] com.google.gdata.client.Service.computeQueryMap(Service.java:2190)
[java] com.google.gdata.client.Service.access$000(Service.java:94)
[java] com.google.gdata.client.Service$ClientStreamProperties.<init>(Service.java:1839)
[java] com.google.gdata.client.Service$ClientOutputProperties.<init>(Service.java:1986)
[java] com.google.gdata.client.Service.writeRequestData(Service.java:2029)
[java] com.google.gdata.client.Service.insert(Service.java:1408)
[java] com.google.gdata.client.GoogleService.insert(GoogleService.java:599)
[java] com.google.gdata.client.appsforyourdomain.AppsForYourDomainService.insert(AppsForYourDomainService.java:100)
[java] za.co.venturenet.api.googleapps.GoogleAppsServices.createUser(GoogleAppsServices.java:437)
[java] za.co.venturenet.api.googleapps.GoogleAppsServices.createUser(GoogleAppsServices.java:336)
[java] za.co.venturenet.api.googleapps.GoogleAppsFacade.createNewVenturenetUser(GoogleAppsFacade.java:158)


--
Regards,
Justin
Venture-Net Research & Development
Reply | Threaded
Open this post in threaded view
|

Re: NoSuchMethodError accessing wrong version of class/library..How do I check what's in the server's system classloader on ofbiz?

Scott Gray-2
Hi Justin,

What jars do you have in lib?  Any sub-folders?

You could also try replacing:
<fileset dir="${ofbiz.dir}/specialpurpose/subscriptions/lib" includes="*.jar"/>
with:
<fileset dir="lib" includes="*.jar"/>

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 14/06/2011, at 8:20 PM, Justin Robinson wrote:

> I've been battling with this bug for since yesterday. I have checked
> the build path and classpath and they are the same,
> I've got these 2 declirations in my components <target
> name="classpath"> <path id="local.class.path">
> <fileset dir="${ofbiz.dir}/specialpurpose/subscriptions/lib" includes="*.jar"/>
> <fileset dir="${ofbiz.dir}/specialpurpose/subscriptions/build/lib"
> includes="*.jar"/>
>
> It all seems to be in order. If I call this method from a JUnit test,
> run from within eclipse, is passes no problem, if I run the server I
> get this exception.
>
> Also I have two other libraries that this component uses & I just
> added it as a user library in eclipse & in the components lib
> referenced in the build.xml and it works without a problem. I've tried
> moving jars around resorting to trial and error when logic seemed to
> fail me & no luck yet.
>
> I've tried cleaning and rebuilding the whole web app several times
> with no change.
>
> NoSuchMethodError means that the class was found, but a referenced
> method in that class is not found. The most typical cause of this is
> accessing a wrong version of class/library. Since the problem only
> manifests when running on the server, older integrations with the
> google api's exist in the system, I suppose for a class like
> com.google.common.collect.ImmutableMultimap it's quite likely that an
> older version of the class exists somewhere in another library but how
> do I find it, it's like looking for a needle in a hay stack
>
> "a different version this library could wired into server's system
> classloader (which would be ahead of whatever is bundled in your
> webapp)." - how would I check what's in the server's system
> classloader on ofbiz?
>
>
> I'd like some advice about how to get closer to the problem so I can
> try find the bug, how does one debug classpath issues is there
> anywhere else the classpath is defened besides the build file?
>
> Any suggestions on how to pin point the problem would be appreciated.
>
> Exception: java.lang.NoSuchMethodError [java] Message:
> com.google.common.collect.ImmutableMultimap.of()Lcom/google/common/collect/ImmutableMultimap;
> [java] ---- stack trace
> --------------------------------------------------------------- [java]
> java.lang.NoSuchMethodError:
> com.google.common.collect.ImmutableMultimap.of()Lcom/google/common/collect/ImmutableMultimap;
> [java] com.google.gdata.util.common.net.UriParameterMap.<clinit>(UriParameterMap.java:78)
> [java] com.google.gdata.client.Service.computeQueryMap(Service.java:2190)
> [java] com.google.gdata.client.Service.access$000(Service.java:94)
> [java] com.google.gdata.client.Service$ClientStreamProperties.<init>(Service.java:1839)
> [java] com.google.gdata.client.Service$ClientOutputProperties.<init>(Service.java:1986)
> [java] com.google.gdata.client.Service.writeRequestData(Service.java:2029)
> [java] com.google.gdata.client.Service.insert(Service.java:1408)
> [java] com.google.gdata.client.GoogleService.insert(GoogleService.java:599)
> [java] com.google.gdata.client.appsforyourdomain.AppsForYourDomainService.insert(AppsForYourDomainService.java:100)
> [java] za.co.venturenet.api.googleapps.GoogleAppsServices.createUser(GoogleAppsServices.java:437)
> [java] za.co.venturenet.api.googleapps.GoogleAppsServices.createUser(GoogleAppsServices.java:336)
> [java] za.co.venturenet.api.googleapps.GoogleAppsFacade.createNewVenturenetUser(GoogleAppsFacade.java:158)
>
>
> --
> Regards,
> Justin
> Venture-Net Research & Development


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: NoSuchMethodError accessing wrong version of class/library..How do I check what's in the server's system classloader on ofbiz?

justin.g.robinson
Thanks, found an obscure library that had an earlier version of the
com.google.common.* package bundled into it. I just removed it &
repacked that jar, seems to have fixed the problem.

On Tue, Jun 14, 2011 at 11:56 AM, Scott Gray <[hidden email]> wrote:

> Hi Justin,
>
> What jars do you have in lib?  Any sub-folders?
>
> You could also try replacing:
> <fileset dir="${ofbiz.dir}/specialpurpose/subscriptions/lib" includes="*.jar"/>
> with:
> <fileset dir="lib" includes="*.jar"/>
>
> Regards
> Scott
>
> HotWax Media
> http://www.hotwaxmedia.com
>
> On 14/06/2011, at 8:20 PM, Justin Robinson wrote:
>
>> I've been battling with this bug for since yesterday. I have checked
>> the build path and classpath and they are the same,
>> I've got these 2 declirations in my components <target
>> name="classpath"> <path id="local.class.path">
>> <fileset dir="${ofbiz.dir}/specialpurpose/subscriptions/lib" includes="*.jar"/>
>> <fileset dir="${ofbiz.dir}/specialpurpose/subscriptions/build/lib"
>> includes="*.jar"/>
>>
>> It all seems to be in order. If I call this method from a JUnit test,
>> run from within eclipse, is passes no problem, if I run the server I
>> get this exception.
>>
>> Also I have two other libraries that this component uses & I just
>> added it as a user library in eclipse & in the components lib
>> referenced in the build.xml and it works without a problem. I've tried
>> moving jars around resorting to trial and error when logic seemed to
>> fail me & no luck yet.
>>
>> I've tried cleaning and rebuilding the whole web app several times
>> with no change.
>>
>> NoSuchMethodError means that the class was found, but a referenced
>> method in that class is not found. The most typical cause of this is
>> accessing a wrong version of class/library. Since the problem only
>> manifests when running on the server, older integrations with the
>> google api's exist in the system, I suppose for a class like
>> com.google.common.collect.ImmutableMultimap it's quite likely that an
>> older version of the class exists somewhere in another library but how
>> do I find it, it's like looking for a needle in a hay stack
>>
>> "a different version this library could wired into server's system
>> classloader (which would be ahead of whatever is bundled in your
>> webapp)." - how would I check what's in the server's system
>> classloader on ofbiz?
>>
>>
>> I'd like some advice about how to get closer to the problem so I can
>> try find the bug, how does one debug classpath issues is there
>> anywhere else the classpath is defened besides the build file?
>>
>> Any suggestions on how to pin point the problem would be appreciated.
>>
>> Exception: java.lang.NoSuchMethodError [java] Message:
>> com.google.common.collect.ImmutableMultimap.of()Lcom/google/common/collect/ImmutableMultimap;
>> [java] ---- stack trace
>> --------------------------------------------------------------- [java]
>> java.lang.NoSuchMethodError:
>> com.google.common.collect.ImmutableMultimap.of()Lcom/google/common/collect/ImmutableMultimap;
>> [java] com.google.gdata.util.common.net.UriParameterMap.<clinit>(UriParameterMap.java:78)
>> [java] com.google.gdata.client.Service.computeQueryMap(Service.java:2190)
>> [java] com.google.gdata.client.Service.access$000(Service.java:94)
>> [java] com.google.gdata.client.Service$ClientStreamProperties.<init>(Service.java:1839)
>> [java] com.google.gdata.client.Service$ClientOutputProperties.<init>(Service.java:1986)
>> [java] com.google.gdata.client.Service.writeRequestData(Service.java:2029)
>> [java] com.google.gdata.client.Service.insert(Service.java:1408)
>> [java] com.google.gdata.client.GoogleService.insert(GoogleService.java:599)
>> [java] com.google.gdata.client.appsforyourdomain.AppsForYourDomainService.insert(AppsForYourDomainService.java:100)
>> [java] za.co.venturenet.api.googleapps.GoogleAppsServices.createUser(GoogleAppsServices.java:437)
>> [java] za.co.venturenet.api.googleapps.GoogleAppsServices.createUser(GoogleAppsServices.java:336)
>> [java] za.co.venturenet.api.googleapps.GoogleAppsFacade.createNewVenturenetUser(GoogleAppsFacade.java:158)
>>
>>
>> --
>> Regards,
>> Justin
>> Venture-Net Research & Development
>
>



--
Regards,
Justin
Venture-Net Research & Development