Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: scaffolding not working as expected

  1. #1
    Join Date
    Jun 2008
    Location
    Jacksonville, Florida
    Posts
    147

    Default 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. #2
    Join Date
    Jun 2008
    Location
    Jacksonville, Florida
    Posts
    147

    Default 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?

  3. #3
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    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

  4. #4
    Join Date
    Jun 2008
    Location
    Jacksonville, Florida
    Posts
    147

    Default

    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.

  5. #5
    Join Date
    Jun 2008
    Location
    Jacksonville, Florida
    Posts
    147

    Default

    corrections:

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

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

  6. #6
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    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

  7. #7
    Join Date
    Jun 2008
    Location
    Jacksonville, Florida
    Posts
    147

    Default

    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?

  8. #8
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    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

  9. #9
    Join Date
    Jun 2008
    Location
    Jacksonville, Florida
    Posts
    147

    Default

    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.

  10. #10
    Join Date
    Jun 2008
    Location
    Jacksonville, Florida
    Posts
    147

    Default

    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 ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •