Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

PythonRPWorld.get() NoSuchMethod problem

Help
2007-11-25
2013-06-06
  • Hi, I would like to build a game in python around marauroa but I have problem with starting server.

    Server throws the following exception:

    Configuring Log4J using marauroa/server/log4j.properties
    3    WARN  marauroa.server.game.rp.RPServerManager  - ABORT: Unable to create RPZone, RPRuleProcessor or RPAIManager instances
    java.lang.NoSuchMethodException: marauroa.server.game.python.PythonRPWorld.get()
            at java.lang.Class.getDeclaredMethod(Class.java:1937)
            at marauroa.server.game.rp.RPServerManager.initializeExtensions(RPServerManager.java:159)
            at marauroa.server.game.rp.RPServerManager.<init>(RPServerManager.java:127)
            at marauroa.server.marauroad.init(marauroad.java:329)
            at marauroa.server.marauroad.run(marauroad.java:267)
    9    FATAL marauroa.server.marauroad  - Marauroa can't create RPServerManager.
    Reasons:
    - You haven't specified a valid configuration file
    - You haven't correctly filled the values related to game configuration. Use generateini application to create a valid configuration file.
    - There may be an error in the Game startup method.

    java.lang.NoSuchMethodException: marauroa.server.game.python.PythonRPWorld.get()
            at java.lang.Class.getDeclaredMethod(Class.java:1937)
            at marauroa.server.game.rp.RPServerManager.initializeExtensions(RPServerManager.java:159)
            at marauroa.server.game.rp.RPServerManager.<init>(RPServerManager.java:127)
            at marauroa.server.marauroad.init(marauroad.java:329)
            at marauroa.server.marauroad.run(marauroad.java:267)

    Here is my setup:

    $ java -version
    java version "1.6.0_03"
    Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
    Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)

    I start server with the following script:
    LOCALCLASSPATH=.:libs/marauroa-2.1.jar:libs/jython.jar:libs/mysql-connector.jar:libs/log4j.jar
    java -cp $LOCALCLASSPATH marauroa.server.marauroad -c server.ini -l

    And here is my server.ini:
    database_implementation=marauroa.server.game.db.JDBCDatabase
    factory_implementation=marauroa.server.game.rp.RPObjectFactory

    jdbc_url=jdbc:mysql://localhost/marauroa
    jdbc_class=com.mysql.jdbc.Driver
    jdbc_user=username
    jdbc_pwd=password

    tcp_port=3217

    world=marauroa.server.game.python.PythonRPWorld
    ruleprocessor=marauroa.server.game.python.PythonRPRuleProcessor
    python_script=chat.py
    python_script_ruleprocessor=ChatServer
    python_script_world=ChatServerWorld

    turn_length=500

    statistics_filename=./server_stats.xml

    n = 2373482000740579479113854006803387727980870788337946647189840724203820431546906083581391259267123437326116093041292196844984529870382593124408403359246866832009
    e = 15
    d = 2215249867357874180506263739683161879448812735782083537377184675923565736110445587068294712400194739684147416248354989773132249993194936056183438290023148182615

    chat.py contains a modified ChatServer implementation from examples on your site.
    From output I see that marauroa.server.game.rp.RPServerManager tries to call marauroa.server.game.python.PythonRPWorld.get() which should be available since it inherites from marauroa.server.game.rp.RPWorld. So I suppose problem lies somewhere in misconfiguraion in server.ini. I will be grateful for any tip.

     
    • oslsachem
      oslsachem
      2007-11-28

      >> From output I see that marauroa.server.game.rp.RPServerManager tries to call marauroa.server.game.python.PythonRPWorld.get() which should be available since it inherites from marauroa.server.game.rp.RPWorld.

      Contrary to expectations, it seems that getDeclaredMethod only sees the methods (public or not) declared in the class itself and not in the parent class:

      "Getmethod returns the public method that matches the parameters provided, whether it is declared by the class or inherited, while getDeclaredMethod returns just those declared by the class (including package, protected, and private)."

      You have two options:

        You can change the getDeclaredMethod calls with Getmethod ones in marauroa/server/game/rp/RPServerManager.java, given that the get() method in marauroa/server/game/rp/RPWorld.java is public.

        You can do as it has been done in the game Stendhal (games/stendhal/server/StendhalRPWorld.java) and implement the get() method in the class itself:

      public static PythonRPWorld get() {
          if (instance == null) {
              instance = new PythonRPWorld();
              instance.initialize();

          }
          return instance;
      }

      In any case, you will have to rebuild marauroa.

      I hope this can help :)

       
    • I added the forgotten get() method to PythonRPWorld in Marauroa CVS. Please note that python-support is no longer activly tested so there may be other problems. Development focus moved to supporting Stendhal.

       


Anonymous


Cancel   Add attachments