Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

JSF 2.0 - PropertyNotFoundException

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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="#{user.name}": Target Unreachable, identifier 'user' resolved to null

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

https://coderanch.com/t/505989/JSF/java/Error#2284390
https://coderanch.com/t/502157/JSF/java/JSF-Spring-managing-beans#2264029

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:

User.java:


index.xhtml:


greet.xhtml


web.xml


I also tested the user.java class with the @ManagedBean annotation and with the corresponding faces-config.xml settings. -> with no success.
Do you have a solution?
 
Ranch Hand
Posts: 90
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Cesar
 
Ast Lavond
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 User.java 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
Posts: 90
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Cesar
 
Ast Lavond
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Cesar,

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

Best Regards
Ast
 
Sometimes you feel like a nut. Sometimes you feel like a tiny ad.
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic