triceo / drooms

Drools-based competition in a Snake-like game
3 stars 3 forks source link

Fixing class loading issue #1

Closed tomason closed 11 years ago

tomason commented 11 years ago

When player strategy used the fact types declared as POJOs and packaged in jar with the strategy, the building of the strategy threw ClassNotFoundException. This has to be fixed on strategy side:

public KnowledgeBuilder getKnowledgeBuilder(ClassLoader cls) {
    KnowledgeBuilderConfiguration conf = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(null, cls);
    KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(conf);
    // add resources
    return kbuilder;
}

This pull request adds similar code to creation of KnowledgeBase to prevent ClassNotFoundException during KnowledgeBase creation.

triceo commented 11 years ago

Funny, I was just about to commit a very similar solution to the problem. Thanks!