views:

505

answers:

1

Hey all,

I'm currently writing a simple JSF 2 app for WAS 7. When I define the bean via the faces-config.xml, everything works great

<managed-bean>
     <managed-bean-name>personBean</managed-bean-name>
     <managed-bean-class>com.prototype.beans.PersonBean</managed-bean-class>
     <managed-bean-scope>request</managed-bean-scope>
</managed-bean>

When I try to use the annotations below instead, the app failes.

package com.prototype.beans;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

@ManagedBean(name="personBean")
@RequestScoped
public class PersonBean {
....
}

I've set the WAS classloader to Parent Last, and verified in the logs that Mojarra 2.x is loading.

[5/17/10 10:46:59:399 CDT] 00000009 config        I   Initializing Mojarra 2.0.2 (FCS b10) for context '/JSFPrototype'

However, when I try to use the app (which had worked with XML based config) I see the following

[5/17/10 10:48:08:491 CDT] 00000016 lifecycle     W   /pages/inputname.jsp(16,7) '#{personBean.personName}' Target Unreachable, identifier 'personBean' resolved to null
    org.apache.jasper.el.JspPropertyNotFoundException: /pages/inputname.jsp(16,7) '#{personBean.personName}' Target Unreachable, identifier 'personBean' resolved to null

Anyone know whats going wrong?

A: 

Looks like I may have resolved my own issue (again). The problem looks like it was caused by an improper schema location/config on the faces config. Here's what I am using now, and it seems to work.

<?xml version="1.0"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
          version="2.0">
</faces-config>
gerges