File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes JSF 2.0 - PropertyNotFoundException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of RabbitMQ in Depth this week in the Open Source forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF 2.0 - PropertyNotFoundException" Watch "JSF 2.0 - PropertyNotFoundException" New topic

JSF 2.0 - PropertyNotFoundException

Ast Lavond

Joined: Mar 02, 2010
Posts: 16
Hello together,

I want to run a very simple JSF 2 example, but it ends always in this error:
javax.el.PropertyNotFoundException: /index.xhtml @12,39 value="#{}": Target Unreachable, identifier 'user' resolved to null

After searching I found a lot of links with similar problems. For example:

But in my case it doesn't help.

I’ve created a Dynamic Web Project in Eclipse Helios based on the Target runtime “JBoss 6.0 Runtime” and with the JSF 2.0 Configuration.
The Java Build Path contains the following libraries:
- JBoss 6.0 Runtime (with all needed jars provided by jBoss)
- JRE System Library [JVM 1.6.0]

After that I've created these files:




I also tested the class with the @ManagedBean annotation and with the corresponding faces-config.xml settings. -> with no success.
Do you have a solution?
Cesar Loachamin
Ranch Hand

Joined: Dec 25, 2010
Posts: 90

Hi Ast
I think the problem is with your packages becuase depending of the anotation of your bean you choose the scope in the correct package, I give you an example:
orCheck your packages, I hope this help you with your problems. Regards

When a dream is ending because to come true - OCPJP 6,7. OCE JPA EE6. MCTS
Ast Lavond

Joined: Mar 02, 2010
Posts: 16
Hello Cesar,

thanks for your reply. I found the Problem:

In Eclipse you can build web and enterprise archive projects by adding them to server (right click on the project -> run as -> run on server -> now you can choose the specific server instance -> the archive will be generated in your deploy folder).

So now the strange thing:
In my case the WAR archive will be generated (with all packages), but the java files in the source folder will not be considered. I’ve tried to build the archive again: Now in the server view -> I stated an incremental / full publish of the project -> without success.
But If I run an POJO with a main methode in the same Package, all other POJOs will be compiled and updated to the archive.

-> In future I will build my applications with ant ;)

Unfortunately my Applications runs only with the as Managed Bean (with Annotations or defined in faces-config.xml):

...Managed Bean with Annotations:

...or Managed Bean defined in faces-config.xml:

Injection doesn’t work (javax.el.PropertyNotFoundException):

Cesar Loachamin
Ranch Hand

Joined: Dec 25, 2010
Posts: 90

Hello Ast

I'm glad becuase you can solve the principal problem, sorry I forgot to told you about the Named annotation, when you want to use a Context and Dependency Injection with JSF 2.0, you need a configuration file beans.xml to indicate to the container that you want to use CDI. Here is the content of the beans.xml (you can leave this file in blank)
and you need put this file at the same level as web.xml withing the war

I hope with this you can use CDI in you project
Kind Regards
Ast Lavond

Joined: Mar 02, 2010
Posts: 16
Hi Cesar,

that was the mistake, now all runs great.
Thanks a lot for your help!

Best Regards
I agree. Here's the link:
subject: JSF 2.0 - PropertyNotFoundException