2 Replies Latest reply on Apr 20, 2009 6:36 AM by locrianmode

    Wicket, WicketComponent

    locrianmode

      Hi,


      I am getting an error in my Seam/Wicket application.



      public class TimesheetApplication extends SeamWebApplication {
      
      .
      .
      .
      
      
          @Override
          public RequestCycle newRequestCycle(final Request request, final Response response) {
              return new SeamWebRequestCycle(this, (WebRequest) request, (WebResponse) response) {
      
                  @Override
                  public Page onRuntimeException(Page page, RuntimeException e) {
                      return new CustomeExceptionPage(e);
                  }
      
              };
          }
      }





      I will get the errors if I try override methods in the SeamWebRequestCycle, even just putting an empty curly brackets gives the error


      @Override
          public RequestCycle newRequestCycle(final Request request, final Response response) {
              return new SeamWebRequestCycle(this, (WebRequest) request, (WebResponse) response) 
              {}; // <--------
      }





      |SEVERE: Servlet.service() for servlet jsp threw exception
      java.lang.NullPointerException
              at org.jboss.seam.wicket.WicketComponent.<init>(WicketComponent.java:171)
              at com.smoe.timesheet.web.wicket.TimesheetApplication$1.<clinit>(TimesheetApplication.java)
              at com.smoe.timesheet.web.wicket.TimesheetApplication.newRequestCycle100(TimesheetApplication.java:43)
              at com.smoe.timesheet.web.wicket.TimesheetApplication.newRequestCycle(TimesheetApplication.java)
              at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:351)
              at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:201)
              at org.jboss.seam.web.WicketFilter.doFilter(WicketFilter.java:132)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
      |





      Everything is fine if I just do this ...



      @Override
          public RequestCycle newRequestCycle(final Request request, final Response response) {
              return new SeamWebRequestCycle(this, (WebRequest) request, (WebResponse) response);
      }



      Any pointers? Thanks.

        • 1. Re: Wicket, WicketComponent
          cpopetz

          It looks like your anonymous inner classes of your WebApplication subclass are being instrumented, which you do not want.  You need to exclude those classes from ending up in WEB-INF/wicket (or if you are using build-time instrumentation from the trunk, you need to exclude them in ant or maven.)


          -Clint


          • 2. Re: Wicket, WicketComponent
            locrianmode

            Thanks Clint. Things are progressing a bit now :)


            BTW, for those starting out using maven for your Seam/Wicket project, here's how I configure mine.


            Check out an build the seam-instrument-wicket maven plugin from http://anonsvn.jboss.org/repos/seam/ (under maven-plugins/trunk).
            Then you can use it in your maven project.


                    <plugins>
                        <plugin>
                            <executions>
                                <execution>
                                    <goals>
                                        <goal>instrument</goal>
                                    </goals>
                                    <phase>compile</phase>
                                </execution>
                            </executions>
                            <groupId>org.jboss.seam</groupId>
                            <artifactId>seam-instrument-wicket</artifactId>
                            <version>2.1.2-SNAPSHOT</version>
                            <configuration>
                                <scanAnnotations>false</scanAnnotations>
                                <includes>
                                    <!-- include packages that need to be instrumented -->
                                    <include>com.x.y.web.wicket.page.*</include>
                                    <include>com.x.y.web.wicket.panel.*</include>
                                </includes>
                            </configuration>
                            <dependencies>
                                <dependency>
                                    <!-- jars that your instrumented classes need -->
                                    <groupId>javax.persistence</groupId>
                                    <artifactId>persistence-api</artifactId>
                                    <version>1.0</version>
                                </dependency>
                            </dependencies>
                        </plugin>
            
                 .
                 .
                 .
                 </plugins>
            



            - Iskandar