Main class in Extension is empty

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

Moderators: Lapo, Bax

User avatar
clifflin
Posts: 5
Joined: 05 Feb 2021, 05:56

Main class in Extension is empty

Postby clifflin » 05 Feb 2021, 06:17

Hi there,
Server version is 2.17.
i'm try to use a old project with java ChatExtension.jar, but the main class drop down box is empty on zone extension tab.
then i open the Chrome console and it show that error massage "sfs2x-api-1.7.15.js:6 Uncaught SFSTypeError: Requested value is not of type SFSDataType.UTF_STRING". :(
Whats the problem?
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Main class in Extension is empty

Postby Lapo » 05 Feb 2021, 07:32

Hi,
what is the name of the class that should appear in the drop down? (in other words what is the name of your Extension class)

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
clifflin
Posts: 5
Joined: 05 Feb 2021, 05:56

Re: Main class in Extension is empty

Postby clifflin » 05 Feb 2021, 07:34

its called "InitialExtension"
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Main class in Extension is empty

Postby Lapo » 05 Feb 2021, 07:54

Hi,
seems strange. We would need to see the actual jar file.
Can you send it to our support@... email box? Please zip it before sending as sometimes .jar files are seen as "executables" by mail filters and discarded as potential viruses.

Also put a reference to this discussion in the mail.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
clifflin
Posts: 5
Joined: 05 Feb 2021, 05:56

Re: Main class in Extension is empty

Postby clifflin » 05 Feb 2021, 09:15

its weird,
when i use the standalone version admin tool,the Extension main class drop down box works fine
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Main class in Extension is empty

Postby Lapo » 05 Feb 2021, 10:52

What OS are your running?
and how exactly do you run the server when you can't find the Extension via the AdminTool?

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
clifflin
Posts: 5
Joined: 05 Feb 2021, 05:56

Re: Main class in Extension is empty

Postby clifflin » 05 Feb 2021, 11:00

my OS is Win10,
and running the server via the Chat.zone.xml stored in the project folder
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Main class in Extension is empty

Postby Lapo » 05 Feb 2021, 12:18

Sorry but this isn't clear yet. :)
You said:
when i use the standalone version admin tool, the Extension main class drop down box works fine

What do you mean by "standalone version admin tool"?
Are you still using the old Flash-based admin tool?

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
clifflin
Posts: 5
Joined: 05 Feb 2021, 05:56

Re: Main class in Extension is empty

Postby clifflin » 08 Feb 2021, 01:37

after web admin tool had problem,i found AdminTool for Windows (standalone) on this page
and finally the main class can be used
https://www.smartfoxserver.com/download/sfs2x#p=extras
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Main class in Extension is empty

Postby Lapo » 08 Feb 2021, 08:56

Hi,
it should work just as well with the web-based AdminTool.
If you want us to investigate further send us your Extension file, as I mentioned in my reply above. ( LINK )

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
XXPX1
Posts: 5
Joined: 28 Oct 2021, 02:56

Re: Main class in Extension is empty

Postby XXPX1 » 28 Oct 2021, 03:03

I was just experiencing the same issue. Using the legacy standalone AdminTool was the solution.

Going back into the HTML5 web based admin portal and inspecting the Zone Extension setting actually resets it to blank. So, for now, I'm stuck using the old standalone AdminTool sadly.

I was running server version 2.17.0, then upgraded to 2.17.3.

Tried Brave, Firefox, Chrome, & Edge
Windows 10
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Main class in Extension is empty

Postby Lapo » 28 Oct 2021, 08:25

Hi,
we are not aware of a similar issue. I have tested setting different extensions with the HMTL AdminTool and then coming back and everything looked fine.

Can you describe all the steps to reproduce the problem in the HTML version?
Also, are you able to set the Extension the very first time? Or are you having a problem with that as well?

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
XXPX1
Posts: 5
Joined: 28 Oct 2021, 02:56

Re: Main class in Extension is empty

Postby XXPX1 » 31 Oct 2021, 18:41

Hey Lapo,

I'll host the jar file somewhere and PM you with a download.

As I said above, I was on 2.17.0 and then I upgraded again to 2.17.3.

From the AdminTool (HTML5 web tool), I go to Zone Configurator on the top, go to any zone and hit edit, then go to Zone Extension.

1. For "Name", I select the name that corresponds to my JAR file.
2. The type remains as the default "Java" (Note: I am using Kotlin but the end result is a JAR file)
3. For "Main class", there is nothing in the drop down (see screenshot)

I perform the exact same procedure on the standalone (legacy) AdminTool results in the dropdown being populated with the various class objects in the jar file. I select the appropriate one, save and everything works (see second screenshot in imgur album).

Screenshots: https://imgur.com/a/nKSYcPl
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Main class in Extension is empty

Postby Lapo » 02 Nov 2021, 10:19

Thanks, I was able to reproduce the problem. We'll investigate it and let you know.

While I am here, I also noticed the jar file you sent is packed with other libraries (almost 10K files) which is not ideal unless the Extension is going to be used exclusively at Zone level.

The reason for that is that for every copy of the Extension that is going to be loaded all those other classes will be loaded as well, bloating up the meta-space. Additionally i noticed some dependencies in the org.apache.* package that could be duplicates of other classes already present in the server class path. (e.g. commons logging and http)

The best approach would be to store in the Extension jar only the Extension classes and no other dependencies.
Next deploy all the other dependency jars directly in the extensions/__lib__/ folder which is mapped to the top level class loader.

If you want to learn more about class loading in SFS2X I'd recommend the documentation here:
http://docs2x.smartfoxserver.com/Extens ... assLoading

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
XXPX1
Posts: 5
Joined: 28 Oct 2021, 02:56

Re: Main class in Extension is empty

Postby XXPX1 » 05 Nov 2021, 07:22

Thanks Lapo for the advice.

For anyone else stumbling upon this, it appears the bloated JAR file was actually the problem with the AdminTool.

After following Lapo's advice, all my classes were appearing in the web-based AdminTool and my JAR file went from being around 10,000 KB to just 39 KB!

If you are using IntelliJ, like I am, you can do this by going to the Project Structure (Ctrl+Alt+Shift+S) and modifying your JAR under Artifacts. I found it easiest just to create a new artifact with the + button, then choosing JAR -> From Modules with Dependences. Now here is the important part, for "JAR files from libraries", choose "copy to the output directory and link via manifest".

After rebuilding the JAR file, you will be able to copy all JAR files for the libraries (found in your output directory) into the extensions/__lib__ directory.

Thanks again for the help and hopes this helps someone else down the road.

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 122 guests