{"action":"created","issue":{"url":"https://api.github.com/repos/jooby-project/jooby/issues/446","repository_url":"https://api.github.com/repos/jooby-project/jooby","labels_url":"https://api.github.com/repos/jooby-project/jooby/issues/446/labels{/name}","comments_url":"https://api.github.com/repos/jooby-project/jooby/issues/446/comments","events_url":"https://api.github.com/repos/jooby-project/jooby/issues/446/events","html_url":"https://github.com/jooby-project/jooby/issues/446","id":170524810,"number":446,"title":"Jade engine in RC7 problem with resolving template files","user":{"login":"marcinc81","id":900272,"avatar_url":"https://avatars.githubusercontent.com/u/900272?v=3","gravatar_id":"","url":"https://api.github.com/users/marcinc81","html_url":"https://github.com/marcinc81","followers_url":"https://api.github.com/users/marcinc81/followers","following_url":"https://api.github.com/users/marcinc81/following{/other_user}","gists_url":"https://api.github.com/users/marcinc81/gists{/gist_id}","starred_url":"https://api.github.com/users/marcinc81/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcinc81/subscriptions","organizations_url":"https://api.github.com/users/marcinc81/orgs","repos_url":"https://api.github.com/users/marcinc81/repos","events_url":"https://api.github.com/users/marcinc81/events{/privacy}","received_events_url":"https://api.github.com/users/marcinc81/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-10T21:36:47Z","updated_at":"2016-08-11T07:02:28Z","closed_at":null,"body":"Hi, first of all: thank you for the effort and this awesome framework - I hope I will stay with it a bit longer, looks promising!\r\n\r\nToday I was struggling with Jade templates because I was getting `HTTP 500` error and blank page. Internally it was just null pointer exception when Jade4J was trying to load file using `ClasspathTemplateLoader`. It couldn't load template file because was outside the \"scope\" (I think it was the reason). Adding relative or absolute path to template file didn't give any good results. I decided to try other template loaders, so I replaced `org.jooby.jade` with copied implementation using `FileTemplateLoader` - and success! Even when template file can't be loaded Jooby sends pretty error message not a blank page.\r\n\r\nI think this loader should be replaced - or maybe explained in the Doc how to use it correctly. I must admit that I have no idea how to load jade template using `ClasspathTemplateLoader`. Also now, when I use `FileTemplateLoader` I have problem with finding proper templates path - it's relative to target/classes/ - in dev env, in production it can be different path - but I may be wrong here."},"comment":{"url":"https://api.github.com/repos/jooby-project/jooby/issues/comments/239087233","html_url":"https://github.com/jooby-project/jooby/issues/446#issuecomment-239087233","issue_url":"https://api.github.com/repos/jooby-project/jooby/issues/446","id":239087233,"user":{"login":"marcinc81","id":900272,"avatar_url":"https://avatars.githubusercontent.com/u/900272?v=3","gravatar_id":"","url":"https://api.github.com/users/marcinc81","html_url":"https://github.com/marcinc81","followers_url":"https://api.github.com/users/marcinc81/followers","following_url":"https://api.github.com/users/marcinc81/following{/other_user}","gists_url":"https://api.github.com/users/marcinc81/gists{/gist_id}","starred_url":"https://api.github.com/users/marcinc81/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcinc81/subscriptions","organizations_url":"https://api.github.com/users/marcinc81/orgs","repos_url":"https://api.github.com/users/marcinc81/repos","events_url":"https://api.github.com/users/marcinc81/events{/privacy}","received_events_url":"https://api.github.com/users/marcinc81/received_events","type":"User","site_admin":false},"created_at":"2016-08-11T07:02:27Z","updated_at":"2016-08-11T07:02:27Z","body":"Thanks for reply! It's not time wasting btw, it's a pure pleasure. :) \r\n\r\nAnswering your questions:\r\n\r\nJooby couldn't render error page due to the same reason - null pointer exception. 1st time exception was thrown due to try loading page template, 2nd time due to loading error template. Both failed (hard).\r\n\r\n```\r\npackage com.mycompany;\r\n\r\nimport org.jooby.Jooby;\r\nimport org.jooby.Results;\r\nimport org.jooby.jade.Jade;\r\n\r\n/**\r\n * @author jooby generator\r\n */\r\npublic class App extends Jooby {\r\n\r\n    {\r\n        use(new Jade(\".jade\"));\r\n        get(\"/\", () -> Results.html(\"index\"));\r\n    }\r\n\r\n    public static void main(final String[] args) throws Throwable {\r\n        run(App::new, args);\r\n    }\r\n}\r\n```\r\n\r\nBlank page is displayed when there's some error, such as 404. \r\n\r\nLook at this stack trace:\r\n\r\n```\r\nlistening on:\r\n  http://localhost:8080/\r\n\r\n[2016-08-11 08:53:15,939]-[netty task-3-1] ERROR org.jooby.Err - execution of: GET/index.jade resulted in exception\r\nRoute:\r\n      | Method | Path        | Source      | Name | Pattern     | Consumes | Produces                                                             |\r\n      |--------|-------------|-------------|------|-------------|----------|----------------------------------------------------------------------|\r\n      | GET    | /index.jade | ~unknown:-1 | /err | /index.jade | [*/*]    | [text/html, application/xhtml+xml, application/xml, image/webp, */*] |\r\n\r\nStacktrace:\r\norg.jooby.Err: Not Found(404): /index.jade\r\n        at org.jooby.internal.HttpHandlerImpl.lambda$routes$228(HttpHandlerImpl.java:407) ~[jooby-1.0.0.CR7.jar!/:1.0.0.CR7]\r\n        at org.jooby.internal.RouteImpl.handle(RouteImpl.java:108) ~[jooby-1.0.0.CR7.jar!/:1.0.0.CR7]\r\n        at org.jooby.internal.RouteChain.next(RouteChain.java:70) ~[jooby-1.0.0.CR7.jar!/:1.0.0.CR7]\r\n        at org.jooby.Route$Chain.next(Route.java:2074) ~[jooby-1.0.0.CR7.jar!/:1.0.0.CR7]\r\n        at org.jooby.internal.HttpHandlerImpl.handle(HttpHandlerImpl.java:293) ~[jooby-1.0.0.CR7.jar!/:1.0.0.CR7]\r\n        at org.jooby.internal.netty.NettyHandler.channelRead0(NettyHandler.java:85) [jooby-netty-1.0.0.CR7.jar!/:1.0.0.CR7]\r\n        at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [netty-transport-4.1.4.Final.jar!/:4.1.4.Final]\r\n        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:372) [netty-transport-4.1.4.Final.jar!/:4.1.4.Final]\r\n        at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:38) [netty-transport-4.1.4.Final.jar!/:4.1.4.Final]\r\n        at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:363) [netty-transport-4.1.4.Final.jar!/:4.1.4.Final]\r\n        at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:66) [netty-common-4.1.4.Final.jar!/:4.1.4.Final]\r\n        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:877) [netty-common-4.1.4.Final.jar!/:4.1.4.Final]\r\n        at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144) [netty-common-4.1.4.Final.jar!/:4.1.4.Final]\r\n        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_102]\r\n[2016-08-11 08:53:15,960]-[netty task-3-1] ERROR org.jooby.spi.HttpHandler - execution of: GET/index.jade resulted in exception\r\njava.lang.NullPointerException\r\n        at java.io.Reader.<init>(Reader.java:78)\r\n        at java.io.InputStreamReader.<init>(InputStreamReader.java:97)\r\n        at de.neuland.jade4j.template.ClasspathTemplateLoader.getReader(ClasspathTemplateLoader.java:26)\r\n        at de.neuland.jade4j.lexer.Lexer.<init>(Lexer.java:47)\r\n        at de.neuland.jade4j.parser.Parser.<init>(Parser.java:45)\r\n        at de.neuland.jade4j.JadeConfiguration.createTemplate(JadeConfiguration.java:85)\r\n        at de.neuland.jade4j.JadeConfiguration.getTemplate(JadeConfiguration.java:64)\r\n        at org.jooby.jade.Engine.render(Engine.java:46)\r\n        at org.jooby.View$Engine.render(View.java:54)\r\n        at org.jooby.internal.AbstractRendererContext.render(AbstractRendererContext.java:76)\r\n        at org.jooby.internal.ResponseImpl.send(ResponseImpl.java:347)\r\n        at org.jooby.Err$DefHandler.handle(Err.java:72)\r\n        at org.jooby.internal.HttpHandlerImpl.handleErr(HttpHandlerImpl.java:378)\r\n        at org.jooby.internal.HttpHandlerImpl.cleanup(HttpHandlerImpl.java:352)\r\n        at org.jooby.internal.HttpHandlerImpl.handle(HttpHandlerImpl.java:301)\r\n        at org.jooby.internal.netty.NettyHandler.channelRead0(NettyHandler.java:85)\r\n        at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)\r\n        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:372)\r\n        at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:38)\r\n        at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:363)\r\n        at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:66)\r\n        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:877)\r\n        at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)\r\n        at java.lang.Thread.run(Thread.java:745)\r\nCaused by:\r\norg.jooby.Err: Not Found(404): /index.jade\r\n        at org.jooby.internal.HttpHandlerImpl.lambda$routes$228(HttpHandlerImpl.java:407) ~[jooby-1.0.0.CR7.jar!/:1.0.0.CR7]\r\n        at org.jooby.internal.RouteImpl.handle(RouteImpl.java:108) ~[jooby-1.0.0.CR7.jar!/:1.0.0.CR7]\r\n        at org.jooby.internal.RouteChain.next(RouteChain.java:70) ~[jooby-1.0.0.CR7.jar!/:1.0.0.CR7]\r\n        at org.jooby.Route$Chain.next(Route.java:2074) ~[jooby-1.0.0.CR7.jar!/:1.0.0.CR7]\r\n        at org.jooby.internal.HttpHandlerImpl.handle(HttpHandlerImpl.java:293) ~[jooby-1.0.0.CR7.jar!/:1.0.0.CR7]\r\n        at org.jooby.internal.netty.NettyHandler.channelRead0(NettyHandler.java:85) [jooby-netty-1.0.0.CR7.jar!/:1.0.0.CR7]\r\n        at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [netty-transport-4.1.4.Final.jar!/:4.1.4.Final]\r\n        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:372) [netty-transport-4.1.4.Final.jar!/:4.1.4.Final]\r\n        at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:38) [netty-transport-4.1.4.Final.jar!/:4.1.4.Final]\r\n        at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:363) [netty-transport-4.1.4.Final.jar!/:4.1.4.Final]\r\n        at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:66) [netty-common-4.1.4.Final.jar!/:4.1.4.Final]\r\n        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:877) [netty-common-4.1.4.Final.jar!/:4.1.4.Final]\r\n        at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144) [netty-common-4.1.4.Final.jar!/:4.1.4.Final]\r\n        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_102]\r\n```\r\n\r\nIndeed, keeping templates in public folder worked! I added 'err.jade' in /public and now I can see my error page, but without this file: blank page and that stack trace.\r\n\r\nCheers!\r\n"}}
{"actor":{"display_login":"marcinc81"}}