Solved MongoDB problem

Discussion in 'Plugin Development' started by Funergy, Nov 21, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Funergy

    Hello,
    Since I discovered that there are also JSON databases like MongoDB, I'm trying It now
    but I have problems.
    I get errors like NoClassDefFound and NoClassFoundException: com.mongodb.MongoClient.
    I have a MANIFEST.MF
    that looks like this:

    Manifest-Version: 1.0

    Class-Path: mongo.jar

    in my project where the plugin.yml is
    But its still not working
    If you need my code, ask me.

    Regards Funergy
     
  2. Offline

    mythbusterma

    Funergy

    Why are you bundling more software with a plugin? All you're going to do is bloat your plugin. Why not just simply use the built in JSON, or SQL?

    Did you make sure to actually include the classes in your .jar file? Open it in a zip viewer and look for the MongoDB.jar or whatever it's called.
     
  3. Offline

    Funergy

    mythbusterma I'm not going to use SQL because
    - You have no lists. but you have it in MongoDB
    friends: [{"name": "RandomName"},{"name": "Funergy"}]

    - I've heard from a Youtube video that SQL is not the best way to run a whole network on

    mythbusterma What am I doing wrong?
    http://gyazo.com/01c5da051e9d620782c75999f5d2f58c

    <Edit by mrCookieSlime: Merged Posts. Please dont double post. There is an Edit-Button right next to the Date.>
     
  4. Offline

    mythbusterma

    Funergy

    What do you mean by "list?"

    What's wrong with SQL? Is it that it's more stable?

    I told you to look at your .jar export, not post a screenshot of your project directory.
     
  5. Offline

    SuperOriginal

    I prefer maven shading.
     
  6. Offline

    ResultStatic

    Funergy you dont ever need to store a list in sql. you should learn how to properly structure a database. tell me whats more efficient changing one string in a table or changing an entire list of 100 strings when half the strings might not have even changed. because that will each up your bandwidth for no reason when sending huge list that arnt even changing. lets say your storing a list per player of owned kits. you would create a table just for kits. in the table you could have a column for - uuid of the player who owns the kit : the name of the kit : amount of kills with the kit for that player : when the player bought it etc. now your thinking that would cause performance issues because lets say you have a server with 100k players and each player owns 20 kits. that's 2 million entries in the table. luckily thats nothing for sql and sql can handle massive amounts of data like that and its much more efficient than storing list.

    for your example i would have an sql table named `friends`. then a column for the uuid of the player1 then a column for the uuid of player2. when the player joins do SELECT * FROM `friends` WHERE uuid = 'uuid' then you can use while(result.next()){ to retrieve every row where uuid = 'uuid'. in the while loop add the friends uuid to a local cache of friends for the player that joined. every time the friends list is updated you can add or remove the friend from the table. i like to have data in my database always up to date with the local cache in case it crashes and if i want to use that data externally like in a website, but i only pull data from the database when the player joins
     
  7. Offline

    Funergy

    mythbusterma ResultStatic I don't care if SQL is still the best choice.
    I just want to know how to fix this.
    on my Eclipse: on my exportpage I click the last next en there you can select your MANIFEST.MF I have done that. but its still not working
     
  8. Offline

    mythbusterma

    Funergy

    Again, I told you to examine your .jar file for the classes. Also, you should be able to defend the use of the software if it means bloating up your plugin just to have it, and causing you this issue.
     
  9. Offline

    Funergy

    mythbusterma Why I chose for MongoDB is all the professional networks run their data on MongoDB
     
  10. Offline

    mythbusterma

    Oh man, that was truly funny. I almost fell out of my chair on that one. That was actually the funniest thing I've seen all week.

    Try again. That's not a justification (even if it was REMOTELY true).
     
    user_90854156 and Avygeil like this.
  11. Offline

    Funergy

  12. Offline

    mythbusterma

    Funergy

    Well you didn't provide an opinion, you stated that

    which isn't true at all.

    Furthermore, that's not a justification. There are different applications for different purposes, and you should have a very good justification if you're going to be bloating up a plugin 10-fold just to have this piece of software that effectively does nothing different.

    As an aside, you still haven't done what I told you to do to see if it worked.
     
  13. Offline

    Funergy

  14. Offline

    mythbusterma

    Funergy

    There's a fair enough reason. Wanting to learn. Yea, one big network uses it, most big networks have awful coders.

    Anyways, that's not your .jar file, that's an export window in Eclipse. Where did I mention Eclipse?
     
  15. Offline

    Funergy

  16. Offline

    mythbusterma

    Funergy

    Yes, so it is being exported. Is it being loaded?
     
  17. Offline

    Funergy

    mythbusterma The plugin is getting loaded but then I'm getting this stupid error
    Code:
    Caused by: java.lang.ClassNotFoundException: com.mongodb.MongoClient
        at java.net.URLClassLoader$1.run(URLClassLoader.java:372) ~[?:1.8.0_25]
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361) ~[?:1.8.0_25]
        at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_25]
        at java.net.URLClassLoader.findClass(URLClassLoader.java:360) ~[?:1.8.0_25]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:77) ~[spigot.jar:git-Spigot-1497]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:62) ~[spigot.jar:git-Spigot-1497]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_25]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_25]
        ... 18 more
    
    And a question. Can a whole network run on MySQL? with like 500 people on it.
    Every server is connected to it, 5 Hubs,...
     
  18. Offline

    mythbusterma

    Funergy

    Pretty sure that's exactly what MySQL was built for....except larger.

    Anyway, you have to make sure the class loader actually loads your jarfile, you'll have to look at some of the documentation for MongoDB for how to do that.
     
  19. Offline

    Funergy

    mythbusterma okay... the problem was my MANIFEST.MF
    I needed to add

    Created-By: 1.7.0_06 (Oracle Corporation)

    or anything like that

    mythbusterma Oh yeah Hypixel also runs fully on MongoDB

    <Edit by mrCookieSlime: Merged Posts. Please dont double post. There is an Edit-Button right next to the Date.>
     
  20. Offline

    ResultStatic

    Funergy who cares what these servers run it doesn't mean its the best solution, also fun fact facebook uses mysql, why would you want to add tons of software to your plugin that does nothing.
     
  21. Offline

    mazentheamazin

    [...] I thought you should know, relational databases (such as MySQL) have existed since the 70s and are the most mature technology you can find. [...]

    As ResultStatic said, there is absolutely no need for "lists" with a proper data structure.

    <Edit by mrCookieSlime: Again, removed inappropriate language. Please be nice and friendly to each other.>
     
    ResultStatic and rbrick like this.
  22. Offline

    Funergy

    mazentheamazin I don't even care if MySQL is better
    IF I WANT TO USE MONGODB I USE IT!!!!
     
  23. Offline

    mrCookieSlime

    Locked per request.
     
Thread Status:
Not open for further replies.

Share This Page