Using Scala?

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

Moderators: Lapo, Bax

jrimmer
Posts: 23
Joined: 03 Oct 2010, 16:44

Using Scala?

Postby jrimmer » 22 Nov 2011, 02:28

I'm using Scala to write an extension using v2.9.1.

I then tried to use Akka v1.2 Actors - akka.io - to manage various aspects of the extension, copying the jar into the extensions/__lib__/ folder. Coding and local testing went great but testing in SFS v2.0.0-RC3 yielded:

21 Nov 2011 21:21:51,456 WARN [com.smartfoxserver.v2.controllers.ExtensionController-1] v2.cont
rollers.ExtensionController -
java.lang.NoClassDefFoundError: scala/Serializable

I copied the scala-library.jar that came with the Akka distribution into the same __lib__ directory which caused the server to crash outright when handling a request. Upon looking into the /lib directory I see that there's already a scala-library.jar in there. After searching around here I see that you're already using Scala for some aspects of SFS. Would it be possible for you to move to v2.9.1 or can I copy the appropriate jar in? Or is the answer to include scala-lang.jar in my extension's jar?

Thanks for your assistance.
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 22 Nov 2011, 22:15

One of the main problems with Scala is that it is super sensitive to version changes. It's known that as soon as you change version very easily other libraries will break :( With Akka it's a know problem, for instance.

If you add your own scala-lib.jar you will create a conflict with the already existing scala-lib that SFS2X uses (I believe it is 2.8.0)

Coding and local testing went great but testing in SFS v2.0.0-RC3 yielded:

This is not clear to me... what version of SFS2X was used for local testing?
Lapo
--
gotoAndPlay()
...addicted to flash games
jrimmer
Posts: 23
Joined: 03 Oct 2010, 16:44

Postby jrimmer » 23 Nov 2011, 03:09

Lapo wrote:This is not clear to me... what version of SFS2X was used for local testing?

Poor wording on my part. I was testing locally via unit tests and it worked well. The only testing done with SFS was on the server.

So... any interest in updating your Scala usage to v2.9.1? If not, how extensively are you using it in SFS? Perhaps I can try just replacing the version in lib with that from v2.9.1.
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 23 Nov 2011, 09:35

Yes, we'll eventually update to 2.9.x but it's not a priority right now, especially if it breaks the code again. I say "again"... because we initially worked on some Scala code with version 2.7.5, then moved to 2.8.x and the code had to be refactored.

The only thing I can suggest is recompiling Akka for 2.8 or finding a pre-compiled version for 2.8
Lapo

--

gotoAndPlay()

...addicted to flash games
jrimmer
Posts: 23
Joined: 03 Oct 2010, 16:44

Postby jrimmer » 23 Nov 2011, 15:37

Lapo wrote:I say "again"... because we initially worked on some Scala code with version 2.7.5, then moved to 2.8.x and the code had to be refactored.

I can certainly sympathize as Scala version transitions are often tough tasks. While I agree the v2.8.x transition was particularly painful the v2.9.x transition should be far less so. I was pleasantly surprised by the minimal amount of effort required.

Lapo wrote:The only thing I can suggest is recompiling Akka for 2.8 or finding a pre-compiled version for 2.8

Yeah, I was worried that was the primary option. Unfortunately, it's not likely to be possible. For now I'll revert to native Actors and the like and eagerly await your transition to v2.9.1.

Thanks for your help.
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 23 Nov 2011, 23:23

It seems that Akka will be part of the Scala lib sooner or later, is there a timeline for that? Or am I wrong?
Lapo

--

gotoAndPlay()

...addicted to flash games
jrimmer
Posts: 23
Joined: 03 Oct 2010, 16:44

Postby jrimmer » 24 Nov 2011, 02:48

Lapo wrote:It seems that Akka will be part of the Scala lib sooner or later, is there a timeline for that? Or am I wrong?

I believe only the Akka Actor implementation is to be part of an upcoming Scala release. I presume that's part of the reason they're available outside of the core Akka distribution with no Akka dependencies.
grhwood
Posts: 116
Joined: 15 Mar 2011, 04:43

Postby grhwood » 16 Dec 2011, 16:54

I vote for the transition to scala 2.9.1 too.
jrimmer
Posts: 23
Joined: 03 Oct 2010, 16:44

Postby jrimmer » 12 Jan 2012, 21:28

I'm rather hoping that the upcoming RC/Final is using Scala v2.9.1 but if that's not possible can it at least be upgraded to v2.8.1? As it's now 2.8.0-based that should be a straightforward upgrade.
tchen
Posts: 191
Joined: 11 Dec 2010, 14:14

Postby tchen » 15 Jan 2012, 21:40

I might be odd, but I'd like to make the counter request that you don't change scala major versions mid-stream. We're running 2.8.1 here now, as is a vast majority of the scala ecosystem that's currently in production.

I know 2.9.x is new and all things being equal, I would prefer to use it too, but its barely six months out and not everyone is caught up, sad to say.
jrimmer
Posts: 23
Joined: 03 Oct 2010, 16:44

Postby jrimmer » 16 Jan 2012, 02:27

tchen wrote:I might be odd, but I'd like to make the counter request that you don't change scala major versions mid-stream. We're running 2.8.1 here now, as is a vast majority of the scala ecosystem that's currently in production.

We're actually on the same page. I suggested as a fallback that a v2.8.1 upgrade would still be appreciated. According to [1] v2.8.0 is in the SFS v2 release since RC1 and v2.8.1 contains a multitude of fixes.

While v2.9.x would be ideal v2.8.1 would be wonderful all the same.

Lapo?

[1] viewtopic.php?t=9117
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 16 Jan 2012, 09:38

If possible we'll move to version 2.9.1
The release is expected in 2-3 weeks.

Ciao
Lapo

--

gotoAndPlay()

...addicted to flash games
jrimmer
Posts: 23
Joined: 03 Oct 2010, 16:44

Postby jrimmer » 16 Jan 2012, 14:12

Lapo wrote:If possible we'll move to version 2.9.1
The release is expected in 2-3 weeks.

Thanks for the prompt jump-in, Lapo. I/we appreciate your willingness to move forward with Scala and look forward to the results of your testing and the ultimate release.
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 16 Jan 2012, 14:31

Did you try to simply replace the SFS2X/lib/scala-lib.jar file with the one provided in the Scala 2.9.1 distribution?
I did a quick test under a clean installation of SFS2X RC3 (under WinXP) and the server booted correctly.
If you haven't tried I'd suggest to do so, you should then be able to deploy your code.
Lapo

--

gotoAndPlay()

...addicted to flash games
jrimmer
Posts: 23
Joined: 03 Oct 2010, 16:44

Postby jrimmer » 16 Jan 2012, 14:58

I'll try that now that you have but it's certainly not something I would've done alone. Seeing the server boot would've been interesting but certainly wouldn't have told me everything about whether the server started, let alone continue to operate, successfully.

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 47 guests