Skip to content
This repository

Support for Vert.x #39

Open
zhaopuming opened this Issue May 29, 2012 · 13 comments

2 participants

zhaopuming Green Luo
zhaopuming

As you may have already know it, vert.x is a new webframework/server for the JVM, similarity to Node.js. From its feature list and its VMWare background, it looks promising. Homepage is at http://vertx.io/

I tried to use Rythm as the template engine in vert.x, but failed due to vert.x not finding classes in the rythm jars. It seems to be related to classloader problems, which I don't understand.

As playframework had moved away from Java into scala, I'd suggest supporting Rythm in vert.x is a good option. Would you be insterested in taking a look at vert.x and make Rythm work with it ?

Green Luo
Owner
zhaopuming

Thanks :) I have sent you a email, with my simple project. I just found that vert.x has a module system similar to play framework. So maybe that is where you should look into if you are interested. http://vertx.io/mods_manual.html

zhaopuming

Hi green, is there a plan on this issue?

Green Luo
Owner
zhaopuming

Thanks Green. I'd like to learn about how Rhythm is designed and implemented. Could you guide me with some resources? I've read docs on your website. Will get some time to start reading your code :)

Green Luo
Owner
zhaopuming

Hi, green. I'm back to try Rythm with Vert.x again. A simplest test with:

Rythm.render("Hello @who", "World");

in vert.x will lead to the following exception:

com.greenlaw110.rythm.exception.CompileException: Error compile template[Hello @who]. Java code line: 4; Template code line:-1; Error: com.greenlaw110.rythm.template.TagBase cannot be resolved to a type

Can you shed some light on this and direct me where to find the problem? I know you've been busy.

zhaopuming

I guess it may be caused by a classpath problem. The Eclipse compiler did not get the classpath (including rythm.jar) from vert.x code which was calling Rytem.render()... Are they in different classloader? How can I pass the classpath information to the eclipse compiler? I can't find any document about the eclipse compiler online.

zhaopuming

This is the code I'm using:

public class ServerVerticle extends Verticle {

    @Override
    public void start() throws Exception {
        HttpServer server = vertx.createHttpServer();

        RouteMatcher route = new RouteMatcher();
        route.get("/", new Handler<HttpServerRequest>() {
            @Override
            public void handle(HttpServerRequest req) {
                // ~ This is OK
                // req.response.end("Hello world");
                // ~ This leads to template compiler error
                req.response.end(Rythm.render("Hello @who", "world"));
            }
        });

        server.requestHandler(route);
        server.listen(8080);
    }

}

Green Luo
Owner
zhaopuming

Yes, running from ant or directly from Eclipse (in a main method) is OK.

I can't think of a way that a child classloader won't be able to load classes already in its parents. I don't know much about classloaders and JVM internals though.

So you mean this may be caused by vert.x? I'll ask on their google group

zhaopuming

As for now, Vert.x 2.0 works with Rythm OK.

Green Luo
Owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.