2 Replies Latest reply on Feb 10, 2010 1:04 PM by Asif Sehzaad

    error reading Error reading 'userName' on type org.jboss.seam.example.User

    Asif Sehzaad Newbie

      I am trying to learn seam. I have gone through the Seam Documentation 2.2.0.GA (Not entirely).


      I am a maven person and have the following.


      pom.xml


      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>bbseam</groupId>
        <artifactId>bbseam</artifactId>
        <packaging>war</packaging>
        <version>1.0</version>
        <name>bbseam JEE5 Webapp</name>
        <url>http://maven.apache.org</url>
        <dependencies>
      
          <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
          </dependency>
      
          <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
            <scope>provided</scope>
          </dependency>
      
          <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>5.9</version>
            <scope>test</scope>
          </dependency>
          <dependency>
            <groupId>javax.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>1.2</version>
          </dependency>
          <dependency>
            <groupId>javax.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>1.2</version>
          </dependency>
          <dependency>
            <groupId>com.sun.facelets</groupId>
            <artifactId>jsf-facelets</artifactId>
            <version>1.1.15.B1</version>
          </dependency>
          <dependency>
            <groupId>org.jboss.seam</groupId>
            <artifactId>jboss-seam</artifactId>
            <version>2.2.0.GA</version>
              <exclusions>
                  <exclusion>
                      <groupId>javax.el</groupId>
                      <artifactId>el-api</artifactId>
                  </exclusion>
              </exclusions>
          </dependency>
          <dependency>
            <groupId>org.jboss.seam</groupId>
            <artifactId>jboss-seam-ui</artifactId>
            <version>2.2.0.GA</version>
              <exclusions>
                  <exclusion>
                      <groupId>javax.el</groupId>
                      <artifactId>el-api</artifactId>
                  </exclusion>
              </exclusions>
          </dependency>
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-entitymanager</artifactId>
                <version>3.4.0.GA</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-validator</artifactId>
                <version>3.1.0.GA</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>javassist</groupId>
                <artifactId>javassist</artifactId>
                <version>3.8.0.GA</version>
            </dependency>
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>jstl</artifactId>
                <version>1.2</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-jdk14</artifactId>
                <version>1.5.8</version>
            </dependency>
            <dependency>
                <groupId>org.jboss</groupId>
                <artifactId>jboss-common-core</artifactId>
                <version>2.2.17.GA</version>
            </dependency>
        </dependencies>
        <build>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-compiler-plugin</artifactId>
              <version>2.0.2</version>
              <configuration>
                <source>1.5</source>
                <target>1.5</target>
              </configuration>
            </plugin>
          </plugins>
          <finalName>bbseam</finalName>
        </build>
      </project>
      



      Files in My Project


      C:.
      │   bbseam.iml
      │   bbseam.ipr
      │   bbseam.iws
      │   pom.xml
      │
      └───src
          ├───main
          │   ├───java
          │   │   └───org
          │   │       └───jboss
          │   │           └───seam
          │   │               └───example
          │   │                       User.java
          │   │                       UserAction.java
          │   │
          │   ├───resources
          │   │   │   log4j.xml
          │   │   │   seam.properties
          │   │   │
          │   │   └───META-INF
          │   │           persistence.xml
          │   │
          │   └───webapp
          │       │   already.xhtml
          │       │   hello.xhtml
          │       │   index.xhtml
          │       │
          │       ├───META-INF
          │       │       context.xml
          │       │       MANIFEST.MF
          │       │
          │       └───WEB-INF
          │               components.xml
          │               faces-config.xml
          │               web.xml
          │
          └───test
              └───java
                  └───bbseam



      Exception I am getting.



      javax.faces.FacesException: javax.el.ELException: /index.xhtml @16,62 value="#{user.userName}": Error reading 'userName' on type org.jboss.seam.example.User
           at javax.faces.component.UIOutput.getValue(UIOutput.java:179)
           at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:100)
           at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:282)
           at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:208)
           at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:847)
           at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:241)
           at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:270)
           at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:827)
           at org.jboss.seam.ui.util.cdk.RendererBase.renderChild(RendererBase.java:186)
           at org.jboss.seam.ui.util.cdk.RendererBase.renderChildren(RendererBase.java:166)
           at org.jboss.seam.ui.renderkit.ValidateAllRendererBase.doEncodeChildren(ValidateAllRendererBase.java:33)
           at org.jboss.seam.ui.util.cdk.RendererBase.encodeChildren(RendererBase.java:92)
           at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:827)
           at javax.faces.component.UIComponent.encodeAll(UIComponent.java:883)
           at javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
           at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:827)
           at javax.faces.component.UIComponent.encodeAll(UIComponent.java:883)
           at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
           at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
           at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:108)
           at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:266)
           at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:159)
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
           at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
           at java.lang.Thread.run(Thread.java:619)
      Caused by: javax.el.ELException: /index.xhtml @16,62 value="#{user.userName}": Error reading 'userName' on type org.jboss.seam.example.User
           at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:76)
           at javax.faces.component.UIOutput.getValue(UIOutput.java:176)
           ... 46 more
      Caused by: java.lang.NullPointerException
           at org.jboss.seam.example.User.getUserName(User.java:30)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at javax.el.BeanELResolver.getValue(BeanELResolver.java:62)
           at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
           at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:58)
           at org.jboss.el.parser.AstPropertySuffix.getValue(AstPropertySuffix.java:53)
           at org.jboss.el.parser.AstValue.getValue(AstValue.java:67)
           at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
           at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
      
      


      I can also see that User and the entityManager is there in the scoped variables
      http://img153.imageshack.us/i/scopedvariables.jpg/


      I would greatly appreciate a shove in the right direction.


      Asif