This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF and CDI in maven  RSS feed

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

i have setup a maven project with JSF.
When i want to create my JavaBean and use CDI, eclipse says that he can't resolve @Named to a type.

Maybe i forgot something? I have the primefaces dependency added already.

Thanks
Wim
 
Tim Holloway
Bartender
Posts: 18705
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What Eclipse says it not important. Eclipse is a development tool and it shouldn't be anywhere near production servers.

What is important is the webapp server. Presumably, your "eclipse says" is actually what happens when you are using Eclipse to control a test webapp server.

CDI is not built in to all webapp servers. It's a relatively recent addition to Enterprise Java, and you might need a server upgrade or the inclusion of a third-party library to your webapp to get the CDI functionality operative. Google can help.
 
Wim Van Geyt
Ranch Hand
Posts: 32
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

thanks for your answer,

We use Maven 3.3.9 and the server on my development machine is Websphere Application Server Liberty.

Wim
 
Tim Holloway
Bartender
Posts: 18705
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You probably need the following stanza in your project's pom.xml file:


If maven can do a clean build from the command line, then all that would remain is to hammer on Eclipse until it picks up on the cdi-api library. Best place to ask if you run into problems with that is our tools and IDEs forum.

Here's some knowledgebase articles that may or may not prove useful. I noticed that the JSF that's built into Liberty version 8.5.5 is a modified version of Apache MyFaces.

http://www-01.ibm.com/support/knowledgecenter/SSCKBL_8.5.5/com.ibm.websphere.nd.doc/ae/cweb_cdi.html

http://www-01.ibm.com/support/knowledgecenter/SSCKBL_8.5.5/com.ibm.websphere.nd.doc/ae/cweb_cdi_integration.html?lang=en
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!