-
1. Re: Deploying Simple JSF 1.2 application in jboss 7
Stan Silvert Aug 10, 2011 7:44 AM (in response to Nitin Khekare)Your first problem is that you didn't declare UserNameBean as a @ManagedBean. You can do this with the annotation or in a faces-config.xml. Your EL is probably wrong as well. If you use the annotation then by default the proper EL expression will be #{userNameBean.userName}
Second, you can use JSF 1.2 without adding jboss-deployment-structure.xml. All you need to do is add this to your web.xml:
<context-param> <param-name>org.jboss.jbossfaces.JSF_CONFIG_NAME</param-name> <param-value>Mojarra-1.2</param-value> </context-param>
Lastly, you don't need to add JSTL jars to your WAR. These are already added by JBoss AS7.
Stan
-
2. Re: Deploying Simple JSF 1.2 application in jboss 7
Nicklas Karlsson Aug 10, 2011 7:47 AM (in response to Stan Silvert)Is the JSF_CONFIG_NAME already available on AS7?
-
3. Re: Deploying Simple JSF 1.2 application in jboss 7
Stan Silvert Aug 10, 2011 7:52 AM (in response to Stan Silvert)My bad. You did use faces-config.xml. Stand by.
Stan
-
4. Re: Deploying Simple JSF 1.2 application in jboss 7
Stan Silvert Aug 10, 2011 7:53 AM (in response to Nicklas Karlsson)Nicklas Karlsson wrote:
Is the JSF_CONFIG_NAME already available on AS7?
Yes, but for now it only works for Mojarra-1.2.
Stan
-
5. Re: Deploying Simple JSF 1.2 application in jboss 7
Stan Silvert Aug 10, 2011 7:59 AM (in response to Stan Silvert)I think this is your problem:
07:55:44,998 ERROR [org.jboss.as.web.jsf] (MSC service thread 1-6) Could not load JSF managed bean class java.net.roseindia.UserNameBean
Try using a different package name. I'm pretty sure "java.net" is filtered by the classloader.
Stan
-
6. Re: Deploying Simple JSF 1.2 application in jboss 7
Nitin Khekare Aug 10, 2011 8:29 AM (in response to Stan Silvert)Stan thank you for your reply
I already tried by changing the package. I have declared the managed bean faces-config.xml.
And I tried by adding the context param. It is giving error like
17:57:59,218 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/jsf1.2]] (MSC service thread 1-4) Error configuring application listener of class com.sun.faces.application.WebappLifecycleListener: java.lang.ClassCastException: com.sun.faces.application.WebappLifecycleListener
cannot be cast to java.util.EventListener
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3318) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3821) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70) [jboss-as-web-7.0.0.Final.jar:7.0.0.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)
at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_13]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_13]
at java.lang.Thread.run(Thread.java:619) [:1.6.0_13]
-
7. Re: Deploying Simple JSF 1.2 application in jboss 7
Stan Silvert Aug 10, 2011 1:40 PM (in response to Nitin Khekare)I found your problem. JSF 1.2 requires Servlet 2.5 and JSP 2.1. In web.xml you declared your webapp as Servlet 2.3. That causes the JSP processor to treat JSP tags as if they are JSP 1.2.
So you need to declare your web.xml to be at least Servlet 2.5. I've attached a working Maven project based on your code.
Stan
-
hellojsf12.zip 5.1 KB
-
-
8. Re: Deploying Simple JSF 1.2 application in jboss 7
Nitin Khekare Aug 11, 2011 1:21 AM (in response to Stan Silvert)Stan Thank you for your reply, now my application is running fine.
But I am facing another problem, I converted the application as facelets application.
The error now I am getting is,
10:42:34,980 SEVERE [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--127.0.0.1-8080-1) JSF1054: (Phase ID: RENDER_RESPONSE 6, View ID: /inputname.xhtml) Exception thrown during phase execution: javax.faces.event.PhaseEvent[source=com.sun.faces.lifecycle.LifecycleImpl@13cca0e]
10:42:34,980 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/jsf1.2].[Faces Servlet]] (http--127.0.0.1-8080-1) Servlet.service() for servlet Faces Servlet threw exception: javax.el.ELException: /inputname.xhtml: The class 'roseindia.UserNameBean' does not have the property
'welcome'.
at com.sun.facelets.compiler.AttributeInstruction.write(AttributeInstruction.java:53) [jsf-facelets.jar:]
at com.sun.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:39) [jsf-facelets.jar:]
at com.sun.facelets.compiler.UILeaf.encodeAll(UILeaf.java:149) [jsf-facelets.jar:]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:933) [jsf-api-1.2_13.jar:1.2_13-b01-FCS]
at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:577) [jsf-facelets.jar:]
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110) [jsf-impl-1.2_13.jar:1.2_13-b01-FCS]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100) [jsf-impl-1.2_13.jar:1.2_13-b01-FCS]
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-1.2_13.jar:1.2_13-b01-FCS]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266) [jsf-api-1.2_13.jar:1.2_13-b01-FCS]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57) [jboss-as-web-7.0.0.Final.jar:7.0.0.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
at java.lang.Thread.run(Thread.java:619) [:1.6.0_13]
Attaching the changed war file
-
jsf1.2.war 1.8 MB
-
-
9. Re: Deploying Simple JSF 1.2 application in jboss 7
Nicklas Karlsson Aug 11, 2011 1:29 AM (in response to Nitin Khekare)Probably because your bean doesn't have the JavaBean-conventional getWelcome()/setWelcome() method (no longer an AS problem)
-
10. Re: Deploying Simple JSF 1.2 application in jboss 7
Nitin Khekare Aug 11, 2011 1:31 AM (in response to Nicklas Karlsson)public String welcome(){
return "welcome";
}
welcome is not a property it is an action.
-
11. Re: Deploying Simple JSF 1.2 application in jboss 7
Nicklas Karlsson Aug 11, 2011 2:19 AM (in response to Nitin Khekare)it's an actionListener in the view
-
12. Re: Deploying Simple JSF 1.2 application in jboss 7
Nitin Khekare Aug 11, 2011 3:23 AM (in response to Nicklas Karlsson)I think I have attached wrong war file.
But I have tested it after changes, but still gives the same errror.
-
13. Re: Deploying Simple JSF 1.2 application in jboss 7
Stan Silvert Aug 11, 2011 7:05 AM (in response to Nitin Khekare)Nitin Khekare wrote:
I think I have attached wrong war file.
But I have tested it after changes, but still gives the same errror.
Yes, the WAR you attached is still using JSP.
It looks like you are trying to call an action in a place where the tag attribute is expecting a bean property.
Stan
-
14. Re: Deploying Simple JSF 1.2 application in jboss 7
Nitin Khekare Aug 11, 2011 7:47 AM (in response to Stan Silvert)Attaching the updated war file.
-
jsf1.2.war 752.3 KB
-