Weld Examples, JBoss 6 Milestones and Frustration
bardioc Jun 5, 2010 11:18 AMHello everybody,
as a new project is currently in its early stages I've thought to myself, why not trying out Weld and CDI together with JBoss 6. Now, after about one week of continuously failures, exceptions and errors I'm almost ready to give up the try and give the exciting new technology another year to evolve. This post in the forum is just to summarize the problems I had when trying out to build a VERY simple Weld/CDI based program. Indeed it was not even my idea, I simply tried to adopt the NumberGuess example, well known and already ported to Weld for JSF, Wicket and even Java SE.
My frustration become even bigger as it currently seems to be impossible to use JBoss 6 (not even the SNAPSHOT version) with Weld/CDI and JSF 2.0, I know it is a milestone release, but the overal examples on the Weld part of this very website suggest it is SOOOOO EASY to use it. I agree, there are a lot of examples, but what does it help if none of them work?
I'm missing a really step-by-step example, helping somebody like me to learn his first steps with weld. And I would appreciate if not only the code base is fixed but the documentation too. I would even help if thats wanted, not taking myself out of the focus here.
Let me summarize:
I implemented a simple EAR and a dynamic Web-Project inside it. I configured the faces-config.xml, the web.xml as well as the application.xml to be appropriate for deployment on JBoss 6.
My web.xml looks like this:
<display-name>Numberguess example</display-name> <context-param> <param-name>javax.faces.DEFAULT_SUFFIX</param-name> <param-value>.xhtml</param-value> </context-param> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.jsf</url-pattern> </servlet-mapping> <session-config> <session-timeout>10</session-timeout> </session-config> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list>
I then adapted the NumberGuess example and carefully included them in my web project. Now the problems start:
Where do I have to put the required libraries in my project for JSF or Weld to compile and what libraries to i need? Weld itself, JSF API and/or IMPL?
I tried putting JSF API and IMPL into a library of my EAR. This lead to JBAS-8035, raising a nice exception like:
java.lang.NoClassDefFoundError: javax/faces/application/ApplicationFactory
Well there is no real solution for this problem, is there? So that means JBoss 6 is not capable of handling any Weld code right now, right? I read something about put them in your Web projects WEB-INF/lib folder. Ok, I did that, guess what, I ended up with the same error message. I put them in both, the EAR and the Web, same problem.
What would you suggest to do to get familiar with Weld and not with errors in it? Is Glassfish right now maybe a better solution although our current projects all run well on JBoss.
Would you personally start with Weld right now or continue to stay the old line (especially Seam 2).
Our project is still a good 6 months away and thus I would be able to say, lets move to CDI, its worth it ... but currently, it is not possible.
Best regards,
Heiko