Announcement Announcement Module
Collapse
No announcement yet.
Error on Spring Surf Tutorial Example Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error on Spring Surf Tutorial Example

    Hi,

    I just wanted to point out two errors on the sample on the Spring Surf Developer Tools Tutorial.

    On this page: http://www.springsurf.org/sites/1.0....ginning-step-8

    the file newsfeed.get.js line 17 should be:
    var re = /<[r|R][s|S]{2}/; // Is this really an RSS document?

    and the file newsfeed.get.html.ftl line 4 should be:
    <#if items?exists && (items?size > 0)>

    Also the Rss Feed is not returning the expected rss format, it will work better with other Rss Feeds like the one from bbc, substituting in newsfeed.get.js line 2
    var newsServiceUrl = "http://fxfeeds.mozilla.com/en-US/firefox/headlines.xml";

    Regards,

    Andres

  • #2
    This error should have been fixed in M3.

    Thanks!

    Yong

    Comment


    • #3
      Hi..
      I am following the same tutorial which you had posted here. Until the step 2.3.6, there is no issue...

      As you reported, I corrected those three issues..
      But still when I am trying with http://localhost:8080/surf/page/news/feed, I am getting error in the browser.

      Environment details:
      Os: Windows Xp
      SST version: 2.3.2
      roo version: 1.0.2

      The error in browser is:
      The Web Script /surf/page/news/feed has responded with a status of 500 - Internal Error.

      500 Description: An error inside the HTTP server which prevented it from fulfilling the request.

      Message: 07230002 Failed to load script 'org.springframework.extensions.webscripts.LocalFi leSystemStore$LocalFileSystemStoreScriptContent@54 570a': 07230001 TypeError: Cannot parse XML: Attribute name "x" associated with an element type "rss" must be followed by the ' = ' character. (C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\surf\/WEB-INF/webscripts/news/newsfeed.get.js#33)

      Exception: org.mozilla.javascript.EcmaError - TypeError: Cannot parse XML: Attribute name "x" associated with an element type "rss" must be followed by the ' = ' character. (C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\surf\/WEB-INF/webscripts/news/newsfeed.get.js#33)

      org.mozilla.javascript.ScriptRuntime.constructErro r(ScriptRuntime.java:3350)
      org.mozilla.javascript.ScriptRuntime.constructErro r(ScriptRuntime.java:3340)
      org.mozilla.javascript.ScriptRuntime.typeError(Scr iptRuntime.java:3356)
      org.mozilla.javascript.xmlimpl.XMLLibImpl.parse(XM LLibImpl.java:411)
      org.mozilla.javascript.xmlimpl.XMLLibImpl.ecmaToXm l(XMLLibImpl.java:433)
      org.mozilla.javascript.xmlimpl.XMLObjectImpl.ecmaT oXml(XMLObjectImpl.java:779)
      org.mozilla.javascript.xmlimpl.XML.jsConstructor(X ML.java:250)
      org.mozilla.javascript.xmlimpl.XMLObjectImpl.execI dCall(XMLObjectImpl.java:570)
      org.mozilla.javascript.IdFunctionObject.call(IdFun ctionObject.java:127)
      org.mozilla.javascript.BaseFunction.construct(Base Function.java:313)
      org.mozilla.javascript.ScriptRuntime.newObject(Scr iptRuntime.java:2132)
      org.mozilla.javascript.gen.c1._c0(C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\surf\/WEB-INF/webscripts/news/newsfeed.get.js:33)
      org.mozilla.javascript.gen.c1.call(C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\surf\/WEB-INF/webscripts/news/newsfeed.get.js)
      org.mozilla.javascript.ContextFactory.doTopCall(Co ntextFactory.java:393)
      org.mozilla.javascript.ScriptRuntime.doTopCall(Scr iptRuntime.java:2834)
      org.mozilla.javascript.gen.c1.call(C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\surf\/WEB-INF/webscripts/news/newsfeed.get.js)
      org.mozilla.javascript.gen.c1.exec(C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\surf\/WEB-INF/webscripts/news/newsfeed.get.js)
      org.springframework.extensions.webscripts.processo r.JSScriptProcessor.executeScriptImpl(JSScriptProc essor.java:292)
      org.springframework.extensions.webscripts.processo r.JSScriptProcessor.executeScript(JSScriptProcesso r.java:178)
      org.springframework.extensions.webscripts.Abstract WebScript.executeScript(AbstractWebScript.java:878 )
      org.springframework.extensions.webscripts.Declarat iveWebScript.execute(DeclarativeWebScript.java:84)
      org.springframework.extensions.webscripts.Presenta tionContainer.executeScript(PresentationContainer. java:59)
      org.springframework.extensions.webscripts.LocalWeb ScriptRuntimeContainer.executeScript(LocalWebScrip tRuntimeContainer.java:180)
      org.springframework.extensions.webscripts.Abstract Runtime.executeScript(AbstractRuntime.java:307)
      org.springframework.extensions.webscripts.Abstract Runtime.executeScript(AbstractRuntime.java:178)
      org.springframework.extensions.webscripts.servlet. mvc.WebScriptView.renderMergedOutputModel(WebScrip tView.java:95)
      org.springframework.web.servlet.view.AbstractView. render(AbstractView.java:250)
      org.springframework.web.servlet.DispatcherServlet. render(DispatcherServlet.java:1060)
      org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:798)
      org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:716)
      org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:647)
      org.springframework.web.servlet.FrameworkServlet.d oGet(FrameworkServlet.java:552)
      javax.servlet.http.HttpServlet.service(HttpServlet .java:617)
      javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
      org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:290)
      org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:206)
      org.apache.catalina.core.ApplicationDispatcher.inv oke(ApplicationDispatcher.java:630)
      org.apache.catalina.core.ApplicationDispatcher.pro cessRequest(ApplicationDispatcher.java:436)
      org.apache.catalina.core.ApplicationDispatcher.doF orward(ApplicationDispatcher.java:374)
      org.apache.catalina.core.ApplicationDispatcher.for ward(ApplicationDispatcher.java:302)
      org.tuckey.web.filters.urlrewrite.NormalRewrittenU rl.doRewrite(NormalRewrittenUrl.java:195)
      org.tuckey.web.filters.urlrewrite.RuleChain.handle Rewrite(RuleChain.java:159)
      org.tuckey.web.filters.urlrewrite.RuleChain.doRule s(RuleChain.java:141)
      org.tuckey.web.filters.urlrewrite.UrlRewriter.proc essRequest(UrlRewriter.java:90)
      org.tuckey.web.filters.urlrewrite.UrlRewriteFilter .doFilter(UrlRewriteFilter.java:417)
      org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:235)
      org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:206)
      org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:233)
      org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:191)
      org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:128)
      org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:102)
      org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
      org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:286)
      org.apache.coyote.http11.Http11AprProcessor.proces s(Http11AprProcessor.java:857)
      org.apache.coyote.http11.Http11AprProtocol$Http11C onnectionHandler.process(Http11AprProtocol.java:56 5)
      org.apache.tomcat.util.net.AprEndpoint$Worker.run( AprEndpoint.java:1509)
      java.lang.Thread.run(Unknown Source)

      Exception: org.springframework.extensions.webscripts.WebScrip tException - 07230001 TypeError: Cannot parse XML: Attribute name "x" associated with an element type "rss" must be followed by the ' = ' character. (C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\surf\/WEB-INF/webscripts/news/newsfeed.get.js#33)

      org.springframework.extensions.webscripts.processo r.JSScriptProcessor.executeScriptImpl(JSScriptProc essor.java:302)

      Exception: org.springframework.extensions.webscripts.WebScrip tException - 07230002 Failed to load script 'org.springframework.extensions.webscripts.LocalFi leSystemStore$LocalFileSystemStoreScriptContent@54 570a': 07230001 TypeError: Cannot parse XML: Attribute name "x" associated with an element type "rss" must be followed by the ' = ' character. (C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\surf\/WEB-INF/webscripts/news/newsfeed.get.js#33)

      org.springframework.extensions.webscripts.processo r.JSScriptProcessor.executeScript(JSScriptProcesso r.java:182)

      Server: Alfresco <unknown> v<unknown> schema -1
      Time: Aug 23, 2010 6:37:39 PM

      Diagnostics: Inspect Web Script (webscripts/news/newsfeed.get)



      Can anyone kindly suggest me whats the problem is???
      Thanks in advance.....
      Last edited by kamal_1; Aug 23rd, 2010, 08:35 AM.

      Comment


      • #4
        Did you use the JS template here from its download link?

        http://www.springsurf.org/sites/1.0....ewsfeed.get.js

        Yong

        Comment


        • #5
          Thanks for your quick response...


          even after having the js file which you have said, I am getting the same error..
          Is there any issue with the html file.

          I am having
          <div class="dashlet">
          <div class="title" > ${title}</div>
          <div class="body scrollableList">
          <#if items?exists && (items?size > 0)>
          <#list items as item>
          <div style="clear:both;"><a href="item.link">${item.title}</a></div>
          <div style="clear:both;">${item.description}</div>
          </#list>
          </#if>
          </div><#-- end of body -->
          </div><#-- end of dashlet -->



          But I think, this js is not retrieving the correct feeds...

          Comment


          • #6
            Hi,

            I just created a clean Surf web app and added the newsfeed webscript from the download links. And then started jetty and open browser and test following link

            http://localhost:8180/service/news/feed

            It works as expected.

            The error is from your JS template so it has nothing to do with the freemarker template.

            Yong

            Comment


            • #7
              Hi..
              You are running the application in jetty server..
              I am using tomcat to run the application. I can view my surf sample page in http://localhost:8080/community/

              I am following http://www.springsurf.org/sites/1.0....beginning.html

              As you said I had changed my js file and now I am getting some new error in browser. When I tried with jetty server, the same below error is displayed.

              Exception

              javax.servlet.ServletException: Could not resolve view with name 'news/feed' in servlet with name 'Spring Surf Dispatcher Servlet'
              org.springframework.web.servlet.DispatcherServlet. render(DispatcherServlet.java:1042)
              org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:798)
              org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:716)
              org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:647)
              org.springframework.web.servlet.FrameworkServlet.d oGet(FrameworkServlet.java:552)
              javax.servlet.http.HttpServlet.service(HttpServlet .java:617)
              javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
              org.tuckey.web.filters.urlrewrite.NormalRewrittenU rl.doRewrite(NormalRewrittenUrl.java:195)
              org.tuckey.web.filters.urlrewrite.RuleChain.handle Rewrite(RuleChain.java:159)
              org.tuckey.web.filters.urlrewrite.RuleChain.doRule s(RuleChain.java:141)
              org.tuckey.web.filters.urlrewrite.UrlRewriter.proc essRequest(UrlRewriter.java:90)
              org.tuckey.web.filters.urlrewrite.UrlRewriteFilter .doFilter(UrlRewriteFilter.java:417)


              Can you say whats the reason for this new error?
              Last edited by kamal_1; Aug 24th, 2010, 12:41 AM.

              Comment


              • #8
                Hi,

                It looks like you are using M2. Please use M3.

                Yong

                Comment


                • #9
                  Hi..
                  Thanks...
                  When I am using 1.0.0.CI-SNAPSHOT, I am not getting the above error. Can I know what is the difference between these M2, M3 and 1.0.0.CI-SNAPSHOT addons..

                  Thanks...

                  Comment


                  • #10
                    From the link you posted, it seems like you are following M2 Tutorial.

                    You should follow following link

                    http://www.springsurf.org/sites/1.0....tml/index.html

                    I have tested Surf M3 on STS 2.3.2 and I tested it on Spring TC server (Tomcat). It seems to work fine.

                    The only extra thing I did is touching the urlrewirte.xml (Just added a space and saved it).

                    For now, please use M3.
                    Yong

                    Comment


                    • #11
                      Thanks for your information yong....

                      Comment


                      • #12
                        For that urlrewrite.xml issue, all you need to do is

                        Fix: Preferences -> General -> Network Connections -> Cache and remove the cached DTD, then rebuild the project.

                        Yong

                        Comment


                        • #13
                          My environment:
                          - Roo 1.0.2.RELEASE
                          - Spring Surf Roo Addion 1.0.0.M3

                          I manually changed the Jetty port in the pom.xml to 8081 since I need Tomcat to serve Alfresco on port 8080.

                          I think there may be a problem with the URL published here:

                          Chapter 2, Section 1.3:
                          Once the Jetty server is started, we are ready to visit our new Surf application at http://localhost:8180/.

                          The above is definitely incorrect (unless the ROOT context is being used and Jetty is started on port 8180 by default), IMO it should be:
                          http://localhost:8080/community

                          However, I don't seem to get this URL to work. For me Jetty returns the following message:
                          HTTP ERROR: 500
                          Could not resolve view with name '' in servlet with name 'Spring Surf Dispatcher Servlet'
                          RequestURI=/community/

                          However, I do get the console page:
                          http://localhost:8081/community/console

                          All I have done so far are run the following roo commands:

                          project --topLevelPackage com.mycompany.community
                          surf install

                          and modified the pom.xml to use jetty.port=8081 instead of default 8080.

                          Any pointers would be appreciated. Not sure if I am using a wrong URL or there is something I need to do to one of the files to get this to work.

                          I see that others have gone further down the tutorial than I have, so hopefully you have seen this problem and know of a fix.

                          Thanks very much,
                          Sujit

                          Comment


                          • #14
                            Hi,,,
                            I also found the same issue. My alfresco was running in the port 8080 and I managed to have another tomcat to run on the port 8081 FOR MY SPRING SURF.

                            Then I thought to deploy this by having a small change in the pom.xml file as:
                            <plugin>
                            <groupId>org.codehaus.mojo</groupId>
                            <artifactId>tomcat-maven-plugin</artifactId>
                            <version>1.0-beta-1</version>
                            <configuration>
                            <url>http://localhost:8081/manager/html</url>
                            </configuration>

                            </plugin>

                            Comment


                            • #15
                              Thanks kamal_1, so it looks like some dependency on Tomcat (perhaps some default configuration that is not present in Jetty?). I will try out your suggestion.

                              Comment

                              Working...
                              X