First steps with Ufront - some 500 problems...

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

First steps with Ufront - some 500 problems...

cambiata
Hi Franco and others!

Trying a basic Ufront setup with the instructions that I find at http://haxe.org/com/libs/ufront.

I've created a new FD4 project called "ufrontsetup" where I've downloaded the sourcecode for the needed libraries
(ufront, thx, hxevents, php/ufront/web) and put them in my scr folder. (Just to be able to keep an eye on them...)
Everything is reflected in a github project: https://github.com/cambiata/ufrontsetup if anyone's interested.

Modelled after the instructions at http://haxe.org/com/libs/ufront, my Main.hx class looks like this:
https://github.com/cambiata/ufrontsetup/blob/master/src/Main.hx

   package ;

   import php.Lib;
   import ufront.web.AppConfiguration;
   import ufront.web.mvc.MvcApplication;
   import controller.Home;
   import controller.Ufrontsetup;

   class Main
   {
      static function main()
       {
           trace('hello');
           var config = new AppConfiguration("controller", false);
           new MvcApplication(config).execute();
       }
   }

and the Home controller (controller/Home.hx) like this:
https://github.com/cambiata/ufrontsetup/blob/master/src/controller/Home.hx

   package controller;
   import ufront.web.mvc.Controller;
   class Home extends Controller
   {
      public function index() return "hello world!"
   }

Compiling works fine without errors, the browser opens as expected on http://localhost/ufrontsetup/bin/index.php,
but displays a 500 error message:

Error 500: Internal Server Error
unable to find a class for the controller 'ufrontsetup'

Obviously, Ufront is looking for a controller named "ufrontsetup"...
So, I create this one (controller/Ufrontsetup.hx)
https://github.com/cambiata/ufrontsetup/blob/master/src/controller/Ufrontsetup.hx

   package controller;
   import ufront.web.mvc.Controller;
   class Ufrontsetup extends Controller
   {
       public function index() return "hello world from Ufrontsetup!"
   }

Once again compiling without problem, but this time with the following error displayed in the browser:

Error 500: Internal Server Error
Trying to get property of non-object (errno: 8) in E:\_dev\xampp\htdocs\ufrontsetup\bin\lib\thx\type\Rttis.class.php at line #136
error stack:
- haxe.xml.Fast.getName
- Xml:lambda_2.
- Xml:lambda_2.
- haxe.xml.Fast.getName
etc... stack trace.

Can anyone give a clue how to sort this out?

Jonas


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: First steps with Ufront - some 500 problems...

tom rhodes
i'd be interested in some docs/tutorials for uFront too :)

2011/10/27 Jonas Nyström <[hidden email]>
Hi Franco and others!

Trying a basic Ufront setup with the instructions that I find at http://haxe.org/com/libs/ufront.

I've created a new FD4 project called "ufrontsetup" where I've downloaded the sourcecode for the needed libraries
(ufront, thx, hxevents, php/ufront/web) and put them in my scr folder. (Just to be able to keep an eye on them...)
Everything is reflected in a github project: https://github.com/cambiata/ufrontsetup if anyone's interested.

Modelled after the instructions at http://haxe.org/com/libs/ufront, my Main.hx class looks like this:
https://github.com/cambiata/ufrontsetup/blob/master/src/Main.hx

   package ;

   import php.Lib;
   import ufront.web.AppConfiguration;
   import ufront.web.mvc.MvcApplication;
   import controller.Home;
   import controller.Ufrontsetup;

   class Main
   {
      static function main()
       {
           trace('hello');
           var config = new AppConfiguration("controller", false);
           new MvcApplication(config).execute();
       }
   }

and the Home controller (controller/Home.hx) like this:
https://github.com/cambiata/ufrontsetup/blob/master/src/controller/Home.hx

   package controller;
   import ufront.web.mvc.Controller;
   class Home extends Controller
   {
      public function index() return "hello world!"
   }

Compiling works fine without errors, the browser opens as expected on http://localhost/ufrontsetup/bin/index.php,
but displays a 500 error message:

Error 500: Internal Server Error
unable to find a class for the controller 'ufrontsetup'

Obviously, Ufront is looking for a controller named "ufrontsetup"...
So, I create this one (controller/Ufrontsetup.hx)
https://github.com/cambiata/ufrontsetup/blob/master/src/controller/Ufrontsetup.hx

   package controller;
   import ufront.web.mvc.Controller;
   class Ufrontsetup extends Controller
   {
       public function index() return "hello world from Ufrontsetup!"
   }

Once again compiling without problem, but this time with the following error displayed in the browser:

Error 500: Internal Server Error
Trying to get property of non-object (errno: 8) in E:\_dev\xampp\htdocs\ufrontsetup\bin\lib\thx\type\Rttis.class.php at line #136
error stack:
- haxe.xml.Fast.getName
- Xml:lambda_2.
- Xml:lambda_2.
- haxe.xml.Fast.getName
etc... stack trace.

Can anyone give a clue how to sort this out?

Jonas


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: First steps with Ufront - some 500 problems...

Franco Ponticelli
In reply to this post by cambiata
You are not very far from a working solution .... ufrontsetup error is generated because you are not working in the root of your web server but in a subdirectory. To fix that just add the following line to your code:

application.httpContext.addUrlFilter(new DirectoryUrlFilter("ufrontsetup"));

Where "ufrontsetup" is the subpath where your app is located ... the code should be something like this:

import ufront.web.AppConfiguration;
import ufront.web.mvc.MvcApplication;
import ufront.web.DirectoryUrlFilter;
import thx.util.Imports;

class Main 
{
static function main() 
{
Imports.pack("controller");
var config = new AppConfiguration("controller", false),
application = new MvcApplication(config);
application.httpContext.addUrlFilter(new DirectoryUrlFilter("ufrontsetup"));
application.execute();
}
}

Note that you don't need at all the controller Ufrontsetup. Also note that MvcApplication only adds some very basic routing paths (one for Home.index and one generic for any {controller}.{action}); I usually prefer to build my routes by hand and make them extremely specific.

Hope this helps,

Franco

2011/10/27 Jonas Nyström <[hidden email]>
Hi Franco and others!

Trying a basic Ufront setup with the instructions that I find at http://haxe.org/com/libs/ufront.

I've created a new FD4 project called "ufrontsetup" where I've downloaded the sourcecode for the needed libraries
(ufront, thx, hxevents, php/ufront/web) and put them in my scr folder. (Just to be able to keep an eye on them...)
Everything is reflected in a github project: https://github.com/cambiata/ufrontsetup if anyone's interested.

Modelled after the instructions at http://haxe.org/com/libs/ufront, my Main.hx class looks like this:
https://github.com/cambiata/ufrontsetup/blob/master/src/Main.hx

   package ;

   import php.Lib;
   import ufront.web.AppConfiguration;
   import ufront.web.mvc.MvcApplication;
   import controller.Home;
   import controller.Ufrontsetup;

   class Main
   {
      static function main()
       {
           trace('hello');
           var config = new AppConfiguration("controller", false);
           new MvcApplication(config).execute();
       }
   }

and the Home controller (controller/Home.hx) like this:
https://github.com/cambiata/ufrontsetup/blob/master/src/controller/Home.hx

   package controller;
   import ufront.web.mvc.Controller;
   class Home extends Controller
   {
      public function index() return "hello world!"
   }

Compiling works fine without errors, the browser opens as expected on http://localhost/ufrontsetup/bin/index.php,
but displays a 500 error message:

Error 500: Internal Server Error
unable to find a class for the controller 'ufrontsetup'

Obviously, Ufront is looking for a controller named "ufrontsetup"...
So, I create this one (controller/Ufrontsetup.hx)
https://github.com/cambiata/ufrontsetup/blob/master/src/controller/Ufrontsetup.hx

   package controller;
   import ufront.web.mvc.Controller;
   class Ufrontsetup extends Controller
   {
       public function index() return "hello world from Ufrontsetup!"
   }

Once again compiling without problem, but this time with the following error displayed in the browser:

Error 500: Internal Server Error
Trying to get property of non-object (errno: 8) in E:\_dev\xampp\htdocs\ufrontsetup\bin\lib\thx\type\Rttis.class.php at line #136
error stack:
- haxe.xml.Fast.getName
- Xml:lambda_2.
- Xml:lambda_2.
- haxe.xml.Fast.getName
etc... stack trace.

Can anyone give a clue how to sort this out?

Jonas


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: First steps with Ufront - some 500 problems...

Franco Ponticelli
One more thing, I strongly suggest to avoid having copies of the libraries in your project. Some libraries for example might look for some conditional compilation done using the lib names (that is actually true for erazor). I suggest instead of installing using haxelib and if you want point the code to a local repository using "haxelib dev".

Franco

On Thu, Oct 27, 2011 at 3:29 PM, Franco Ponticelli <[hidden email]> wrote:
You are not very far from a working solution .... ufrontsetup error is generated because you are not working in the root of your web server but in a subdirectory. To fix that just add the following line to your code:

application.httpContext.addUrlFilter(new DirectoryUrlFilter("ufrontsetup"));

Where "ufrontsetup" is the subpath where your app is located ... the code should be something like this:

import ufront.web.AppConfiguration;
import ufront.web.mvc.MvcApplication;
import ufront.web.DirectoryUrlFilter;
import thx.util.Imports;

class Main 
{
static function main() 
{
Imports.pack("controller");
var config = new AppConfiguration("controller", false),
application = new MvcApplication(config);
application.httpContext.addUrlFilter(new DirectoryUrlFilter("ufrontsetup"));
application.execute();
}
}

Note that you don't need at all the controller Ufrontsetup. Also note that MvcApplication only adds some very basic routing paths (one for Home.index and one generic for any {controller}.{action}); I usually prefer to build my routes by hand and make them extremely specific.

Hope this helps,

Franco

2011/10/27 Jonas Nyström <[hidden email]>
Hi Franco and others!

Trying a basic Ufront setup with the instructions that I find at http://haxe.org/com/libs/ufront.

I've created a new FD4 project called "ufrontsetup" where I've downloaded the sourcecode for the needed libraries
(ufront, thx, hxevents, php/ufront/web) and put them in my scr folder. (Just to be able to keep an eye on them...)
Everything is reflected in a github project: https://github.com/cambiata/ufrontsetup if anyone's interested.

Modelled after the instructions at http://haxe.org/com/libs/ufront, my Main.hx class looks like this:
https://github.com/cambiata/ufrontsetup/blob/master/src/Main.hx

   package ;

   import php.Lib;
   import ufront.web.AppConfiguration;
   import ufront.web.mvc.MvcApplication;
   import controller.Home;
   import controller.Ufrontsetup;

   class Main
   {
      static function main()
       {
           trace('hello');
           var config = new AppConfiguration("controller", false);
           new MvcApplication(config).execute();
       }
   }

and the Home controller (controller/Home.hx) like this:
https://github.com/cambiata/ufrontsetup/blob/master/src/controller/Home.hx

   package controller;
   import ufront.web.mvc.Controller;
   class Home extends Controller
   {
      public function index() return "hello world!"
   }

Compiling works fine without errors, the browser opens as expected on http://localhost/ufrontsetup/bin/index.php,
but displays a 500 error message:

Error 500: Internal Server Error
unable to find a class for the controller 'ufrontsetup'

Obviously, Ufront is looking for a controller named "ufrontsetup"...
So, I create this one (controller/Ufrontsetup.hx)
https://github.com/cambiata/ufrontsetup/blob/master/src/controller/Ufrontsetup.hx

   package controller;
   import ufront.web.mvc.Controller;
   class Ufrontsetup extends Controller
   {
       public function index() return "hello world from Ufrontsetup!"
   }

Once again compiling without problem, but this time with the following error displayed in the browser:

Error 500: Internal Server Error
Trying to get property of non-object (errno: 8) in E:\_dev\xampp\htdocs\ufrontsetup\bin\lib\thx\type\Rttis.class.php at line #136
error stack:
- haxe.xml.Fast.getName
- Xml:lambda_2.
- Xml:lambda_2.
- haxe.xml.Fast.getName
etc... stack trace.

Can anyone give a clue how to sort this out?

Jonas


--
haXe - an open source web programming language
http://haxe.org



--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: First steps with Ufront - some 500 problems...

cambiata
Thank you, Franco!

Still 500 though.

I changed the project settings to include fresh haxelib installation, updated my Haxe to 2.08, removed Ufrontsetup controller, and changed my controller to this one:

        package ;
        import php.Lib;
        import ufront.web.AppConfiguration;
        import ufront.web.DirectoryUrlFilter;
        import ufront.web.mvc.MvcApplication;
        import thx.util.Imports;

        class Main {
                static function main() {
                        trace('hello');
                        Imports.pack("controller");
                        var config = new AppConfiguration("controller", false);
                        var application = new MvcApplication(config);
                        application.httpContext.addUrlFilter(new DirectoryUrlFilter("ufrontsetup"));
                        application.execute();
                }
        }

Compiles, but gives the following in the browser:

Error 500: Internal Server Error
unable to find a class for the controller 'bin'
error stack:
    ufront.web.routing.UrlRoutingModule.executeHttpHandler

Also tried with new DirectoryUrlFilter("ufrontsetup/bin"), but this gives a 500 error at Rttis.class.php at line #124...



Reply | Threaded
Open this post in threaded view
|

Re: First steps with Ufront - some 500 problems...

cambiata
Tried to move the compiled index.php file lib folder out the www root, and then it works!

:-)





Reply | Threaded
Open this post in threaded view
|

Re: First steps with Ufront - some 500 problems...

Franco Ponticelli
If you have to copy the files around is probably not the best environment. I suggest adding a virtual host or a directory alias that points directly to you bin folder.

Franco

On Thu, Oct 27, 2011 at 7:21 PM, cambiata <[hidden email]> wrote:
Tried to move the compiled index.php file lib folder out the www root, and
then it works!

:-)







--
View this message in context: http://haxe.1354130.n2.nabble.com/First-steps-with-Ufront-some-500-problems-tp6936133p6937480.html
Sent from the Haxe mailing list archive at Nabble.com.

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: First steps with Ufront - some 500 problems...

cambiata
Yep. Nevertheless, it would be great to sort out the details and alternatives on how to set up a server correctly regarding basic stuff installation like baseUrl, application.httpContext, .htaccess, pretty urls without index.php etc. But that might be a subject for another post...

Hopefully I will be able to spend some time learning Haxe using Ufront as one of my targets... And I will happily try to somehow document my experiences. (I just did my first humble correction of the http://haxe.org/com/libs/ufront page - Home.hx controller was incorrectly referenced as Controller.hx).
 
Talking about documentation: *If* I'll be able to do some contribution attempts, what form would you prefer, Franco? haxe.org wiki? Your code.google wiki? A github wiki somewhere? Some other form?
Reply | Threaded
Open this post in threaded view
|

Re: First steps with Ufront - some 500 problems...

Franco Ponticelli
Talking about documentation: *If* I'll be able to do some contribution
attempts, what form would you prefer, Franco? haxe.org wiki? Your
code.google wiki? A github wiki somewhere? Some other form?

I'd say the one where are you more comfortable ... right now, the important matter is to have documentation.

Thank you,

Franco

--
haXe - an open source web programming language
http://haxe.org