-
1. Re: Simplest Weld Example (Does not work)
asookazian Mar 17, 2010 6:07 PM (in response to javanaute)Have you added a debug brkpt in the getText() method? Is the method invoked?
-
2. Re: Simplest Weld Example (Does not work)
nickarls Mar 17, 2010 9:42 PM (in response to javanaute)add a faces-config.xml, too
-
3. Re: Simplest Weld Example (Does not work)
javanaute Mar 18, 2010 11:14 AM (in response to javanaute)thx for your replies guys.
I have added a faces-config and tested with the breakpoint too and getText does not get called, and i keep getting the same results.
Here is what JBoss displays on startup :
11:09:34,531 INFO [org.jboss.weld.Version] WELD-000900 1.0.1 (CR1)
11:09:34,813 INFO [org.jboss.web.tomcat.service.deployers.TomcatDeployment] deploy, ctxPath=/JBossTest
11:09:35,016 INFO [javax.enterprise.resource.webcontainer.jsf.config] Initialisation de Mojarra 2.0.2 (FCS b10)
My webapp is called JBoss test. When take of the beans.xml file i don't get the line :
11:09:34,531 INFO [org.jboss.weld.Version] WELD-000900 1.0.1 (CR1) -
4. Re: Simplest Weld Example (Does not work)
nickarls Mar 18, 2010 11:26 AM (in response to javanaute)Drop in the numberguess example, does it work?
-
5. Re: Simplest Weld Example (Does not work)
javanaute Mar 18, 2010 3:23 PM (in response to javanaute)I have dropped the number guess in and this is what i get when JBoss starts up :
15:15:27,056 INFO [Version] WELD-000900 1.0.1 (CR1)
15:15:27,085 WARN [ControllerState] Deprecated usage of 'new ControllerState', use getInstance, caller: org.jboss.weld.integration.deployer.env.DynamicDependencyCreator.createDepenencies(DynamicDependencyCreator.java:73)
15:15:27,490 INFO [TomcatDeployment] deploy, ctxPath=/numberguess
15:15:27,708 INFO [config] Initializing Mojarra 2.0.2 (FCS b10) for context '/numberguess'
Now, http://localhost:8080/numberguess/home.jsf displays a page with :
Guess a number...
I'm thinking of a number between and . You have guesses remaining.
Your guess: Guess
Reset
The Guess button is disabled and no values are displayed at "between and ."
When i click on reset i get the following stack trace :
javax.servlet.ServletException: javax.el.PropertyNotFoundException: /home.xhtml @29,107 action="#{game.reset}": Target Unreachable, identifier 'game' resolved to null
javax.faces.webapp.FacesServlet.service(FacesServlet.java:325)
org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:66)
-
6. Re: Simplest Weld Example (Does not work)
nickarls Mar 18, 2010 9:46 PM (in response to javanaute)Try updating Weld in the AS. Download 1.0.1-Final, unzip and go the the jboss-as folder and edit the jboss.home property to point to the AS home and then run mvn in that folder (we all have maven 2.0.10 installed, right?) ;-)
-
7. Re: Simplest Weld Example (Does not work)
chasetec Mar 18, 2010 10:59 PM (in response to javanaute)Your url-pattern is wrong, it should be *.xhtml.
Also you only need to be using the transitional DTD in your facelet. -
8. Re: Simplest Weld Example (Does not work)
nickarls Mar 18, 2010 11:37 PM (in response to javanaute)you mean the default suffix param?
-
9. Re: Simplest Weld Example (Does not work)
chasetec Mar 19, 2010 1:40 AM (in response to javanaute)I mean the url-pattern in his web.xml. He has *.jsf. You need to either put all your facelet pages underneath a directory and use a "*" pattern or use the "*.xhtml" pattern which allows you to place the facelet pages in any location.
The OP is more than likely requesting the view.xhtml in his web browser which is by-passing the JSF servlet, returning the source as a static xhtml page. I bet if he views the source html is his web browser he will see the non-rendered <h:outputText value="#{hello.text}" /> tag. -
10. Re: Simplest Weld Example (Does not work)
nickarls Mar 19, 2010 7:41 AM (in response to javanaute)Doesn't explain the numberguess issue.
-
11. Re: Simplest Weld Example (Does not work)
javanaute Mar 19, 2010 6:50 PM (in response to javanaute)So far, i have tried to put .xhtml as the default suffix param but this generates errors with a Stack Overflow.
Have not tried with the new weld version but instead created another project with the maven archetype and every thing works fine with this same version. I could repair my app by replacing my WEB-INF folder with the one generated by the maven archetype, but could not fix the number guess app !
Don't know what is going on ! Is it WTP that does not work correctly ?
Could anyone point me out to a simple WTP tutorial with Weld.
-
12. Re: Simplest Weld Example (Does not work)
javanaute Mar 19, 2010 6:54 PM (in response to javanaute)Just a precision : i used the weld maven archetype that i found here : http://www.seamframework.org/Documentation/WeldQuickstartForMavenUsers
-
13. Re: Simplest Weld Example (Does not work)
chasetec Mar 19, 2010 9:29 PM (in response to javanaute)>> So far, i have tried to put .xhtml as the default suffix param but this generates errors with a Stack Overflow.
As I said, NOT the suffix setting. The url-pattern should either be *.xhtml" or "somedir/*". Don't even include the suffix setting in your web.xml. If you view your WEB-INF/web.xml you'll find a difference between the working and non-working versions.
Just in-case you aren't clear, the suffix setting (which you shouldn't need) is:
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
The url-pattern, that you should have for your hello world app is:
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
Using *.jsf is a poor choice because it allows people to bypass the JSF implementation and view you facelet source. See http://weld-numberguess.appspot.com/home.xhtml and http://weld-numberguess.appspot.com/home.jsf for an example of what I'm talking about. It's confusing for developers and end-users.
You probably have a deployment descriptor problem with the numberguess app, there are several web.xml files you have to choice from. You have to combine the contents of two different WEB-INF directories to get all the xml files you need. You probably either had the wrong or missing web.xml and/or a missing beans.xml in the numberguess app you deployed.
As a suggestion, stop messing around with maven for now, just use the simplest method you have at your disposal to create a Java EE 6 web project.
Please note that your initial problem wasn't Weld related. You are having issues correctly configuring your deployment descriptor for JSF. Start with a facelet page that just has <h:outputText value="Hello" />. Once you get that working you can add the beans.xml file and start trying out Weld.