-
15. Re: Seam + Portlets + JSF + Facelets problem: Exception in P
mzeijen Sep 15, 2006 2:55 AM (in response to mzeijen)Thanxs :D
-
16. Re: Seam + Portlets + JSF + Facelets problem: Exception in P
chuaky Sep 15, 2006 10:24 AM (in response to mzeijen)here we go ...
1. If you haven't install JBoss Portal 2.4GA with EJB3, see portal installation instruction at
http://docs.jboss.com/jbportal/v2.4/reference-guide/en/html_single/#install_installer
I use the JEMS installer, and then override the JBoss portal with the latest.
2. Install (unzip) seam 1.0.1GA if not yet.
3. I combine the "booking" and "portal" examples to arrive at the final outcome. Not sure if this is correct, but seems to work ... ha ha ha
All the subsequent files are from the "booking" directory. -
17. Re: Seam + Portlets + JSF + Facelets problem: Exception in P
chuaky Sep 15, 2006 10:28 AM (in response to mzeijen)4a. Delete .\booking\resources\META-INF\jboss-app.xml
4b. Create .\booking\resources\WEB-INF\jboss-app.xml with this content:<jboss-app> <app-name>seam-booking</app-name> </jboss-app>
5. Edit .\booking\resources\META-INF\application.xml, to remove the context-root tags. The result look like this:<application> <display-name>Seam Booking</display-name> <module> <web> <web-uri>jboss-seam-booking.war</web-uri> </web> </module> <module> <ejb>jboss-seam-booking.jar</ejb> </module> <module> <java>jboss-seam.jar</java> </module> </application>
6. Create .\booking\resources\WEB-INF\jboss-web.xml with this content:<jboss-web> <context-root>seam-booking</context-root> <class-loading> <loader-repository> seam.jboss.org:loader=seam-booking </loader-repository> </class-loading> </jboss-web>
-
18. Re: Seam + Portlets + JSF + Facelets problem: Exception in P
chuaky Sep 15, 2006 10:30 AM (in response to mzeijen)7. Edit .\booking\resources\WEB-INF\web.xml with this content:
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <!-- Seam --> <listener> <listener-class>org.jboss.seam.servlet.SeamListener</listener-class> </listener> <!-- Propagate conversations across redirects --> <filter> <filter-name>Seam Redirect Filter</filter-name> <filter-class>org.jboss.seam.servlet.SeamRedirectFilter</filter-class> </filter> <filter-mapping> <filter-name>Seam Redirect Filter</filter-name> <url-pattern>*.seam</url-pattern> </filter-mapping> <!-- Extensions Filter --> <filter> <filter-name>extensionsFilter</filter-name> <filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class> <init-param> <description>Set the size limit for uploaded files. Format: 10 - 10 bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB </description> <param-name>uploadMaxFileSize</param-name> <param-value>100m</param-value> </init-param> <init-param> <description>Set the threshold size - files below this limit are stored in memory, files above this limit are stored on disk. Format: 10 - 10 bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB </description> <param-name>uploadThresholdSize</param-name> <param-value>100k</param-value> </init-param> </filter> <!-- extension mapping for adding <script/>, <link/>, and other resource tags to JSF-pages --> <filter-mapping> <filter-name>extensionsFilter</filter-name> <servlet-name>Faces Servlet</servlet-name> </filter-mapping> <filter-mapping> <filter-name>extensionsFilter</filter-name> <url-pattern>/faces/myFacesExtensionResource/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>extensionsFilter</filter-name> <url-pattern>*.jsf</url-pattern> </filter-mapping> <filter-mapping> <filter-name>extensionsFilter</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> <filter-mapping> <filter-name>extensionsFilter</filter-name> <url-pattern>/faces/*</url-pattern> </filter-mapping> <!-- JSF --> <!-- <listener> <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class> </listener> --> <context-param> <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name> <param-value>true</param-value> </context-param> <context-param> <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name> <param-value>false</param-value> </context-param> <context-param> <param-name>org.apache.myfaces.AUTO_SCROLL</param-name> <param-value>false</param-value> </context-param> <context-param> <param-name>org.apache.myfaces.CHECK_EXTENSIONS_FILTER</param-name> <param-value>false</param-value> </context-param> <context-param> <param-name>org.apache.myfaces.PRETTY_HTML</param-name> <param-value>true</param-value> </context-param> <context-param> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>client</param-value> </context-param> <context-param> <param-name>javax.faces.DEFAULT_SUFFIX</param-name> <param-value>.xhtml</param-value> </context-param> <context-param> <param-name>facelets.DEVELOPMENT</param-name> <param-value>true</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> <!-- Faces Servlet Mapping --> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.seam</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.jsf</url-pattern> </servlet-mapping> <!-- Seam Remoting --> <servlet> <servlet-name>Seam Remoting</servlet-name> <servlet-class>org.jboss.seam.remoting.SeamRemotingServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Seam Remoting</servlet-name> <url-pattern>/seam/remoting/*</url-pattern> </servlet-mapping> </web-app>
-
19. Re: Seam + Portlets + JSF + Facelets problem: Exception in P
chuaky Sep 15, 2006 10:31 AM (in response to mzeijen)8. Add the facelets support in .\booking\resources\WEB-INF\faces-config.xml, see below:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN" "http://java.sun.com/dtd/web-facesconfig_1_0.dtd"> <faces-config> <!-- Navigation rules for the Booking demo app --> <navigation-rule> <navigation-case> <from-outcome>login</from-outcome> <to-view-id>/home.xhtml</to-view-id> <redirect /> </navigation-case> <navigation-case> <from-outcome>register</from-outcome> <to-view-id>/register.xhtml</to-view-id> <redirect /> </navigation-case> <navigation-case> <from-outcome>password</from-outcome> <to-view-id>/password.xhtml</to-view-id> <redirect /> </navigation-case> <navigation-case> <from-outcome>main</from-outcome> <to-view-id>/main.xhtml</to-view-id> <redirect /> </navigation-case> <navigation-case> <from-outcome>hotel</from-outcome> <to-view-id>/hotel.xhtml</to-view-id> <redirect /> </navigation-case> </navigation-rule> <navigation-rule> <from-view-id>/hotel.xhtml</from-view-id> <navigation-case> <from-outcome>book</from-outcome> <to-view-id>/book.xhtml</to-view-id> <redirect /> </navigation-case> </navigation-rule> <navigation-rule> <from-view-id>/book.xhtml</from-view-id> <navigation-case> <from-outcome>confirm</from-outcome> <to-view-id>/confirm.xhtml</to-view-id> <redirect /> </navigation-case> </navigation-rule> <navigation-rule> <from-view-id>/confirm.xhtml</from-view-id> <navigation-case> <from-outcome>confirmed</from-outcome> <to-view-id>/main.xhtml</to-view-id> <redirect/> </navigation-case> <navigation-case> <from-outcome>back</from-outcome> <to-view-id>/book.xhtml</to-view-id> <redirect /> </navigation-case> </navigation-rule> <!-- Facelets support --> <application> <view-handler>com.sun.facelets.FaceletPortletViewHandler</view-handler> </application> <lifecycle> <phase-listener>org.jboss.seam.jsf.SeamExtendedManagedPersistencePortletPhaseListener</phase-listener> </lifecycle> </faces-config>
-
20. Re: Seam + Portlets + JSF + Facelets problem: Exception in P
chuaky Sep 15, 2006 10:32 AM (in response to mzeijen)9. Create .\booking\resources\WEB-INF\seam-booking-object.xml, as follows:
<?xml version="1.0" encoding="UTF-8"?> <deployments> <deployment> <if-exists>overwrite</if-exists> <parent-ref>default</parent-ref> <page> <page-name>SeamBooking</page-name> <window> <window-name>SeamBookingPortletWindow</window-name> <instance-ref>SeamBookingPortletInstance</instance-ref> <region>center</region> <height>0</height> </window> </page> </deployment> <deployment> <if-exists>overwrite</if-exists> <instance> <instance-name>SeamBookingPortletInstance</instance-name> <component-ref>seam-booking.SeamBookingPortlet</component-ref> </instance> </deployment> </deployments>
10. Create .\booking\resources\WEB-INF\jboss-portlet.xml, as follows:<portlet-app> <portlet> <portlet-name>SeamBookingPortlet</portlet-name> </portlet> </portlet-app>
11. Create .\booking\resources\WEB-INF\portlet.xml, as follows:<?xml version="1.0" encoding="UTF-8"?> <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd /opt/SUNWps/dtd/portlet.xsd" version="1.0"> <portlet> <portlet-name>SeamBookingPortlet</portlet-name> <init-param> <name>default-view</name> <value>/home.xhtml</value> </init-param> <portlet-class>org.apache.myfaces.portlet.MyFacesGenericPortlet</portlet-class> <supports> <mime-type>text/html</mime-type> <portlet-mode>VIEW</portlet-mode> </supports> <portlet-info> <title>SeamBookingPortlet</title> </portlet-info> </portlet> </portlet-app>
-
21. Re: Seam + Portlets + JSF + Facelets problem: Exception in P
chuaky Sep 15, 2006 10:33 AM (in response to mzeijen)12. Edit .\booking\build.xml, as follows:
<?xml version="1.0"?> <project name="Booking" default="deploy" basedir="."> <!-- Naming --> <property name="Name" value="Seam on JBoss Booking Example"/> <property name="example.name" value="jboss-seam-booking"/> <!-- WAR --> <zipfileset id="example.war.docroot" dir="view"> <include name="**/*"/> </zipfileset> <zipfileset id="example.war.webinf" prefix="WEB-INF" dir="resources/WEB-INF" > <patternset refid="meta.files"/> </zipfileset> <zipfileset id="example.war.webinf.lib" prefix="WEB-INF/lib" dir="resources/WEB-INF/lib"> <include name="*.jar"/> </zipfileset> <zipfileset id="example.war.webinf.lib.extra" prefix="WEB-INF/lib" dir="."> <include name="_NONE_"/> </zipfileset> <!-- EJB3 --> <fileset id="example.ejb3.root" dir="resources"> <include name="import.sql"/> <include name="seam.properties"/> <include name="META-INF/persistence.xml"/> <include name="META-INF/ejb-jar.xml"/> </fileset> <fileset id="example.ejb3.lib" dir="../../lib"> <include name="_NONE_"/> </fileset> <!-- EAR --> <zipfileset id="example.ear.resources" prefix="META-INF" dir="resources/META-INF"> <include name="*"/> <exclude name="persistence.xml"/> <exclude name="ejb-jar.xml"/> </zipfileset> <!-- Deploy --> <fileset id="example.deploy" dir="resources"> <include name="booking-ds.xml"/> </fileset> <!-- Undeploy --> <patternset id="example.undeploy"> <include name="booking-ds.xml"/> </patternset> <!-- Test --> <fileset id="example.resources" dir="resources"> <include name="**/*.*"/> </fileset> <!-- Tomcat build --> <zipfileset id="example.tomcat.war.webinf" prefix="WEB-INF" dir="resources/WEB-INF" > <include name="web.xml"/> <include name="faces-config.xml"/> <include name="pages.xml"/> <include name="events.xml"/> <include name="components.xml"/> <include name="classes/messages.properties"/> <include name="jboss-app.xml" /> </zipfileset> <fileset id="example.tomcat.resources" dir="resources"> <include name="seam.properties"/> <include name="import.sql"/> <include name="META-INF/persistence.xml"/> <include name="META-INF/ejb-jar.xml"/> <include name="META-INF/jboss-beans.xml"/> <!-- TODO: move out of META-INF --> </fileset> <!-- Overrides --> <property name="src.java.dir" value="src"/> <property name="src.test.dir" value="src"/> <property name="test.classpath" value="test.eejb.classpath"/> <property name="tomcat.conf" value="eejb.conf"/> <import file="../../build.xml"/> </project>
-
22. Re: Seam + Portlets + JSF + Facelets problem: Exception in P
chuaky Sep 15, 2006 10:35 AM (in response to mzeijen)13. Create this folder: .\booking\resources\WEB-INF\lib
14. Use ant to build. If properly setup, the EAR and ds file should be copied into your Jboss deploy folder. If not you could find the EAR in the build folder, and manually copy the EAR and ds file into Jboss deploy folder.
15. Run Jboss. Moment of true ... http://localhost:8080/portal
16. If you want to use EJB3, need to edit the persistence.xml file.
Hope this help. -
23. Re: Seam + Portlets + JSF + Facelets problem: Exception in P
andyd Sep 15, 2006 11:07 AM (in response to mzeijen)Fantastic!
Many thanks for your help - busy evening later giving it a go.
Andy. -
24. Re: Seam + Portlets + JSF + Facelets problem: Exception in P
mzeijen Sep 15, 2006 2:34 PM (in response to mzeijen)I am trying it right now. I hope it will work :D
-
25. Re: Seam + Portlets + JSF + Facelets problem: Exception in P
mzeijen Sep 15, 2006 4:02 PM (in response to mzeijen)Are you sure that your versions works? I still get the same exception: java.lang.IllegalStateException: No active session context :(
What version of the MyFaces library do you use? I'm almost sure that the problem lies with MyFaces. -
26. Re: Seam + Portlets + JSF + Facelets problem: Exception in P
mzeijen Sep 15, 2006 4:41 PM (in response to mzeijen)Here is something interresting: I removed the myfaces library file from my WEB-INF/lib directory. Now I get to expected exceptions that the myfaces factory doesn't exists. The interresting part is that Seam now works without exceptions.
With the ''No active session context' exception I couldn't navigate to a different view-id. This problem is now also solved.
But now MyFaces probably doesn't work correct. I am going to try to debug it and see what I encounter then. -
27. Re: Seam + Portlets + JSF + Facelets problem: Exception in P
andyd Sep 15, 2006 4:56 PM (in response to mzeijen)I'm just going through things here - will let you know where I get to shortly
-
28. Re: Seam + Portlets + JSF + Facelets problem: Exception in P
chuaky Sep 15, 2006 7:21 PM (in response to mzeijen)dear all,
Best if you do a clean installation of Jboss AS + portal + seam in another folder if you don't want to disturb your existing installation, as follows:
1. If you haven't install JBoss Portal 2.4GA with EJB3, see portal installation instruction at
http://docs.jboss.com/jbportal/v2.4/reference-guide/en/html_single/#install_installer
I use the JEMS installer, and then override the JBoss portal with the latest.
2. Install (unzip) seam 1.0.1GA if not yet. -
29. Re: Seam + Portlets + JSF + Facelets problem: Exception in P
andyd Sep 15, 2006 7:27 PM (in response to mzeijen)Ok, got mine going a little further. I'm currently just using the 2.4BETA portlet version that comes with the installer (1.2BETA). The following may possibly not show up in 2.4.0GA.
Check that you have definately commented out the myfaces StartupServletContextListener in web.xml as chuaky suggests above. i.e.
<!-- JSF -->
<!--
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
-->
You may well get the following exception when you deploy, but the app seems largely to work anyway.
2006-09-16 00:14:01,318 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/seam-booking]] Servlet /seam-booking threw load() exception
java.lang.IllegalStateException: No Factories configured for this Application - typically this is because a context listener is not setup in your web.xml.
A typical config looks like this;
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
I have managed to register through the portlet and then get a problem with main.seam, but that may be a problem elsewhere.
Another thing to watch is to put your 3 facelet jars into tomcats jsf-lib directory, not in the apps EB-INF/lib directory, to avoid classloader issues (AFAIK).