Announcement Announcement Module
Collapse
No announcement yet.
scaffolding not working as expected Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • scaffolding not working as expected

    I am having trouble with the roo scaffolding. I created my entities and configured the datasource in the persistence.xml and the database.properties. Then I used the controller all provided by roo.
    Then I updated the entities.
    Roo looks like it updated the scaffolding but When I tried to run it in eclipse for the first time, I got the the stack trace below. I checked the src/main/webapp/WEB-INF/tags directory and the files definitely are there so I am a little confused about what could be causing this.

    Stacktrace:
    SEVERE: Servlet.service() for servlet jsp threw exception
    org.apache.jasper.JasperException: File "/WEB-INF/tags/language.tagx" not found
    at org.apache.jasper.compiler.DefaultErrorHandler.jsp Error(DefaultErrorHandler.java:51)
    at org.apache.jasper.compiler.ErrorDispatcher.dispatc h(ErrorDispatcher.java:409)
    at org.apache.jasper.compiler.ErrorDispatcher.jspErro r(ErrorDispatcher.java:116)
    at org.apache.jasper.compiler.JspUtil.getInputStream( JspUtil.java:849)
    at
    <Abriviated for length>
    ... 33 more
    Caused by: java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.layouts.default_jspx
    at java.net.URLClassLoader$1.run(URLClassLoader.java: 200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.j ava:188)
    at org.apache.jasper.servlet.JasperLoader.loadClass(J asperLoader.java:134)
    at org.apache.jasper.servlet.JasperLoader.loadClass(J asperLoader.java:66)
    at org.apache.jasper.JspCompilationContext.load(JspCo mpilationContext.java:618)
    ... 45 more

  • #2
    hint

    OK after digging some more and hacking on the scaffolding I found the source of the problem but I don't yet know the solution. The roo tag files are not being found.

    My html markup begins as such:
    <html
    xmlns:jsp="http://java.sun.com/JSP/Page"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    xmlns:tiles="http://tiles.apache.org/tags-tiles"
    xmlns:form="http://www.springframework.org/tags/form"
    xmlns:spring="http://www.springframework.org/tags"
    xmlns:roo="urn:jsptagdir:/WEB-INF/tags" >
    ...
    <roo:language />
    <roo:theme />
    ...

    No page in the scaffolding works if it depends on the roo tags. If I comment out all tags with the roo namespace, everything works fine. Are there any ideas how to fix this?

    Comment


    • #3
      Hi,

      Roo will copy its tags (currently three: pagination.tagx, language.tagx and theme.tagx into src/main/webapp/WEB-INF/tags when the first controller is created. Somehow this did not happen for you.

      To get some more information on this can you share what exactly you did? For example you could share the script (commands) that you issued when creating the project. Also, did you start your application with a previous version of roo and just recently 'upgraded' to a newer version? Any details to get this resolved are appreciated.

      Cheers,
      -Stefan

      Comment


      • #4
        Actually the tagx files are there. For some reason they just aren't being found. I tried it with a brand new project on a different os and here are the steps to reproduce. Using roo 1.0.0.RC2 [rev 321] :

        roo> project --topLevelPackage p1
        roo> persistence setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY
        roo> entity --name ~.domain.Ent1
        roo> field string fld1
        roo> field string fld2
        roo> field string fld3
        roo> controller all --package
        roo> quit
        #> mvn eclipse:eclipse

        import the existing project then add the project to a tomcat server (6.0.20) and start it
        navigate to http://localhost:8080/test/
        and you should see:
        type Exception report

        message

        description The server encountered an internal error () that prevented it from fulfilling this request.

        exception

        org.apache.tiles.impl.CannotRenderException: ServletException including path '/WEB-INF/layouts/default.jspx'.
        org.apache.tiles.impl.BasicTilesContainer.render(B asicTilesContainer.java:691)
        org.apache.tiles.impl.BasicTilesContainer.render(B asicTilesContainer.java:643)
        org.apache.tiles.impl.BasicTilesContainer.render(B asicTilesContainer.java:626)
        org.apache.tiles.impl.BasicTilesContainer.render(B asicTilesContainer.java:322)
        org.springframework.web.servlet.view.tiles2.TilesV iew.renderMergedOutputModel(TilesView.java:100)
        org.springframework.web.servlet.view.AbstractView. render(AbstractView.java:250)
        org.springframework.web.servlet.DispatcherServlet. render(DispatcherServlet.java:1072)
        org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:808)
        org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:726)
        org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:636)
        org.springframework.web.servlet.FrameworkServlet.d oGet(FrameworkServlet.java:545)
        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)
        org.springframework.web.filter.HiddenHttpMethodFil ter.doFilterInternal(HiddenHttpMethodFilter.java:7 1)
        org.springframework.web.filter.OncePerRequestFilte r.doFilter(OncePerRequestFilter.java:76)
        org.springframework.web.filter.CharacterEncodingFi lter.doFilterInternal(CharacterEncodingFilter.java :88)
        org.springframework.web.filter.OncePerRequestFilte r.doFilter(OncePerRequestFilter.java:76)
        org.springframework.web.filter.ShallowEtagHeaderFi lter.doFilterInternal(ShallowEtagHeaderFilter.java :57)
        org.springframework.web.filter.OncePerRequestFilte r.doFilter(OncePerRequestFilter.java:76)
        org.springframework.orm.jpa.support.OpenEntityMana gerInViewFilter.doFilterInternal(OpenEntityManager InViewFilter.java:113)
        org.springframework.web.filter.OncePerRequestFilte r.doFilter(OncePerRequestFilter.java:76)

        root cause

        org.apache.tiles.util.TilesIOException: ServletException including path '/WEB-INF/layouts/default.jspx'.
        org.apache.tiles.servlet.context.ServletUtil.wrapS ervletException(ServletUtil.java:232)

        the tagx files and jspx files are where they should be but tomcat is still complaining.

        Comment


        • #5
          corrections:

          the url should be
          http://localhost:8080/p1

          the controller scaffolding should be
          roo> controller all --package ~.controller

          Comment


          • #6
            Thanks for providing the script. It looks pretty basic and I have just run this on my machine with Roo RC2 and had no problems at all.

            What concerns me is the TilesIOException which indicates that tiles can actually not read the template and possibly other resources. Can you please check file permissions of all artifacts in your project? Also, is there any chance that you are running out of disk space? It appears this is a problem with your file system rather than a Roo application bug... What OS are you running?

            Sorry I cannot be of more help but it is hard to help with a problem that cannot be reproduced .

            Cheers,
            Stefan

            Comment


            • #7
              disk space issues on 2 separate machines? I don't think so. I am wondering about classpath issues. How does tiles locate the tagx files? via the classpath? Can you post your dependencies/versions?

              Comment


              • #8
                Tiles does not deal directly with tag libraries. They are included via standard jsp includes:

                Code:
                xmlns:roo="urn:jsptagdir:/WEB-INF/tags"
                It just happens that these tags are included in the tiles default template.

                I have tiles 2.1.3 and JSP taglibs 1.1.2 in my classpath, just as defined in the projects pom.xml. We should definitely both have the same classpath given that Roo RC2 should produce the exact same pom for our projects... So unless something went wrong when maven downloaded the dependencies (maybe an incomplete / corrupted dependency?). Would it be possible for you to delete (backup beforehand) your .m2 directory so you can trigger an fresh download of the dependencies? Use mvn tomcat:run which should take care of pulling in all dependencies and starting your server.

                Cheers,
                Stefan

                Comment


                • #9
                  I ran it via mvn jetty:run and it worked fine. I ran it via mvn tomcat:run and it just hangs after
                  [INFO] Scanning for projects...
                  [INFO] ------------------------------------------------------------------------
                  [INFO] Building p1
                  [INFO] task-segment: [tomcat:run]
                  [INFO] ------------------------------------------------------------------------
                  [INFO] Preparing tomcat:run
                  [INFO] [aspectj:compile {execution: default}]
                  [INFO] [resources:resources]
                  [INFO] Using default encoding to copy filtered resources.
                  [INFO] [compiler:compile]
                  [INFO] Nothing to compile - all classes are up to date
                  [INFO] [tomcat:run]
                  [INFO] Creating Tomcat server configuration at /home/solid/src/java/appengine/p1/target/tomcat
                  [INFO] Starting tomcat server
                  [INFO] Starting Servlet Engine: Apache Tomcat/5.5.15
                  [INFO] XML validation disabled
                  [INFO] Initializing Spring root WebApplicationContext
                  log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
                  log4j:WARN Please initialize the log4j system properly.
                  [INFO] org.tuckey.web.filters.urlrewrite.UrlRewriteFilter INFO: loaded (conf ok)
                  [INFO] Initializing Coyote HTTP/1.1 on http-8080
                  [INFO] Starting Coyote HTTP/1.1 on http-8080

                  It has been hanging here for about 5 minutes. it Is not responding to web requests either.

                  Comment


                  • #10
                    I deleted my m2 repo and re-eclipsed the project so that it would force a download all the dependencies fresh.
                    Same results.

                    Could it be that the spring repo is messed up and you are using an older (working) copy of some jar? Could you try the same process. backup the m2 repo and reclipse the project to run inside eclipse's tomcat ?

                    Comment


                    • #11
                      jetty works

                      I have resorted to using the jetty server adapter for eclipse-wtp. It is working. It should be noted that I am using the vanillla tomcat 6.0.20 from apache to produce the errors listed. It appears to be something related to the roo namespace declaration in the main template. I don't know why that would not be working but it is definitely reproducable with tomcat in eclipse.
                      Stefan/Ben is there anything I can send you to help you see what I am seeing?

                      Comment


                      • #12
                        Sorry you have so much trouble with Tomcat in your application. I have just tried it again twice (once on Mac OSX and once in a brand-new Ubuntu 9.10 VM) and both worked just fine. I used Sun JDK 1.6.

                        Also I am not aware of other users facing this problem, so I have to assume that the problem is related to your environment. Can you please let me know which Java and OS you are running? Also does this happen with all the sample scripts that Roo ships (clinic.roo, wedding.roo and vote.roo). If you just run the script in a new directory, and then run 'mvn tomcat:run' (no eclipse) - does it still fail?

                        Cheers,
                        Stefan

                        Comment


                        • #13
                          no worries. Pioneers take the arrows, right? I'm just glad you are working through it with me.
                          I started tomcat at 17:32 EST
                          It is now 17:38 and tomcat is still not up. here is what is output at the console:

                          alter table visit add constraint FK6B04D4B6B108014 foreign key (pet) references pet
                          alter table visit add constraint FK6B04D4B6B10AD20 foreign key (vet) references abstract_person
                          schema export complete
                          Checking 0 named HQL queries
                          Checking 0 named SQL queries
                          Finished creating instance of bean 'entityManagerFactory'
                          Invoking afterPropertiesSet() on bean with name 'transactionManager'
                          Finished creating instance of bean 'transactionManager'
                          Creating shared instance of singleton bean 'org.springframework.transaction.config.internalTr ansactionAspect'
                          Creating instance of bean 'org.springframework.transaction.config.internalTr ansactionAspect'
                          Eagerly caching bean 'org.springframework.transaction.config.internalTr ansactionAspect' to allow for resolving potential
                          circular references
                          Invoking afterPropertiesSet() on bean with name 'org.springframework.transaction.config.internalTr ansactionAspect'
                          Finished creating instance of bean 'org.springframework.transaction.config.internalTr ansactionAspect'
                          Returning cached instance of singleton bean 'entityManagerFactory'
                          Published root WebApplicationContext as ServletContext attribute with name [org.springframework.web.context.WebApplicati
                          onContext.ROOT]
                          Root WebApplicationContext: initialization completed in 5703 ms
                          Initializing filter 'Spring OpenEntityManagerInViewFilter'
                          Filter 'Spring OpenEntityManagerInViewFilter' configured successfully
                          Initializing filter 'CharacterEncodingFilter'
                          Filter 'CharacterEncodingFilter' configured successfully
                          Initializing filter 'etagFilter'
                          Filter 'etagFilter' configured successfully
                          Initializing filter 'httpMethodFilter'
                          Filter 'httpMethodFilter' configured successfully
                          [INFO] org.tuckey.web.filters.urlrewrite.UrlRewriteFilter INFO: loaded (conf ok)
                          [INFO] Initializing Coyote HTTP/1.1 on http-8080
                          [INFO] Starting Coyote HTTP/1.1 on http-8080

                          Comment


                          • #14
                            btw I am I used the clinic.roo script.

                            Comment


                            • #15
                              java: java version "1.6.0_13"
                              Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
                              Java HotSpot(TM) Client VM (build 11.3-b02, mixed mode, sharing)

                              OS: Win XP SP2 (but I have also experienced the same behavior on gentoo.)

                              Comment

                              Working...
                              X