Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Maven and JSF  RSS feed

 
Wim Van Geyt
Greenhorn
Posts: 27
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I wonder when you use Maven and JSF, you use also JavaBeans with a CDI annotation.

Now do you need to set the names of your JavaBeans in any xml file? So they are reachable?

Before I tested JSF without maven and those JavaBeans where easily reachable. Now with maven it drops a javax.el.PropertyNotFoundException: Target Unreachable, identifier 'calcBean' resolved to null.

In the code of the Bean and the EL expressions are well written, though it shows this error on a bean?

Wim
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you design and build your webapp with is not important. In any shop with even the most basic security, the build tools won't be avaiable on the production server. All that matters is that your builds produce a complete and functional webapp.

So whether you use IntelliJ, NetBeans or Eclipse, Maven or Ant, the resulting WAR (or EAR) should look the same. If it does not, there's something wrong with the build process itself.

What you run it on is more important, since not all webapp servers provide the full J2EE kit and therefore may require you to supply what would normally be server-supplied functionality via an add-in library to the WAR. Or, in some cases, you'd provide an add-in librarry if the server wasn't providing the desired version of a service on its own built-in libraries. For information on stuff like this, it's best to inquire in the Ranch forum that's associated with the server itself. For example, the Tomcat or WebSphere forum.

Things can also get messy when an IDE starts mucking around with a server's internals. For example, the "Run On Server" feature of Eclipse does some pretty awful things to Tomcat, which is why I prefer to use an alternative way for Eclipse to run Tomcat. For questions relating to this mode of operation, help is best found in our IDEs forum
.
According to several sources, a /WEB-INF/beans.xml file must be present in the WAR to cue the CDI mechanism to do its job. An empty file will do:

If you put any additional elements that match annotated classes, the XML will override the corresponding class annotation.

If you are getting the PropertyNotFoundException when running the maven build, that would imply that your CDI libraries are most likely mismatched versions. If you are getting the PropertyNotFoundException at runtime that would indicate that you have either not supplied the webapp server with the CDI runtime libraries or that your webapp is not properly configured to use them. Since that is a characteristic specific to the brand and version of your webapp server, you should ask in the corresponding webapp server's forum.

Actually, I haven't been impressed by CDI. Its primary benefit is that it rolls up a bunch of previously-independent injection mechanisms into one, but as far as I can tell, it neither provides all the features of the Spring Framework nor does it play well with the Spring Framework. So I've not been rushing to CDI myself.
 
Wim Van Geyt
Greenhorn
Posts: 27
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim,

thanks for the information.


Wim
 
Wim Van Geyt
Greenhorn
Posts: 27
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim

I overlooked the project with my colleague and we saw that the CalcBean was in the wrong branch of the project.
We have a task branch and a web branch, so the CalcBean had to be in the web branch where your index.xhtml is residing.

Thanks for the Information.

Regards
Wim
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!