Java library conflict

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Post Reply
Lucas
Posts: 32
Joined: 29 Jul 2011, 08:04

Java library conflict

Post by Lucas »

I perform server-side authorisation checks via Google accounts. To do this, I use a library from Google https://developers.google.com/api-clien ... t/download
I copy it to the extensions/__lib__ directory.
When the library is running, an error occurs

Code: Select all

java.lang.NoSuchMethodError:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Exception: java.lang.NoSuchMethodError
Message: 'long com.google.common.io.ByteStreams.exhaust(java.io.InputStream)'
Description: Error handling event: { USER_LOGIN, Params: [LOGIN_IN_DATA, LOGIN_PASSWORD, SESSION, LOGIN_OUT_DATA, LOGIN_NAME, ZONE] } Listener: com.smartfoxserver.v2.entities.managers.SFSExtensionManager@66748676

This happens because the Google library uses guava-31.1-jre.jar, while SmartFoxServer itself uses guava-18.0.jar. In version 20, a new method was added to this library. How can I make the library work?
What I have already done:
1. I looked at previous versions of the Google library, which also had guava > 20.
2. I looked at the new versions of SmartFoxServer. The guava version has not changed there.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Java library conflict

Post by Lapo »

Hello,
you should be able to replace the guava jar file under SFS2X/lib/ with the latest one. SFS2X has a small dependency on a few classes that haven't been changed in a "hundred" years.

Cheers
p.s. = in SFS3 that dependency will be dropped.
Lapo
--
gotoAndPlay()
...addicted to flash games
Lucas
Posts: 32
Joined: 29 Jul 2011, 08:04

Re: Java library conflict

Post by Lucas »

Thanks. Can I do this in Overcast?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Java library conflict

Post by Lapo »

I am sorry no.
Lapo
--
gotoAndPlay()
...addicted to flash games
Lucas
Posts: 32
Joined: 29 Jul 2011, 08:04

Re: Java library conflict

Post by Lucas »

Lapo wrote:I am sorry no.

How else can the problem be solved?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Java library conflict

Post by Lapo »

If possible, avoid using the library.
In your case instead of using ByteStream just use the standard InputStream functionality from the JDK.

We'll take a note to update guava to the latest version in a future SFS2X update.
Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
Lucas
Posts: 32
Joined: 29 Jul 2011, 08:04

Re: Java library conflict

Post by Lucas »

This library is provided by Google. The option to access the source code, modify it, and compile it is quite laborious.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Java library conflict

Post by Lapo »

As a workaround we could replace the library on your behalf on your specific Overcast server.
If you plan to deploy more servers you could take a snapshot of the patched instance and use it to deploy more instances.

If you want to proceed, get in touch with us using the support@... email box with a reference to this post and the version of the library required.
Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
Lucas
Posts: 32
Joined: 29 Jul 2011, 08:04

Re: Java library conflict

Post by Lucas »

Thanks. I checking it via PHP on another server.
Post Reply