tags:

views:

1141

answers:

3

Hi all,

SKIP TO UPDATE 3

I want to enable the Seam debug page on Weblogic 10.3.2 (11g). So, I have done the following:

I have the jboss-seam and jboss-seam-debug jars as dependency in both my ejb and web maven projects (both are modules of my superproject) I put this context parameter in my web.xml:

<context-param>
        <param-name>org.jboss.seam.core.init.debug</param-name>
        <param-value>true</param-value>
</context-param>

Now, when I hit the URL of my application, I get the debug page with this exception (full stacktrace at the end of the post):

Caused by java.lang.IllegalStateException with message: "No phase id bound to current thread (make sure you do not have two SeamPhaseListener instances installed)"

From posts I read it seems that this is somehow related to two jars of jboss-seam or jboss-seam-debug being in the classpath. I opened my ear file and only one of each is present (in the ear) whereas the war itself has no libraries in the WEB-INF/lib.

I have also read of another way to initialize debug page using the components.xml. I also tried to include the following components.xml in the WEB-INF, but it didn't work either:

<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://jboss.com/products/seam/components"
        xmlns:core="http://jboss.com/products/seam/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="
        http://jboss.com/products/seam/core
        http://jboss.com/products/seam/core-2.2.xsd
        http://jboss.com/products/seam/components
        http://jboss.com/products/seam/components-2.2.xsd"&gt;
        <core:init debug="true"/>
</components>

Any suggestions on what to do to enable the debug page correctly?

Cheers!

Full stacktrace:

org.jboss.seam.contexts.PageContext.getPhaseId(PageContext.java:163)
org.jboss.seam.contexts.PageContext.isBeforeInvokeApplicationPhase(PageContext.java:175)
org.jboss.seam.contexts.PageContext.getCurrentWritableMap(PageContext.java:91)
org.jboss.seam.contexts.PageContext.remove(PageContext.java:105)
org.jboss.seam.Component.newInstance(Component.java:2141)
org.jboss.seam.Component.getInstance(Component.java:2021)
org.jboss.seam.Component.getInstance(Component.java:2000)
org.jboss.seam.Component.getInstance(Component.java:1994)
org.jboss.seam.Component.getInstance(Component.java:1967)
org.jboss.seam.Component.getInstance(Component.java:1962)
org.jboss.seam.faces.FacesPage.instance(FacesPage.java:92)
org.jboss.seam.core.ConversationPropagation.restorePageContextConversationId(ConversationPropagation.java:84)
org.jboss.seam.core.ConversationPropagation.restoreConversationId(ConversationPropagation.java:57)
org.jboss.seam.jsf.SeamPhaseListener.afterRestoreView(SeamPhaseListener.java:391)
org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:230)
org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:196)
com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:175)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:114)
com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:104)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3592)
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2202)
weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2108)
weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1432)
weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

UPDATE 1:

Now the debug page does not appear at all. When I ask for http://localhost/myapp/debug.xhtml I get a page with:

myapp/debug.xhtml

the same as any page that does not exist. I opened the .ear and the following jboss jars are in:

  • jboss-seam-debug-2.2.0.GA.jar
  • jboss-el-1.0_02.CR4.jar
  • jboss-seam-2.2.0.GA.jar

My current configuration:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org    /2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
              http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>PRS 6.0</display-name>

<session-config>
    <session-timeout>30</session-timeout>
</session-config>
<!--
    The default behavior of JSF is to map the incoming request for a JSF
    view identifier (view ID for short) to a JSP file with the file
    extension .jsp. To get JSF to look for a Facelets template instead, we
    must register the .xhtml extension as the default suffix for JSF views
-->
<context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</param-value>
</context-param>

<context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>server</param-value>
</context-param>

<context-param>
    <param-name>javax.faces.CONFIG_FILES</param-name>
    <param-value>
        /WEB-INF/faces-config/application.xml
    </param-value>
</context-param>

<context-param>
    <param-name>facelets.REFRESH_PERIOD</param-name>
    <param-value>2</param-value>
</context-param>
<context-param>
    <param-name>facelets.DEVELOPMENT</param-name>
    <param-value>true</param-value>
</context-param>
<context-param>
    <param-name>facelets.SKIP_COMMENTS</param-name>
    <param-value>true</param-value>
</context-param>

<context-param>
    <param-name>com.sun.faces.verifyObjects</param-name>
    <param-value>false</param-value>
</context-param>

<context-param>
    <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
    <param-value>com.sun.facelets.FaceletViewHandler</param-value>
</context-param>
<context-param>
    <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
    <param-value>true</param-value>
</context-param>
<context-param>
    <param-name>org.ajax4jsf.COMPRESS_STYLE</param-name>
    <param-value>true</param-value>
</context-param>
<context-param>
    <param-name>org.ajax4jsf.xmlparser.ORDER</param-name>
    <param-value>NONE</param-value>
</context-param>
<context-param>
    <param-name>org.richfaces.SKIN</param-name>
    <param-value>blueSky</param-value>
</context-param>
<context-param>
    <param-name>org.richfaces.CONTROL_SKINNING</param-name>
    <param-value>enable</param-value>
</context-param>
<context-param>
    <param-name>org.richfaces.LoadStyleStrategy</param-name>
    <param-value>ALL</param-value>
</context-param>
<context-param>
    <param-name>org.richfaces.LoadScriptStrategy</param-name>
    <param-value>ALL</param-value>
</context-param>


<!-- Seam Filter -->
<!-- (MUST BE FIRST)-->
<filter>
    <filter-name>Seam Filter</filter-name>
    <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>Seam Filter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

<!-- RichFaces filter -->
<filter>
    <display-name>RichFaces Filter</display-name>
    <filter-name>richfaces</filter-name>
    <filter-class>org.ajax4jsf.Filter</filter-class>
    <init-param>
        <description>Set the size limit for uploaded files as attachments in bytes. (max 5MB)</description>
        <param-name>maxRequestSize</param-name>
        <param-value>5242880</param-value>
    </init-param>
</filter>

<filter-mapping>
    <filter-name>richfaces</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>INCLUDE</dispatcher>
</filter-mapping>

<listener>
    <listener-class>
        XX.XXXX.XXX.prs.web.listeners.ResourceInitializationListener</listener-class>
</listener>

<listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>

<listener>
    <listener-class>XX.XXXX.XXX.prs.web.listeners.EJBInjectionListener</listener-class>
</listener>
<!-- Seam Listener-->
<listener>
    <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
</listener>

<!-- Faces Servlet -->
<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>*.xhtml</url-pattern>
</servlet-mapping>
--> Seam Resource Servlet--> org.jboss.seam.servlet.SeamResourceServlet--> --> --> Seam Resource Servlet--> /seam/resource/*--> -->
<welcome-file-list>
    <welcome-file>index.xhtml</welcome-file>
</welcome-file-list>

</web-app>

faces.config

<?xml version="1.0" encoding="UTF-8"?>
<faces-config 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-facesconfig_1_2.xsd"
version="1.2">

<application>
    <locale-config>
        <default-locale>en</default-locale>
        <supported-locale>en</supported-locale>
    </locale-config>
    <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
    <el-resolver>org.jboss.seam.el.SeamELResolver</el-resolver>
    <resource-bundle>
        <base-name>XX.XXXX.XXX.prs.web.messages.messages</base-name>
        <var>msgs</var>
    </resource-bundle>
    <resource-bundle>
        <base-name>XX.XXXX.XXX.prs.web.messages.validation</base-name>
        <var>val</var>
    </resource-bundle>
</application>

<lifecycle>
    <phase-listener>XX.XXXX.XXX.prs.web.listeners.SetFocusListener</phase-listener>
</lifecycle>
<!--    <lifecycle>-->
<!--
    <phase-listener>XX.XXXX.XXX.prs.web.listeners.DebugPhaseListener</phase-listener>
-->

<converter>
    <converter-for-class>XX.XXXX.XXX.prs.model.Applicant</converter-for-class>
    <converter-class>
        XX.XXXX.XXX.prs.web.common.converters.ApplicantConverter</converter-class>
</converter>

<validator>
    <validator-id>EmailValidator</validator-id>
    <validator-class>XX.XXXX.XXX.prs.web.common.validators.EmailValidator</validator-class>
</validator>


</faces-config>

components.xml

<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://jboss.com/products/seam/components"
xmlns:core="http://jboss.com/products/seam/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
    http://jboss.com/products/seam/core
    http://jboss.com/products/seam/core-2.2.xsd
    http://jboss.com/products/seam/components
    http://jboss.com/products/seam/components-2.2.xsd"&gt;

<core:init debug="true" />

<core:manager concurrent-request-timeout="500"
    conversation-timeout="1200000" conversation-id-parameter="cid"
    parent-conversation-id-parameter="pid" />

UPDATE 2:

These guys here have the same problem. They have an outer EAR project containing the inner WAR project. They discuss that this may be related to how jars end up in the projects.

I use Maven, and I had set it to create "Skinny Wars", that is excluding all jar dependencies from the inner WAR project, so that it remains small in size. All its dependencies are contained in the EAR and are used by all other modules.

I changed the settings of the maven-war-plugin to leave inside the war the web-specific jars (the ones mentioned in the link, like RichFaces, jboss-seam-debug, Facelets etc).

However, the problem has reverted to its previous form. I now get the debug page, whatever link I press, with the initial exception.

Caused by java.lang.IllegalStateException with message: "No phase id bound to current thread (make sure you do not have two SeamPhaseListener instances installed)"

UPDATE 3: The structure of the application .ear is the following:

application.ear
|--> APP-INF
| |--> classes
|--> lib (all jar dependencies go here, including the WAR dependencies, EJB module dependencies)
|-->META_INF
| |--> application.xml
| |--> data-sources.xml
| |--> MANIFEST.MF
| |--> weblogic.xml
| |--> weblogic-application.xml
|--> jboss-seam-2.2.0.GA.jar
|--> myEjbModule1.jar
|--> myEjbModule2.jar
|--> myEjbModule3.jar
|--> myEjbModule4.jar
|--> myWar.war (NO libraries in WEB-INF/lib, finds everything in EAR/lib)

When deploying .ear application WITHOUT debug enabled (not including the jboss-seam-debug.jar in the ear), the application is loaded correctly.

When deploying WITH jboss-seam-debug.jar in the EAR (EAR/lib directory), the application does not appear, but ONLY the debug page with the following exception (stacktrace at the end):

Exception during request processing:

Caused by java.lang.IllegalStateException with message: "No phase id bound to current thread (make sure you do not have two SeamPhaseListener instances installed)"

When "JBoss-izing" the same EAR (remove hibernate jars, which are provided by JBoss, and move all libraries from EAR/lib to EAR root), the application loads correctly. BOTH the application AND the debug page appear correctly.

Full stacktrace:

org.jboss.seam.contexts.PageContext.getPhaseId(PageContext.java:163) org.jboss.seam.contexts.PageContext.isBeforeInvokeApplicationPhase(PageContext.java:175) org.jboss.seam.contexts.PageContext.getCurrentWritableMap(PageContext.java:91) org.jboss.seam.contexts.PageContext.remove(PageContext.java:105) org.jboss.seam.Component.newInstance(Component.java:2141) org.jboss.seam.Component.getInstance(Component.java:2021) org.jboss.seam.Component.getInstance(Component.java:2000) org.jboss.seam.Component.getInstance(Component.java:1994) org.jboss.seam.Component.getInstance(Component.java:1967) org.jboss.seam.Component.getInstance(Component.java:1962) org.jboss.seam.faces.FacesPage.instance(FacesPage.java:92) org.jboss.seam.core.ConversationPropagation.restorePageContextConversationId(ConversationPropagation.java:84) org.jboss.seam.core.ConversationPropagation.restoreConversationId(ConversationPropagation.java:57) org.jboss.seam.jsf.SeamPhaseListener.afterRestoreView(SeamPhaseListener.java:391) org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:230) org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:196) com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:175) com.sun.faces.lifecycle.Phase.doPhase(Phase.java:114) com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:104) com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) javax.faces.webapp.FacesServlet.service(FacesServlet.java:265) weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227) weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125) weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292) weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26) weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:530) weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83) org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40) org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90) org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45) org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178) org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290) org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388) org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515) org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56) org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60) org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53) org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27) weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3592) weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121) weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2202) weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2108) weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1432) weblogic.work.ExecuteThread.execute(ExecuteThread.java:201) weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

+1  A: 

You get the following exception

No phase id bound to current thread (make sure you do not have two SeamPhaseListener instances installed)

But you said you have installed an ejb and web maven project. Maybe both includes a SeamPhaseListener when you deploy your application. It, maybe, explains why you get your exception (Two SeamPhaseListener instances installed).

My advice is (And if you want to avoid a lot of headache)

Always generate your project by using Seam-gem

See here why

A nice article, besides Seam in Action book, about JSF/Seam can be found here

Added to original answer

See what Seam in Action book talks about it

In Seam 2.0, the Seam phase listener is declared in a facesconfig.xml descriptor that is included in the core Seam JAR file, jboss-seam.jar. Thus, the phase listener is available as soon as you include this JAR file in your application.

So, you do not have to worry about SeamPhaseListener. Seam will.

UPDATE

First of all, you have a ear application. Before going on

Each EJB and war module should be declared in application.xml (The file that describes your ear)

So your ear application should looks like this one (Let's call your ear application pureCharger)

pureCharger.ear

    META-INF
        application.xml
    pureCharger-ejb.jar
        META-INF
            ejb-jar.xml
            persistence.xml
        lib
            // libraries ONLY USED by your EJB module goes here
    pureCharger-war.war
        WEB-INF
            web.xml
            components.xml
            faces-config.xml
            pages.xml
        lib
            // Here is what you want
            jboss-seam-debug.jar 
            jboss-seam-ui.jar
            jsf-facelets.jar
            // other libraries ONLY USED by your war module goes here
    jboss-seam.jar
    lib
        // JBoss Expression Language is used by both EJB and war module
        jboss-el.jar
        // libraries SHARED by all of your modules goes here

ejb-jar.xml is shown as follows (It enables @In-jection by your EJB components)

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" version="3.0">
    <interceptors>
        <interceptor>
            <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
        </interceptor>
    </interceptors>
    <assembly-descriptor>
        <interceptor-binding>
            <ejb-name>*</ejb-name>
            <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
        </interceptor-binding>
    </assembly-descriptor>
</ejb-jar>

jboss-seam.jar is an EJB module

So it should also be declared in application.xml file. And more, as said above, you do not have to define SeamPhaseListener because of jboss-seam.jar includes SeamPhaseListener. So avoid to see this nice message

Two SeamPhaseListener instances installed

So your ear application.xml should looks like this one

<?xml version="1.0" encoding="UTF-8"?>
<application version="5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"&gt;
    <display-name>pureCharger</display-name>
    <module>
        <ejb>pureCharger-ejb.jar</ejb>
    </module>
    <module>
        <ejb>jboss-seam.jar</ejb>
    </module>
    <module>
        <web>
            <web-uri>pureCharger-war.war</web-uri>
            <context-root>pureCharger</context-root>
        </web>
    </module>
</application>

ok. Let's go

You want to enable debug page

The Seam debug page will be available if this jar is deployed in WEB-INF/lib, along with the Facelets, and if you set the debug property of the init component

So your components.xml should looks like this one

<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://jboss.com/products/seam/components"
    xmlns:core="http://jboss.com/products/seam/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
    http://jboss.com/products/seam/core
    http://jboss.com/products/seam/core-2.2.xsd
    http://jboss.com/products/seam/components
    http://jboss.com/products/seam/components-2.2.xsd"&gt;
    <core:init jndi-pattern="pureCharger/#{ejbName}/local" debug="true"/>
    <core:manager concurrent-request-timeout="500" conversation-timeout="120000" conversation-id-parameter="cid" />
</components>

See as shown above i have defined global JNDI address (I suppose you are using JBoss and your ear application is called pureCharger) in order to Seam retrieve its EJB component

And finally, our web.xml file

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt;
    <context-param>
        <param-name>facelets.DEVELOPMENT</param-name>
        <param-value>true</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>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>server</param-value>
    </context-param>
    <!--It must be the first-->
    <filter>
        <filter-name>Seam Filter</filter-name>
        <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>Seam Filter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <!--It must be the first-->
    <listener>
        <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
    </listener>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>
    <!--specified in minutes-->
    <session-config>
        <session-timeout>30</session-timeout>
    </session-config>
</web-app>

And our faces-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<faces-config 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-facesconfig_1_2.xsd" version="1.2">
<application>
    <locale-config>
        <default-locale>en</default-locale>
        <supported-locale>en</supported-locale>
    </locale-config>
    <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
    <resource-bundle>
        <base-name>XX.XXXX.XXX.prs.web.messages.messages</base-name>
        <var>msgs</var>
    </resource-bundle>
    <resource-bundle>
        <base-name>XX.XXXX.XXX.prs.web.messages.validation</base-name>
        <var>val</var>
    </resource-bundle>
</application>
</faces-config>

A couple of notes

You do not need to declare org.jboss.seam.el.SeamELResolver in faces-config.xml because it is bundled with jboss-seam.jar.

Now, what is missed ?

We need to call our debug page (Do not forget starting up JBoss and deploy your ear application)

http://127.0.0.1:8080/pureCharger/debug.xhtml

And again

If you really want to avoid a lot of headache, use seam-gem

UPDATE

Is your ear project AS SHOWN ABOVE ??? MAKE SURE your war lib folder DOES NOT CONTAIN any jboss-seam.jar file. You said

I opened the .ear and the following jboss jars are in:

  • jboss-seam-debug-2.2.0.GA.jar (wrong) It must be placed inside war file WEB-INF/lib folder
  • jboss-el-1.0_02.CR4.jar (wrong) It must be placed inside ear file lib folder
  • jboss-seam-2.2.0.GA.jar (right) But it must be declared in ear META-INF/application.xml file

Here you can see a nice Tutorial about EJB 2.0 and 3.0 provided by me

Helpful links about Seam Maven Integration

http://www.seamframework.org/Community/MavenWithSeam

http://www.seamframework.org/Documentation/SeamWithMavenOverview

http://www.seamframework.org/Community/SeamInActionChapter2345And6Mavenized

http://www.seamframework.org/Community/MavenSeamArchetype

regards,

Arthur Ronald F D Garcia
I am sorry, but I don't understand how I may have "installed" two SeamPhaseListener. The way I see it, a SeamPhaseListener is installed when you make the appropriate entry in the web.xml file, which I have. Where is the second instance installed?
Markos Fragkakis
If you are suggesting that the fact that I have two projects is relevant, I have opened the final .ear and only one jboss-seam-debug.jar ends up in it. That is in case the presence of a jboss-seam-debug.jar automagically registers a SeamPhaseListener.
Markos Fragkakis
Please take another look, updated with current configuration and status.
Markos Fragkakis
@Arthur ... Sorry, this didn't work either... I am still getting the same exception. I also tried variations of the solution by excluding maven dependencies, but no luck. For some reason the SeamPhaseListener is still "registered" twice.
Markos Fragkakis
Anyway, thanks for getting into all this trouble. I will still not mark this answer as _the_ correct, but will upvote other comments you have made in other posts. Cheers!
Markos Fragkakis
That would be ideal. However, I am trying to bring Seam to an existing project, with its own structure. Although Seam works (or at least that's what it looks like), I have not managed to show the debug page. Which would be _very_ helpful at this point..
Markos Fragkakis
@Markos Fragkakis Updated. I hope it can be useful to you
Arthur Ronald F D Garcia
A: 

What do you mean debug page? Do you mean the default Seam debug page? Which is debug.seam? Typically http://localhost:8080/debug.seam ?

It is not enough to put in web.xml. You also need to put in components.xml

<core:init debug="true" jndi-pattern="myApp/#{ejbName}/local"/>

You also need to make sure that the jboss-seam-debug.jar is in classpath. Seam's interceptor should pick this up automatically.

If you are using Facelets, to get its debug page you will need to put this in web.xml

<context-param>
  <param-name>facelets.DEVELOPMENT</param-name>
  <param-value>true</param-value>
</context-param>

The tip from Arthur about always using seam-gen to generate your project is a very good idea.

I also see that Arthur is saying you need to make sure jboss-seam-debug.jar shouldnt be in your lib in your war. That is not necessarily correct. I have mine in

myapp.war/WEB-INF/lib/jboss-seam-debug.jar
Shervin
@Shervin No, no. I said jboss-seam-debug.jar must be placed inside war file WEB-INF **lib** folder. As shown by yourself
Arthur Ronald F D Garcia
@Arthur Ronald F D Garcia ah ok. Sorry, my bad then
Shervin
+1  A: 

The reason Seam the debug page did not appear is unbelievable (for me).

I packaged my application with Apache Maven. Traditionally, the filenames of jar files managed by maven also contain the version number. The jar for Seam is jboss-seam -2.2.0.GA.jar. Because Seam is an EJB module in the application, I declared its dependency as such. And indeed, the EAR contained it as an EJB module (located in the root of the EAR) and also declared it in the META-INF/application.xml.

I don't know if the specification defines naming restrictions for the EJB modules in an EAR, but the version part of the filename was what WebLogic did not like (if modified, the war works fine on JBoss).

I changed the setting in the maven-ear-plugin from this:

<ejbModule>
    <groupId>org.jboss.seam</groupId>
    <artifactId>jboss-seam</artifactId>
</ejbModule>

to this:

<ejbModule>
    <groupId>org.jboss.seam</groupId>
    <artifactId>jboss-seam</artifactId>
    <bundleFileName>jboss-seam.jar</bundleFileName>
</ejbModule>

And now I can see BOTH my application AND the Debug page.

Markos Fragkakis
@Markos Fragkakis Congratulations (+1). Now, you can see why i said: if you want to avoid a lot of headache, use Seam-gem. Besides that, Seam bundled examples can give you a good insight about Seam. Do not forget mark your own answer as accepted two days from now.
Arthur Ronald F D Garcia