Thread: [Erlangweb-users] Problems in step1 of tutorial
Brought to you by:
etcerlangweb,
paulgray
|
From: Jeffm <je...@gh...> - 2010-03-18 07:59:22
|
Following the tutorial at http://wiki.erlang-web.org/Tutorial/Step1_Setup with release 1.4 of erlang web. I get up to testing /item/show/1 but I get a 404 in the web browser. My first suspicions was that I'd mistyped the dispatch rules in dispatch.conf, so I cut and pasted them from the tutorial then restarted erlang web. I also added an io:format/2 to the browser:show_item/1 to see if it at lest made it this far...doesn't appear that it does. The log says, e_mod_gen module, error: 404: "/item/show/1" What should I check next? thanks, Jeff. |
|
From: Elena B. <ele...@gm...> - 2010-03-18 08:37:11
|
hmm...
This rule in dispatch.conf
{dynamic, "^/item/show/(?<id>[0-9]+)$", {browser, show_item}}.
does not work for me for "/item/show/1".
You can try this one:
{dynamic, "^/item/show/([0-9]+)$", {browser, show_item}}.
On Thu, Mar 18, 2010 at 9:43 AM, Jeffm <je...@gh...> wrote:
> Following the tutorial at
>
> http://wiki.erlang-web.org/Tutorial/Step1_Setup
>
> with release 1.4 of erlang web. I get up to testing /item/show/1 but I
> get a 404 in the web browser. My first suspicions was that I'd mistyped
> the dispatch rules in dispatch.conf, so I cut and pasted them from the
> tutorial then restarted erlang web. I also added an io:format/2 to the
> browser:show_item/1 to see if it at lest made it this far...doesn't
> appear that it does. The log says,
>
> e_mod_gen module, error: 404: "/item/show/1"
>
> What should I check next?
>
> thanks,
> Jeff.
>
>
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Erlangweb-users mailing list
> Erl...@li...
> https://lists.sourceforge.net/lists/listinfo/erlangweb-users
> http://www.erlang-web.org/
>
|
|
From: Roberto A. <rob...@er...> - 2010-03-18 13:36:52
|
On 03/18/2010 08:37 AM, Elena Bobrova wrote:
> hmm...
> This rule in dispatch.conf
>
> {dynamic, "^/item/show/(?<id>[0-9]+)$", {browser, show_item}}.
>
> does not work for me for "/item/show/1".
>
> You can try this one:
> {dynamic, "^/item/show/([0-9]+)$", {browser, show_item}}.
You might want to keep that "id", since it could be extremely helpful.
In your controller, you'll be able to refer easily to that parameter by
name, instead of scanning the list of all available arguments.
Cheers,
Roberto Aloi
--
University of Kent - Erlang Solutions Ltd.
Twitter: @prof3ta
Blog: http://aloiroberto.wordpress.com
---------------------------------------------------
---------------------------------------------------
WE'VE CHANGED NAMES!
Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.
www.erlang-solutions.com
|
|
From: Roberto A. <rob...@er...> - 2010-03-18 13:36:52
|
On 03/18/2010 07:43 AM, Jeffm wrote: > Following the tutorial at > > http://wiki.erlang-web.org/Tutorial/Step1_Setup > > with release 1.4 of erlang web. I get up to testing /item/show/1 but I > get a 404 in the web browser. My first suspicions was that I'd mistyped > the dispatch rules in dispatch.conf, so I cut and pasted them from the > tutorial then restarted erlang web. I also added an io:format/2 to the > browser:show_item/1 to see if it at lest made it this far...doesn't > appear that it does. The log says, > > e_mod_gen module, error: 404: "/item/show/1" > > What should I check next? You might want to debug what's happening behind the scenes. In Erlang, it's extremely easy to trace functions, so that you can check which function has been called, when, and what it's returning. In your case, you might be interested in the function: e_dispatcher:dispatch/1 Tracing functions will help you (a lot!) in understanding how the whole Erlang Web framework works. For more information on how to trace Erlang functions, have a look to this quick reference: http://aloiroberto.wordpress.com/2009/02/23/tracing-erlang-functions/ Regards, Roberto Aloi -- University of Kent - Erlang Solutions Ltd. Twitter: @prof3ta Blog: http://aloiroberto.wordpress.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com |
|
From: Jeffm <je...@gh...> - 2010-03-19 05:33:18
|
Alright folks I'm an idiot. I must have started a copy in the
background with the bin/start script and it was the one answering
requests. It wasn't until I tried the trace that you suggested below
that I notice that I wasn't getting requests to the instance I was
looking at. Thanks.
I did notice one thing while debugging. If you don't have the brackets
in the regexp in the dispatch.conf file balanced and attempt to start
erlang-web, say via bin/start_interactive, you get something like
=PROGRESS REPORT==== 19-Mar-2010::11:58:36 ===
application: inets
started_at: nonode@nohost
{"init terminating in
do_boot",{badarg,[{e_conf,dbms,0},{e_db,start,0},{init,start_it,1},{init,start_em,1}]}}
Crash dump was written to: erl_crash.dump
init terminating in do_boot ()
The first time this occurred there was a list of integers in the
erl_crash.dump which happened to decode to an erlang error. This can
also be seen in the log messages on screen once you know what your
looking for but can still be hard to see.
For example,
exception exit: {bad_return,
{{eptic,start,[normal,[]]},
{'EXIT',
{{badmatch,{error,{"unmatched
parentheses",24}}},
[{e_dispatcher,divide,3},
{e_dispatcher,install,0},
{lists,foreach,2},
{eptic,start_link,0},
{application_master,start_it_old,4}]}}}}
If possible I'd like to put in a feature request that this error be
caught and a meaningful error displayed.
Jeff.
On 19/03/10 12:18 AM, Roberto Aloi wrote:
> You might want to debug what's happening behind the scenes.
> In Erlang, it's extremely easy to trace functions, so that you can check
> which function has been called, when, and what it's returning.
>
> In your case, you might be interested in the function:
> e_dispatcher:dispatch/1
>
> Tracing functions will help you (a lot!) in understanding how the whole
> Erlang Web framework works.
>
> For more information on how to trace Erlang functions, have a look to
> this quick reference:
> http://aloiroberto.wordpress.com/2009/02/23/tracing-erlang-functions/
>
> Regards,
>
> Roberto Aloi
>
>
|