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

后端 未结 3 1191
甜味超标
甜味超标 2020-12-03 23:25

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 jbo

3条回答
  •  时光说笑
    2020-12-03 23:48

    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)

    
    
        
            
                org.jboss.seam.ejb.SeamInterceptor
            
        
        
            
                *
                org.jboss.seam.ejb.SeamInterceptor
            
        
    
    

    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

    
    
        pureCharger
        
            pureCharger-ejb.jar
        
        
            jboss-seam.jar
        
        
            
                pureCharger-war.war
                pureCharger
            
        
    
    

    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

    
    
        
        
    
    

    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

    
    
        
            facelets.DEVELOPMENT
            true
        
        
            javax.faces.DEFAULT_SUFFIX
            .xhtml
        
        
            javax.faces.STATE_SAVING_METHOD
            server
        
        
        
            Seam Filter
            org.jboss.seam.servlet.SeamFilter
        
        
            Seam Filter
            /*
        
        
        
            org.jboss.seam.servlet.SeamListener
        
        
            Faces Servlet
            javax.faces.webapp.FacesServlet
        
        
            Faces Servlet
            *.xhtml
        
        
        
            30
        
    
    

    And our faces-config.xml

    
    
    
        
            en
            en
        
        com.sun.facelets.FaceletViewHandler
        
            XX.XXXX.XXX.prs.web.messages.messages
            msgs
        
        
            XX.XXXX.XXX.prs.web.messages.validation
            val
        
    
    
    

    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,

提交回复
热议问题