Jboss Seam: Enabling Debug page on WebLogic 10.3.2 (11g)

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">
    <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">
    <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">
    <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,

Leave a Comment