Announcement Announcement Module
Collapse
No announcement yet.
Are the samples supposed to be working? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Are the samples supposed to be working?

    I downloaded springpython-1.0.0.RELEASE along with the springpython-samples-1.0.0.RELEASE and have been unable to get to any of the webapps (petclinic, springirc and springwiki) to respond to web requests.

    In all cases, they look to actually be running, but I cannot connect to them. In the case of petclinic it looks like the Pyro stuff is running (I can telnet to the exported ports and something responds) but I cannot seem to get to the actual applications.

    I see that the samples say in all cases that they do not work with cherrypy3. However, if I run with cherrypy2-ish, the software will not run at all. If I try to run the apps with cherrypy2 it will die complaining about missing cherrypy.Tool. If I run against cherrypy3, the software loads up and looks like it is waiting for incoming connections.

    I am testing on Ubuntu 8.10.

  • #2
    Yes, the samples are supposed to work. If they are not, there is definite work to be done.

    We did upgrade the samples to work with CherryPy 3, and that means they don't run with CherryPy 2. If there is documentation stating it doesn't work with CherryPy 3, then that is some old documentation that must be updated.

    Can you go ahead and post some logs on this thread?

    I am not sure what version of CherryPy and other supporting libraries you are using. In fact, I don't know what version of python you are using. If you are using easy_install or ubuntu's packaging of python libraries, you might be at risk for using the wrong version, and having updates to your python environment happening you don't want. To guarantee getting it working, I would suggest using python's virtualenv tool to setup a separate python environment, and then installing the dependencies at https://fisheye.springsource.org/bro...A/dependencies.

    If you do all this, and it still doesn't work, maybe you could post some logs here for examination.

    Comment


    • #3
      I knew I would forget something...

      Code:
      (springpython)altern8@portishead:~/sp1/springpython-samples-1.0.0.RELEASE/springwiki$ python --version
      Python 2.5.2
      I found mention of CherryPy in both springpython-samples-1.0.0.RELEASE/springwiki/README and springpython-samples-1.0.0.RELEASE/petclinic/README.

      3. You need to have CherryPy 2 installed. We don't support CherryPy 3 yet.
      4. You need to have CherryPy 2 installed. We don't support CherryPy 3 yet. Again, see the
      petclinic.html page for more details about this, including installation on Ubuntu/Linux.
      * sudo apt-get install python-cherrypy (Ubuntu)
      I managed to fire up a virtual env for my environment. I think I did everything correctly? The Amara installation decided to install 4Suite-XML on its own. I tried it without installing 4Suite-XML on my own and then I installed the dependency version by hand when things didn't work. (Installing 4Suite-XML from direct download did not seem to change anything)

      It looks like both petclinic and springwiki are answering requests, but are failing immediately.

      Code:
      altern8@portishead:~/sp1/springpython-samples-1.0.0.RELEASE$ telnet localhost 8002
      Trying 127.0.0.1...
      Connected to localhost.
      Escape character is '^]'.
      HTTP/1.1 500 Internal Server Error
      Content-Length: 897
      Content-Type: text/plain
      
      Traceback (most recent call last):
        File "/home/altern8/venv/springpython/lib/python2.5/site-packages/cherrypy/wsgiserver/__init__.py", line 983, in communicate
          req.parse_request()
        File "/home/altern8/venv/springpython/lib/python2.5/site-packages/cherrypy/wsgiserver/__init__.py", line 304, in parse_request
          self._parse_request()
        File "/home/altern8/venv/springpython/lib/python2.5/site-packages/cherrypy/wsgiserver/__init__.py", line 317, in _parse_request
          request_line = self.rfile.readline()
        File "/home/altern8/venv/springpython/lib/python2.5/site-packages/cherrypy/wsgiserver/__init__.py", line 212, in readline
          data = self.rfile.readline(256)
        File "/home/altern8/venv/springpython/lib/python2.5/site-packages/cherrypy/wsgiserver/__init__.py", line 823, in readline
          nl = data.find('\n', 0, size)
      AttributeError: 'cStringIO.StringO' object has no attribute 'find'
      Connection closed by foreign host.
      Code:
      (springpython)altern8@portishead:~/venv/springpython$ telnet 127.0.0.1 8080
      HTTP/1.1 500 Internal Server Error
      Content-Length: 897
      Content-Type: text/plain
      
      Traceback (most recent call last):
        File "/home/altern8/venv/springpython/lib/python2.5/site-packages/cherrypy/wsgiserver/__init__.py", line 983, in communicate
          req.parse_request()
        File "/home/altern8/venv/springpython/lib/python2.5/site-packages/cherrypy/wsgiserver/__init__.py", line 304, in parse_request
          self._parse_request()
        File "/home/altern8/venv/springpython/lib/python2.5/site-packages/cherrypy/wsgiserver/__init__.py", line 317, in _parse_request
          request_line = self.rfile.readline()
        File "/home/altern8/venv/springpython/lib/python2.5/site-packages/cherrypy/wsgiserver/__init__.py", line 212, in readline
          data = self.rfile.readline(256)
        File "/home/altern8/venv/springpython/lib/python2.5/site-packages/cherrypy/wsgiserver/__init__.py", line 823, in readline
          nl = data.find('\n', 0, size)
      AttributeError: 'cStringIO.StringO' object has no attribute 'find'
      I also tried both with nc instead of telnet and that made no difference. Nothing shows up in the console when these errors happen, I just get the Traceback sent over the wire to the caller.

      So this is a step forward, but it looks like something is still broken. Should I include the logs? Anything I should do to enhance the log output?

      Comment


      • #4
        To enhance the logs, put this block of code some where in your main runnable, before any Spring Python code gets run. It should turn on debug statements for you.
        Code:
            logger = logging.getLogger("springpython")
            loggingLevel = logging.DEBUG
            logger.setLevel(loggingLevel)
            ch = logging.StreamHandler()
            ch.setLevel(loggingLevel)
            formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") 
            ch.setFormatter(formatter)
            logger.addHandler(ch)

        Comment


        • #5
          The whole log is way too long. Here is the top... this is like the first 50 lines of over 300 lines...

          Code:
          2009-11-24 05:43:44,531 - springpython.container.ObjectContainer - DEBUG - === Scanning configuration <noxml.PetClinicClientAndServer object at 0x955736c> for object definitions ===
          2009-11-24 05:43:44,531 - springpython.config.PythonConfig - DEBUG - ==============================================================
          2009-11-24 05:43:44,531 - springpython.config.PythonConfig - DEBUG - Parsing <noxml.PetClinicClientAndServer object at 0x955736c>
          2009-11-24 05:43:44,543 - springpython.config.PythonConfig - DEBUG - ==============================================================
          2009-11-24 05:43:44,543 - springpython.container.ObjectContainer - DEBUG - accessDecisionManager object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,543 - springpython.container.ObjectContainer - DEBUG - accessDeniedHandler object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,543 - springpython.container.ObjectContainer - DEBUG - authenticationManager object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,543 - springpython.container.ObjectContainer - DEBUG - authenticationProcessingFilter object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,544 - springpython.container.ObjectContainer - DEBUG - authenticationProcessingFilterEntryPoint object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,544 - springpython.container.ObjectContainer - DEBUG - cherrypySessionStrategy object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,544 - springpython.container.ObjectContainer - DEBUG - connectionFactory object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,544 - springpython.container.ObjectContainer - DEBUG - controller object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,544 - springpython.container.ObjectContainer - DEBUG - customerRoleVoter object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,545 - springpython.container.ObjectContainer - DEBUG - exceptionTranslationFilter object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,545 - springpython.container.ObjectContainer - DEBUG - filterChainProxy object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,545 - springpython.container.ObjectContainer - DEBUG - filterSecurityInterceptor object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,545 - springpython.container.ObjectContainer - DEBUG - httpContextFilter object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,545 - springpython.container.ObjectContainer - DEBUG - md5AuthenticationProvider object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,545 - springpython.container.ObjectContainer - DEBUG - md5Encoder object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,546 - springpython.container.ObjectContainer - DEBUG - md5UserDetailsService object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,546 - springpython.container.ObjectContainer - DEBUG - ownerVoter object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,546 - springpython.container.ObjectContainer - DEBUG - plainAuthenticationProvider object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,546 - springpython.container.ObjectContainer - DEBUG - plainEncoder object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,546 - springpython.container.ObjectContainer - DEBUG - redirectStrategy object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,546 - springpython.container.ObjectContainer - DEBUG - root object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,547 - springpython.container.ObjectContainer - DEBUG - shaAuthenticationProvider object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,547 - springpython.container.ObjectContainer - DEBUG - shaEncoder object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,547 - springpython.container.ObjectContainer - DEBUG - shaUserDetailsService object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,547 - springpython.container.ObjectContainer - DEBUG - userDetailsService object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,548 - springpython.container.ObjectContainer - DEBUG - userDetailsService2 object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,548 - springpython.container.ObjectContainer - DEBUG - userDetailsService3 object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,548 - springpython.container.ObjectContainer - DEBUG - vetRoleVoter object definition does not exist. Adding to list of definitions.
          2009-11-24 05:43:44,548 - springpython.container.ObjectContainer - DEBUG - === Done reading object definitions. ===
          2009-11-24 05:43:44,549 - springpython.context.ApplicationContext - DEBUG - Eagerly fetching authenticationManager
          2009-11-24 05:43:44,549 - springpython.context.ApplicationContext - DEBUG - Did NOT find object 'authenticationManager' in the singleton storage.
          2009-11-24 05:43:44,549 - springpython.context.ApplicationContext - DEBUG - Creating an instance of id=authenticationManager props=[] scope=scope.SINGLETON factory=PythonObjectFactory(<bound method PetClinicClientAndServer.authenticationManager of <noxml.PetClinicClientAndServer object at 0x955736c>>)
          2009-11-24 05:43:44,549 - springpython.factory.PythonObjectFactory - DEBUG - Creating an instance of authenticationManager
          2009-11-24 05:43:44,550 - springpython.config.objectSingleton<function authenticationManager at 0x954848c> - (<noxml.PetClinicClientAndServer object at 0x955736c>,)scope.SINGLETON - DEBUG - This IS the top-level object, calling authenticationManager().
          2009-11-24 05:43:44,550 - springpython.config.objectSingleton<function plainAuthenticationProvider at 0x9548294> - (<noxml.PetClinicClientAndServer object at 0x955736c>,)scope.SINGLETON - DEBUG - This is NOT the top-level object authenticationManager, deferring to container.
          2009-11-24 05:43:44,550 - springpython.config.objectSingleton<function plainAuthenticationProvider at 0x9548294> - (<noxml.PetClinicClientAndServer object at 0x955736c>,)scope.SINGLETON - DEBUG - Container = <springpython.context.ApplicationContext object at 0x95576cc>
          2009-11-24 05:43:44,550 - springpython.context.ApplicationContext - DEBUG - Did NOT find object 'plainAuthenticationProvider' in the singleton storage.
          2009-11-24 05:43:44,551 - springpython.context.ApplicationContext - DEBUG - Creating an instance of id=plainAuthenticationProvider props=[] scope=scope.SINGLETON factory=PythonObjectFactory(<bound method PetClinicClientAndServer.plainAuthenticationProvider of <noxml.PetClinicClientAndServer object at 0x955736c>>)
          2009-11-24 05:43:44,551 - springpython.factory.PythonObjectFactory - DEBUG - Creating an instance of plainAuthenticationProvider
          2009-11-24 05:43:44,551 - springpython.config.objectSingleton<function plainAuthenticationProvider at 0x9548294> - (<noxml.PetClinicClientAndServer object at 0x955736c>,)scope.SINGLETON - DEBUG - This IS the top-level object, calling plainAuthenticationProvider().
          2009-11-24 05:43:44,552 - springpython.config.objectSingleton<function userDetailsService at 0x9543d14> - (<noxml.PetClinicClientAndServer object at 0x955736c>,)scope.SINGLETON - DEBUG - This is NOT the top-level object plainAuthenticationProvider, deferring to container.
          2009-11-24 05:43:44,552 - springpython.config.objectSingleton<function userDetailsService at 0x9543d14> - (<noxml.PetClinicClientAndServer object at 0x955736c>,)scope.SINGLETON - DEBUG - Container = <springpython.context.ApplicationContext object at 0x95576cc>
          2009-11-24 05:43:44,552 - springpython.context.ApplicationContext - DEBUG - Did NOT find object 'userDetailsService' in the singleton storage.
          2009-11-24 05:43:44,552 - springpython.context.ApplicationContext - DEBUG - Creating an instance of id=userDetailsService props=[] scope=scope.SINGLETON factory=PythonObjectFactory(<bound method PetClinicClientAndServer.userDetailsService of <noxml.PetClinicClientAndServer object at 0x955736c>>)
          2009-11-24 05:43:44,553 - springpython.factory.PythonObjectFactory - DEBUG - Creating an instance of userDetailsService
          2009-11-24 05:43:44,553 - springpython.config.objectSingleton<function userDetailsService at 0x9543d14> - (<noxml.PetClinicClientAndServer object at 0x955736c>,)scope.SINGLETON - DEBUG - This IS the top-level object, calling userDetailsService().
          2009-11-24 05:43:44,587 - springpython.config.objectSingleton<function connectionFactory at 0x952fca4> - (<noxml.PetClinicClientAndServer object at 0x955736c>,)scope.SINGLETON - DEBUG - This is NOT the top-level object userDetailsService, deferring to container.
          2009-11-24 05:43:44,587 - springpython.config.objectSingleton<function connectionFactory at 0x952fca4> - (<noxml.PetClinicClientAndServer object at 0x955736c>,)scope.SINGLETON - DEBUG - Container = 
          ...

          Comment


          • #6
            The whole log is way too long.
            By that, I mean that there is like a 10k character limit.

            Comment


            • #7
              Okay, I built my own new copy of virtualenv with python2.5, loaded up everything from spring python 1.0.0-GA, and then start things up. My browser gave me this:
              Code:
              Traceback (most recent call last):
                File "/home/gregturn/sample/lib/python2.5/site-packages/cherrypy/wsgiserver/__init__.py", line 983, in communicate
                  req.parse_request()
                File "/home/gregturn/sample/lib/python2.5/site-packages/cherrypy/wsgiserver/__init__.py", line 304, in parse_request
                  self._parse_request()
                File "/home/gregturn/sample/lib/python2.5/site-packages/cherrypy/wsgiserver/__init__.py", line 317, in _parse_request
                  request_line = self.rfile.readline()
                File "/home/gregturn/sample/lib/python2.5/site-packages/cherrypy/wsgiserver/__init__.py", line 212, in readline
                  data = self.rfile.readline(256)
                File "/home/gregturn/sample/lib/python2.5/site-packages/cherrypy/wsgiserver/__init__.py", line 823, in readline
                  nl = data.find('\n', 0, size)
              AttributeError: 'cStringIO.StringO' object has no attribute 'find'
              Pretty bad! But at least its reproducible.

              Comment


              • #8
                This looks pretty embarassing. I found this thread documenting this known issue if you upgrade python2.5 beyond 2.5.2.

                Shows I haven't run the CherryPy stuff in a while.

                Comment


                • #9
                  Okay, upgrade CherryPy to 3.1.2, and everything works.

                  I should probably open a ticket to upgrade our dependencies.

                  Comment


                  • #10
                    Thanks for looking into this, Greg. If I am reading you correctly, it sounds like there is something with the sample applications that will not work with Python > 2.5. Is that correct? If so, would you say that if I were to start from scratch it would be safe to build an application for CherryPy with Spring Python?

                    I am very new to Python but I have used Spring for Java in the past. I am a little afraid to lock myself into something like Django so I thought I would look into projects like Snake Guice and Spring Python. I am just not sure how stable/solid either of these projects are going to be.

                    Not having a working example I can tinker with is making it difficult for me to come to that decision on my own. I get the feeling that Spring Python is a lot further along than Snake Guice and given my experience with Spring Python, it seems like it might be a good fit.

                    Are these forums the best place to discuss questions and problems with Spring Python or is there a more appropriate place? (like IRC, etc.) I am thinking my stack is going to consist of Spring Python, CherryPy and SQLAlchemy.

                    Comment


                    • #11
                      Originally posted by gregturn View Post
                      Okay, upgrade CherryPy to 3.1.2, and everything works.

                      I should probably open a ticket to upgrade our dependencies.
                      I upgraded to 3.1.2 and things seem to be looking better. However, it looks like the server is binding to 127.0.0.1:8080 and I am not sure how I can change that.

                      Code:
                      ...
                      [24/Nov/2009:07:17:28] ENGINE Started monitor thread 'Autoreloader'.
                      [24/Nov/2009:07:17:28] ENGINE Serving on 127.0.0.1:8080
                      [24/Nov/2009:07:17:28] ENGINE Bus STARTED
                      ...
                      I am running the sample application on a headless system and want to be able to access it from my desktop's browser. Can I configure this easily?

                      Comment


                      • #12
                        Originally posted by simensen View Post
                        Are these forums the best place to discuss questions and problems with Spring Python or is there a more appropriate place? (like IRC, etc.)
                        The forums is fine. There's also a mailing list http://springpython.webfactional.com/node/12 and the IRC channel, #springpython on Freenode network.

                        take care,

                        Comment


                        • #13
                          Originally posted by simensen View Post
                          Thanks for looking into this, Greg. If I am reading you correctly, it sounds like there is something with the sample applications that will not work with Python > 2.5. Is that correct? If so, would you say that if I were to start from scratch it would be safe to build an application for CherryPy with Spring Python?

                          I am very new to Python but I have used Spring for Java in the past. I am a little afraid to lock myself into something like Django so I thought I would look into projects like Snake Guice and Spring Python. I am just not sure how stable/solid either of these projects are going to be.

                          Not having a working example I can tinker with is making it difficult for me to come to that decision on my own. I get the feeling that Spring Python is a lot further along than Snake Guice and given my experience with Spring Python, it seems like it might be a good fit.

                          Are these forums the best place to discuss questions and problems with Spring Python or is there a more appropriate place? (like IRC, etc.) I am thinking my stack is going to consist of Spring Python, CherryPy and SQLAlchemy.
                          Yeah, it seems, to be specific, python 2.5.2+ breaks CherryPy 3.1.0. I didn't checkout python2.6. You need the more up-to-date version of CherryPy I posted earlier in this thread.

                          I can't speak to Snake Guice. Evaluate them as you wish. Heck, it may work with Spring Python nicely. Let me know!

                          Regarding where to discuss, yeah these forums are good. My current job doesn't let me use IRC, however Dariusz (the other committer to SP's code base) does.

                          Comment


                          • #14
                            Originally posted by simensen View Post
                            I upgraded to 3.1.2 and things seem to be looking better. However, it looks like the server is binding to 127.0.0.1:8080 and I am not sure how I can change that.

                            Code:
                            ...
                            [24/Nov/2009:07:17:28] ENGINE Started monitor thread 'Autoreloader'.
                            [24/Nov/2009:07:17:28] ENGINE Serving on 127.0.0.1:8080
                            [24/Nov/2009:07:17:28] ENGINE Bus STARTED
                            ...
                            I am running the sample application on a headless system and want to be able to access it from my desktop's browser. Can I configure this easily?
                            If you look in the part of the code that runs the actual CherryPy app, you will see something like this:

                            Code:
                                conf = {'/': 	{"tools.staticdir.root": os.getcwd(),
                                                     "tools.sessions.on": True,
                                                     "tools.filterChainProxy.on": True},
                                        "/images": 	{"tools.staticdir.on": True,
                                                     "tools.staticdir.dir": "images"},
                                        "/html": 	{"tools.staticdir.on": True,
                                                  	 "tools.staticdir.dir": "html"}
                                        }
                            You can override the IP address and port number used for hosting like this:

                            Code:
                                conf = {'/': 	{"server.socket_host": "<your IP address>",
                                                      "server.socket_port": <your port number>,
                                                      "tools.staticdir.root": os.getcwd(),
                                                      "tools.sessions.on": True,
                                                      "tools.filterChainProxy.on": True},
                                        "/images": 	{"tools.staticdir.on": True,
                                                     "tools.staticdir.dir": "images"},
                                        "/html": 	{"tools.staticdir.on": True,
                                                  	 "tools.staticdir.dir": "html"}
                                        }

                            Comment

                            Working...
                            X