eclipse-archived / ceylon-ide-eclipse

Eclipse Plugin for Ceylon
http://ceylon-lang.org/documentation/ide
Eclipse Public License 1.0
59 stars 28 forks source link

Run As is totally broken #731

Closed gavinking closed 11 years ago

gavinking commented 11 years ago

I have this program:

import ceylon.html {
    Html,
    html5,
    Head,
    Body,
    P
}
import ceylon.html.serializer {
    NodeSerializer
}
import ceylon.net.http.server {
    createServer,
    Endpoint,
    startsWith,
    Response,
    Request
}

Html html(Request request) {
    return Html {
        doctype = html5; 
        Head { title = "Hello"; }; 
        Body {
            P("Hello!")
        };
    };
}

shared void runit() {
    createServer {
        Endpoint { 
            path = startsWith("/"); 
            void service(Request request, Response response) {
                NodeSerializer(response.writeString).serialize(html(request));
            }
        }
    }.start();
}

Using Run As > Ceylon Module, it immediately fails:

Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:86)
    at com.redhat.ceylon.launcher.Launcher.main(Launcher.java:21)
Caused by: java.lang.NoClassDefFoundError: ceylon/net/http/server/Endpoint
    at hello.world.runit_.runit(run.ceylon:31)
    at hello.world.runit_.main(run.ceylon)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at ceylon.modules.api.runtime.SecurityActions.invokeRunInternal(SecurityActions.java:61)
    at ceylon.modules.api.runtime.SecurityActions.invokeRun(SecurityActions.java:51)
    at ceylon.modules.api.runtime.AbstractRuntime.invokeRun(AbstractRuntime.java:89)
    at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:138)
    at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:126)
    at ceylon.modules.Main.execute(Main.java:69)
    at ceylon.modules.Main.main(Main.java:42)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.jboss.modules.Module.run(Module.java:270)
    at org.jboss.modules.Main.main(Main.java:294)
    at ceylon.modules.bootstrap.CeylonRunTool.run(CeylonRunTool.java:162)
    at com.redhat.ceylon.tools.CeylonTool.run(CeylonTool.java:323)
    at com.redhat.ceylon.tools.CeylonTool.execute(CeylonTool.java:271)
    ... 6 more
Caused by: java.lang.ClassNotFoundException: ceylon.net.http.server.Endpoint from [Module "hello.world:1.0.0" from Ceylon ModuleLoader: RootRepositoryManager: FileContentStore: /Users/gavin/.ceylon/cache]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
    ... 28 more

Using Run As > Ceylon Application, it starts, but then fails when I access the endpoint:

Starting on 127.0.0.1:8080
Oct 23, 2013 9:07:47 AM org.xnio.Xnio <clinit>
INFO: XNIO Version 3.1.0.CR6
Oct 23, 2013 9:07:47 AM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.1.0.CR6
Httpd started.
Oct 23, 2013 9:07:53 AM io.undertow.server.HttpHandlers executeRootHandler
ERROR: Blocking request failed HttpServerExchange{ GET /}
java.lang.NoClassDefFoundError: org/jboss/modules/ModuleClassLoader
    at com.redhat.ceylon.compiler.java.runtime.model.RuntimeModelLoader.findModuleForClass(RuntimeModelLoader.java:110)
    at com.redhat.ceylon.compiler.java.runtime.model.RuntimeModuleManager.findModuleForClass(RuntimeModuleManager.java:91)
    at com.redhat.ceylon.compiler.java.runtime.model.TypeDescriptor$Class.toProducedType(TypeDescriptor.java:84)
    at com.redhat.ceylon.compiler.java.runtime.model.TypeDescriptor$Class.toProducedType(TypeDescriptor.java:78)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.isReified(Metamodel.java:143)
    at com.redhat.ceylon.compiler.java.Util.isReified(Util.java:43)
    at ceylon.html.serializer.NodeSerializer.visit$priv$(NodeSerializer.ceylon:63)
    at ceylon.html.serializer.NodeSerializer.serialize(NodeSerializer.ceylon:27)
    at hello.world.runit_$1.$call$(run.ceylon:34)
    at ceylon.net.http.server.Endpoint.service(Endpoint.ceylon:7)
    at ceylon.net.http.server.internal.CeylonRequestHandler.invokeEndpoint$priv$(CeylonRequestHandler.ceylon:69)
    at ceylon.net.http.server.internal.CeylonRequestHandler.handleRequest(CeylonRequestHandler.ceylon:40)
    at ceylon.net.http.server.internal.websocket.WebSocketProtocolHandshakeHandler.handleRequest(WebSocketProtocolHandshakeHandler.ceylon:41)
    at io.undertow.server.session.SessionAttachmentHandler.handleRequest(SessionAttachmentHandler.java:75)
    at io.undertow.server.handlers.error.SimpleErrorPageHandler.handleRequest(SimpleErrorPageHandler.java:76)
    at io.undertow.server.HttpHandlers.executeRootHandler(HttpHandlers.java:36)
    at io.undertow.server.HttpReadListener.handleEvent(HttpReadListener.java:152)
    at io.undertow.server.HttpOpenListener.handleEvent(HttpOpenListener.java:66)
    at io.undertow.server.HttpOpenListener.handleEvent(HttpOpenListener.java:36)
    at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:91)
    at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:290)
    at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:285)
    at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:91)
    at org.xnio.nio.NioTcpServerHandle.handleReady(NioTcpServerHandle.java:53)
    at org.xnio.nio.WorkerThread.run(WorkerThread.java:528)
Caused by: java.lang.ClassNotFoundException: org.jboss.modules.ModuleClassLoader
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    ... 25 more

Oct 23, 2013 9:07:53 AM io.undertow.server.HttpHandlers executeRootHandler
ERROR: Blocking request failed HttpServerExchange{ GET /favicon.ico}
java.lang.NoClassDefFoundError: org/jboss/modules/ModuleClassLoader
    at com.redhat.ceylon.compiler.java.runtime.model.RuntimeModelLoader.findModuleForClass(RuntimeModelLoader.java:110)
    at com.redhat.ceylon.compiler.java.runtime.model.RuntimeModuleManager.findModuleForClass(RuntimeModuleManager.java:91)
    at com.redhat.ceylon.compiler.java.runtime.model.TypeDescriptor$Class.toProducedType(TypeDescriptor.java:84)
    at com.redhat.ceylon.compiler.java.runtime.model.TypeDescriptor$Class.toProducedType(TypeDescriptor.java:78)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.isReified(Metamodel.java:143)
    at com.redhat.ceylon.compiler.java.Util.isReified(Util.java:43)
    at ceylon.html.serializer.NodeSerializer.visit$priv$(NodeSerializer.ceylon:63)
    at ceylon.html.serializer.NodeSerializer.serialize(NodeSerializer.ceylon:27)
    at hello.world.runit_$1.$call$(run.ceylon:34)
    at ceylon.net.http.server.Endpoint.service(Endpoint.ceylon:7)
    at ceylon.net.http.server.internal.CeylonRequestHandler.invokeEndpoint$priv$(CeylonRequestHandler.ceylon:69)
    at ceylon.net.http.server.internal.CeylonRequestHandler.handleRequest(CeylonRequestHandler.ceylon:40)
    at ceylon.net.http.server.internal.websocket.WebSocketProtocolHandshakeHandler.handleRequest(WebSocketProtocolHandshakeHandler.ceylon:41)
    at io.undertow.server.session.SessionAttachmentHandler.handleRequest(SessionAttachmentHandler.java:75)
    at io.undertow.server.handlers.error.SimpleErrorPageHandler.handleRequest(SimpleErrorPageHandler.java:76)
    at io.undertow.server.HttpHandlers.executeRootHandler(HttpHandlers.java:36)
    at io.undertow.server.HttpReadListener.handleEvent(HttpReadListener.java:152)
    at io.undertow.server.HttpReadListener.handleEvent(HttpReadListener.java:44)
    at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:91)
    at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
    at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:85)
    at org.xnio.nio.WorkerThread.run(WorkerThread.java:528)
FroMage commented 11 years ago

Let me look, it could be my recent changes in the model loader.

FroMage commented 11 years ago

Doesn't look like my fault though:

org.jboss.modules.ModuleLoadError: Module org.jboss.logmanager:main is not found in local module loader @7f079e09 (roots: /home/stephane/src/java-eclipse/ceylon-runtime/../ceylon-dist/dist/repo)

@quintesse any idea?

akberc commented 11 years ago

Possible regression. 'main' was replaced by the actual version number last week by @quintesse

Let me know if it is urgent and you want me to take a look.

FroMage commented 11 years ago

OK I found and fixed it in ceylon-runtime.