DataBase Connection setup only through the Zone.xml file

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
musiscient
Posts: 3
Joined: 09 Dec 2009, 18:34

DataBase Connection setup only through the Zone.xml file

Post by musiscient »

Windows 7
Java sun jdk 1.6.0_26
XAMPP 5.1.17
SFS2X RC1b Patched RC3
Database connector : com.mysql.jdbc.Driver with mysql-connector-java-5.1.17-bin.jar

Following the SFS2X tutorial in order to do a custom login with database, I was stucked some hours, having an Java error at each trial
of setup a database connection through the database manager from the AdminTool
I got this error :

Code: Select all

25 juil. 2011 14:41:24,269 ERROR [com.smartfoxserver.v2.controllers.ExtensionController-1] v2.controllers.ExtensionController     - 
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Exception: java.lang.IllegalArgumentException
Message: Can not set java.lang.String field com.smartfoxserver.v2.config.ZoneSettings$ExtensionSettings.name to java.util.ArrayList
Description: Error while handling client request in extension: { Ext: Admin, Type: JAVA, Lev: ZONE, { Zone: --=={{{ AdminZone }}}==-- }, {} }
Extension Cmd: zoneConfig.saveZoneConfig
+--- --- ---+
Stack Trace:
+--- --- ---+
sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source)
sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source)
sun.reflect.UnsafeObjectFieldAccessorImpl.set(Unknown Source)
java.lang.reflect.Field.set(Unknown Source)
com.smartfoxserver.v2.admin.configurator.SettingsUpdater.parseSettingData(SettingsUpdater.java:130)
com.smartfoxserver.v2.admin.configurator.SettingsUpdater.update(SettingsUpdater.java:32)
com.smartfoxserver.v2.admin.handlers.ZoneConfigModuleReqHandler.handleClientRequest(ZoneConfigModuleReqHandler.java:208)
com.smartfoxserver.v2.extensions.SFSExtension.handleClientRequest(SFSExtension.java:192)
com.smartfoxserver.v2.controllers.ExtensionController.processRequest(ExtensionController.java:137)
com.smartfoxserver.bitswarm.controllers.AbstractController.run(AbstractController.java:96)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Finally, I succeed doing the setup manually, modifying the Zone/SimpleChat.xml file like this :

Code: Select all

  <databaseManager active="true">
	<driverName>com.mysql.jdbc.Driver</driverName>
	<connectionString>jdbc:mysql://localhost:3306/sfs2x</connectionString>
	<userName>root</userName>
	<password></password>
	<testSql>SELECT COUNT(*) AS cnt FROM people</testSql>
    <maxActiveConnections>10</maxActiveConnections>
    <maxIdleConnections>10</maxIdleConnections>
    <exhaustedPoolAction>FAIL</exhaustedPoolAction>
    <blockTime>20</blockTime>
  </databaseManager>
Now, in console :


Code: Select all

  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 >> Zone: SimpleChat 
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

25 juil. 2011 14:59:22,228 DEBUG [main] v2.db.SFSDBManager     - ExecuteQuery SQL: com.mysql.jdbc.JDBC4PreparedStatement@5d04e28b: SELECT COUNT(*) AS cnt FROM people
25 juil. 2011 14:59:22,235 INFO  [main] entities.managers.SFSZoneManager     - Creating room: (default) The Lobby
25 juil. 2011 14:59:22,237 INFO  [main] v2.api.SFSApi     - Room created: [ Room: The Lobby, Id: 1, Group: default, isGame: false ]
25 juil. 2011 14:59:22,249 INFO  [main] Extensions     - {sfsTris}: SFSTris2X Extension started, rel. 1.0.5 
25 juil. 2011 14:59:22,256 DEBUG [pool-2-thread-1] entities.managers.SFSZoneManager$TrafficMeterExecutor     - Traffic Monitor update: 0.073031ms.
25 juil. 2011 14:59:22,258 DEBUG [main] Extensions     - {Admin}: Admin Extension started 
25 juil. 2011 14:59:22,259 INFO  [main] v2.api.SFSApi     - Room created: [ Room: AdminRoom, Id: 2, Group: default, isGame: false ]
25 juil. 2011 14:59:22,265 INFO  [main] v2.core.AdminToolService     - AdminTool Service started
25 juil. 2011 14:59:23,348 INFO  [main] v2.http.SFSHttpServer     - Http Server started.
25 juil. 2011 14:59:23,451 INFO  [main] smartfoxserver.v2.SmartFoxServer     - Listening Sockets: { 127.0.0.1:9933, (Tcp) } { 127.0.0.1:9933, (Udp) } { 192.168.1.52:9933, (Tcp) } { 192.168.1.52:9933, (Udp) } 
25 juil. 2011 14:59:23,455 INFO  [main] smartfoxserver.v2.SmartFoxServer     -  
...
[ 2.0.0-RC3 ] 

25 juil. 2011 14:59:23,457 INFO  [main] smartfoxserver.v2.SmartFoxServer     - SmartFoxServer 2X (2.0.0-RC3) READY!
Do I am missing something?


Many Thanks :)
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

It seems you have an invalid Extension entered in the zone xml file.
Please make sure you edit the file and clear all the fields in the <extension> section, like this:

Code: Select all

<extension>
    <name></name>
    <type>JAVA</type>
    <file></file>
    <propertiesFile></propertiesFile>
    <reloadMode>AUTO</reloadMode>
</extension>
We have been able to reproduce the issue: any modification (so not only DB) to the Zone configuration using the AdminTool caused that error.
Removing the invalid extension solved the issue.
Paolo Bax
The SmartFoxServer Team
Post Reply